aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt109
-rw-r--r--ChangeLog115
-rw-r--r--NEWS20
-rw-r--r--README_d/README.cmake100
-rw-r--r--array.c3
-rw-r--r--awk.h42
-rw-r--r--awkgram.c1
-rw-r--r--awkgram.y1
-rw-r--r--awklib/eg/test-programs/gen-float-table.awk59
-rw-r--r--awklib/eg/test-programs/gen-float-table.c60
-rw-r--r--awklib/eg/test-programs/gen-float-table.py42
-rw-r--r--builtin.c22
-rw-r--r--cmake/ChangeLog32
-rw-r--r--cmake/Toolchain_clang.cmake19
-rw-r--r--cmake/Toolchain_generic.cmake21
-rw-r--r--cmake/Toolchain_mingw32.cmake23
-rw-r--r--cmake/Toolchain_s390.cmake20
-rw-r--r--cmake/auk.icobin5190 -> 0 bytes
-rwxr-xr-xcmake/basictest553
-rwxr-xr-xcmake/configure58
-rw-r--r--cmake/configure.cmake309
-rwxr-xr-xcmake/docmaker100
-rw-r--r--cmake/package.cmake71
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--doc/CMakeLists.txt95
-rw-r--r--doc/ChangeLog82
-rw-r--r--doc/awkcard.in31
-rw-r--r--doc/gawk.110
-rw-r--r--doc/gawk.info1450
-rw-r--r--doc/gawk.texi452
-rw-r--r--doc/gawktexi.in452
-rw-r--r--doc/it/ChangeLog100
-rwxr-xr-x[-rw-r--r--]doc/it/gawk.124
-rwxr-xr-x[-rw-r--r--]doc/it/gawktexi.in2184
-rwxr-xr-xdoc/it/gendocs.sh510
-rwxr-xr-xdoc/it/gendocs_template101
-rwxr-xr-xdoc/it/genera_formati.sh13
-rwxr-xr-x[-rw-r--r--]doc/it/texinfo.tex428
-rw-r--r--doc/wordlist1
-rw-r--r--eval.c97
-rw-r--r--extension/CMakeLists.txt84
-rw-r--r--extension/ChangeLog13
-rw-r--r--extension/rwarray.c40
-rw-r--r--extension/testext.c7
-rw-r--r--gawkapi.c44
-rw-r--r--gawkapi.h63
-rw-r--r--interpret.h12
-rw-r--r--main.c1
-rw-r--r--mpfr.c47
-rw-r--r--node.c24
-rw-r--r--pc/ChangeLog4
-rw-r--r--pc/Makefile.tst7
-rw-r--r--po/CMakeLists.txt133
-rw-r--r--po/ChangeLog4
-rwxr-xr-x[-rw-r--r--]po/it.po0
-rw-r--r--str_array.c38
-rw-r--r--support/CMakeLists.txt34
-rw-r--r--support/ChangeLog4
-rw-r--r--test/CMakeLists.txt90
-rw-r--r--test/ChangeLog25
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/asortbool.awk19
-rw-r--r--test/asortbool.ok6
-rw-r--r--test/dumpvars.ok2
-rw-r--r--test/functab5.ok1
-rw-r--r--test/id.ok1
-rw-r--r--test/intest.awk4
-rw-r--r--test/rwarray.awk11
-rw-r--r--test/symtab11.ok1
-rw-r--r--test/symtab8.ok2
73 files changed, 5125 insertions, 3446 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 0214708c..00000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# CMakeLists.txt --- CMake input file for gawk
-#
-# Copyright (C) 2013
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-cmake_minimum_required (VERSION 2.6)
-project (gawk C)
-
-include(cmake/configure.cmake)
-
-set (EXTRA_LIBS "")
-
-if (${HAVE_MPFR})
- set (EXTRA_LIBS ${EXTRA_LIBS} mpfr gmp)
-endif ()
-if (${HAVE_LIBREADLINE})
- set (EXTRA_LIBS ${EXTRA_LIBS} readline)
-endif ()
-if (${DYNAMIC})
- set (EXTRA_LIBS ${EXTRA_LIBS} ${CMAKE_DL_LIBS} )
-endif ()
-
-include_directories(${CMAKE_SOURCE_DIR})
-include_directories(${CMAKE_SOURCE_DIR}/support)
-
-if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
- # This is enough to build with MinGW in a native Windows environment
- # and also with a cross-compiler on OpenSuSE 12.2.
- # On Ubuntu 12.04 patches to gawk's source code are needed:
- # - insert #include <windows.h> at the top of awk.h
- # - remove function execvp from pc/gawkmisc.pc
- DefineConfigHValue(HAVE_SETENV 1)
- DefineConfigHValue(HAVE_USLEEP 1)
- DefineConfigHValue(STDC_HEADERS 1)
- DefineConfigHValue(HAVE_STRINGIZE 1)
- include_directories(${CMAKE_SOURCE_DIR}/missing_d)
- DefineConfigHValue(HAVE_MKSTEMP 1)
- set (EXTRA_LIBS ${EXTRA_LIBS} ws2_32)
- # TODO: Eli Zaretskii remined me that the generated
- # settings in config.h should be the same as those in
- # pc/config.h. With these settings and DYNAMIC=1
- # it looks like functions in dynamic libs (extensions) can
- # be invoked on Windows.
- DefineConfigHValue(HAVE_GETSYSTEMTIMEASFILETIME 1)
- set (GAWK_SOURCES ${GAWK_SOURCES} regex.c pc/getid.c pc/gawkmisc.pc pc/popen.c)
- include_directories(${CMAKE_SOURCE_DIR}/pc)
-endif()
-
-add_subdirectory(support)
-
-set (GAWK_SOURCES ${GAWK_SOURCES}
- array.c
- builtin.c
- cint_array.c
- command.c
- debug.c
- eval.c
- ext.c
- field.c
- floatcomp.c
- gawkapi.c
- gawkmisc.c
- int_array.c
- io.c
- main.c
- mpfr.c
- msg.c
- node.c
- profile.c
- re.c
- replace.c
- str_array.c
- symbol.c
- version.c
-)
-
-add_executable (gawk ${GAWK_SOURCES} ${BISON_awkgram_OUTPUTS})
-target_link_libraries (gawk m support ${EXTRA_LIBS})
-install(PROGRAMS ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
-
-# Beware: before building the extension, -DGAWK gets undefined.
-add_subdirectory(extension)
-enable_testing()
-add_subdirectory(test)
-add_subdirectory(doc)
-include(InstallRequiredSystemLibraries)
-set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
-include(cmake/package.cmake)
diff --git a/ChangeLog b/ChangeLog
index 2fa68887..36b37c35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,11 @@
* main.c (UPDATE_YEAR): Update to 2021.
+2021-09-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * mpfr.c (mpg_cmp_as_numbers): Avoid compiler warning about possibly
+ used before set. Thanks to Michal Jaegermann for the report.
+
2021-08-18 Arnold D. Robbins <arnold@skeeve.com>
* main.c (main): Change have_srcfile from int to bool.
@@ -128,6 +133,11 @@
2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+ * CMakeLists.txt: Removed.
+ * cmake: Removed directory and its contents.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
Move to Automake 1.16.3.
* configure.ac (AM_INIT_AUTOMAKE): Add subdir-objects option.
@@ -137,6 +147,43 @@
* Makefile.am (EXTRA_DIST): Remove files that are now in build-aux.
+ Unrelated:
+
+ * builtin.c (do_sub): Remove check for BOOL as target. It's not
+ correct anymore.
+
+2021-05-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * eval.c (flags2str): Move BOOL entry into the right place in the
+ list.
+ * NEWS: Update with info on mkbool.
+
+2021-05-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (do_bool): Renamed do_mkbool.
+ * awkgram.y (tokentab): Rename bool to mkbool.
+ * builtin.c (do_bool): Renamed do_mkbool.
+
+2021-04-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (boolval): Remove check for BOOL flag. It was incorrect.
+ Thanks to Andrew Schorr for the catch.
+ For Node_val, update the comment to describe the BOOL flag, and
+ move BOOL up to be alongside the flags for Node_val.
+
+2021-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ Make bools plain numbers that have bool flag instead of
+ being weird string values.
+
+ * array.c (do_sort_up_value_type): Remove special ordering
+ for booleans.
+ * awk.h (warn_bool): Remove declaration.
+ * builtin.c (warn_bool): Remove function and all calls.
+ * gawkapi.c (node_to_awk_value): Update switches to look for
+ NUMBER|BOOL.
+ * node.c (make_bool_node): Revise string values and flag bits.
+
2021-04-16 Arnold D. Robbins <arnold@skeeve.com>
* main (arg_assign): For -v '@/...' make sure that there are
@@ -158,6 +205,61 @@
* interpret.h (r_interpret): Remove LINT_no_effect from Op_lint
case.
+2021-04-14 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (do_sort_up_value_type): Fix order with bools.
+
+2021-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk_api.h (gawk_api_minor_version): Increase to 2.
+ * gawk_api.c (assign_bool): New function.
+ (node_to_awk_value): Finish updating for bool types and values.
+
+2021-03-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkapi.h (make_bool): New inline function.
+ Update table of request/return types.
+ * gawkapi.c (awk_value_to_node): Add support for AWK_BOOL.
+ (node_to_awk_value): Start on same. Not yet complete.
+
+2021-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * str_array.c (fnv1a_hash_string): New function.
+ (str_array_init): Use fnv1a_hash_string if AWK_HASH env var
+ set to "fnv1a".
+
+2021-03-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * array.c (do_sort_up_value_type): Add logic for handling bools.
+
+2021-03-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awk.h (warn_bool, do_bool): Add function declarations.
+ * awkgram.y (tokentab): Add entry for "bool" builtin.
+ * builtin.c (warn_bool): New function.
+ (do_index, do_substr, do_toupper, do_tolower, do_match,
+ do_length): Call it.
+ (do_sub): If first arg to sub/gsub is bool, fatal error.
+ (do_bool): New function.
+ * field.c (do_split, do_patsplit): Call warn_bool.
+ * main.c (load_procinfo_bools): Removed function and call.
+
+2021-03-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ Start on a bool type for gawk.
+
+ * awk.h (BOOL): New flag value.
+ (make_bool_node): Add declaration of new function.
+ (bool_val): Check for BOOL along with NUMBER.
+ * builtin.c (do_typeof): Add support for BOOL.
+ * eval.c (flags2str): Ditto.
+ * gawkapi.h (awk_val_type): Add AWK_BOOL.
+ (awk_value_t): Add awk_bool_t element to the union and macro for it.
+ (struct gawk_api): Update the table of request/return values.
+ * main.c (load_procinfo_bools): New function.
+ (load_procinfo): Call it.
+ * node.c (make_bool_node): New function.
+
2021-02-13 Arnold D. Robbins <arnold@skeeve.com>
* io.c (nextfile): Use the value of ARGC directly in the for
@@ -280,6 +382,19 @@
2020-11-02 Arnold D. Robbins <arnold@skeeve.com>
+ Make gawk numeric comparisons act like C doubles.
+ MPFR differs from doubles w.r.t. NaN, not sure why yet.
+
+ * awk.h (scalar_cmp_t): New enum.
+ * builtin.c (format_nan_inf): Use mpfr_signbit, not mpfr_sgn.
+ * eval.c (cmp_doubles): New routine.
+ (cmp_scalars): Change type to bool, rework logic.
+ * interpret.h (r_interpret): Rework scalar comparisons.
+ * mpfr.c (mpg_cmp_as_numbers): New routine.
+ * node.c: Use <math.h>, not "math.h", minor comment edits.
+
+2020-11-02 Arnold D. Robbins <arnold@skeeve.com>
+
* re.c (make_regexp): Cast len parameter to int to avoid
compiler warnings.
diff --git a/NEWS b/NEWS
index 5563f1ef..a90d6842 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,26 @@
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
+Changes from 5.1.x to 5.2.0
+---------------------------
+
+1. Numeric scalars now compare in the same way as C for the relational
+operators. Comparison order for sorting has not changed. This only
+makes a difference when comparing Infinity and NaN values with
+regular numbers; it should not be noticeable most of the time.
+
+2. If the AWK_HASH environment variable is set to "fnv1a" gawk will
+use the FNV1-A hash function for associative arrays.
+
+3. The CMake infrastructure has been removed. In the five years it was in
+the tree, nobody used it, and it was not updated.
+
+4. There is now a new function, mkbool(), that creates Boolean-typed
+values. These values *are* numbers, but they are also tagged as
+Boolean. This is mainly for use with data exchange to/from languages
+or environments that support real Boolean values. See the manual
+for details.
+
Changes from 5.1.0 to 5.1.1
---------------------------
diff --git a/README_d/README.cmake b/README_d/README.cmake
deleted file mode 100644
index 7a61aed4..00000000
--- a/README_d/README.cmake
+++ /dev/null
@@ -1,100 +0,0 @@
-CMake is a build automation system
- http://en.wikipedia.org/wiki/Cmake
-
-We try to use it as a replacement for the established GNU build system.
-This attempt is currently only experimental. If you wonder why anyone
-should do this, read
-
- Why the KDE project switched to CMake -- and how
- http://lwn.net/Articles/188693/
- Escape from GNU Autohell!
- http://www.shlomifish.org/open-source/anti/autohell
-
-- How can I get GNU Awk compiled with CMake as fast as possible ?
- git clone git://git.savannah.gnu.org/gawk.git
- cd gawk
- git checkout cmake
- mkdir build
- cd build
- cmake ..
- make
- ./gawk --version
- make test
-Notice that this git-checkout allows you to read the source code,
-track the cmake branch and get updates. You will not be able to
-commit anything.
-
-- How can I use git to contribute source code ?
-You need an account at Savannah. Read this to understand the first steps:
- http://savannah.gnu.org/maintenance/UsingGit
- README.git
-Use your account there to register your public ssh key at Savannah.
-Then you are ready to checkout. Remember that (when cloning) you are
-setting up your own local repository and make sure you configure it
-properly.
- git clone ssh://my_account_name@git.sv.gnu.org/srv/git/gawk.git
- git config --global user.name "first-name last-name"
- git config --global user.email First.Last@email.com
- git config --global color.ui auto
-
-- What is the current status of the cmake branch ?
-It has just begun, pre-alpha, unclear if it will ever be taken up
-by the maintainer. We want to study if using CMake with such a
-basic tool like gawk is feasible and if it easier to use than
-the GNU build system.
-
-- Where can I find a tutorial on CMake basics ?
-Use the "official tutorial":
- http://www.cmake.org/cmake/help/cmake_tutorial.html
-
-- Where is the reference of all commands and variables ?
-Depending on the CMake version you use, select one of these:
- http://www.cmake.org/cmake/help/v2.8.10/cmake.html
-
-- How can I cross-compile ?
-Proceed in the same way as explained above for native compilation,
-but use a different build directory. When using CMake, do this:
- cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain_mingw32.cmake ..
-Write a new Toolchain file for your cross-compiler and use it.
-
-- How can I build an installable file ?
-By default, installable files will not be generated.
-But if you instruct CMake about the kind of installable file you want,
-then some kinds of files can be generated.
-The exact kind of installable file depends on your operating system.
-Possible kinds are TGZ (.tar.gz file), RPM (.rpm file), and DEB (.deb file).
- cmake -DCPACK_GENERATOR=DEB ..
- make package
-
-- Can I build an executable that runs on any Win32 platform ?
-Yes, there are two ways of doing this.
-In both cases you need a MinGW compiler and the NSIS package builder
-installed on the host that shall do the build.
- http://sourceforge.net/projects/mingw
- http://sourceforge.net/projects/nsis
-When installed properly, the NSIS tool can even build an installer file
-(a single .exe file that unpacks, registers and installs the gawk executable
-and several other files).
-1. way: native build on a Win32 platform
- http://www.cmake.org/cmake/help/runningcmake.html
- After clicking "Configure" select the MinGW option with the default native compiler
- In the build directory, the command "mingw32-make" will build the gawk.exe
- The command "mingw32-make package" will build installer file
-2. way: build with cross-compiler on a Linux platform like Ubuntu 12.04 LTS
- Proceed as describe above for cross-compilers.
- The command "make ; make package" will build gawk.exe and the installer file
-
-- How can I run test cases ?
-You can run all the test cases that are defined in test/Makefile.am.
-These test case scripts were not changed, but the way they are invoked has
-been adapted to CMake habits.
-See http://cmake.org/Wiki/CMake/Testing_With_CTest#Simple_Testing
- cmake ..
- make
- make test # run all test cases
- ctest -N # list all test cases but don't run them
- ctest -R BASIC # run all test cases belonging to group BASIC
- ctest -R MPFR # run all test cases belonging to group MPFR
- ctest -E SHLIB.filefunc # run all tests, except the SHLIB.filefunc test case
-Remember that running test cases is possible only after a native build.
-
diff --git a/array.c b/array.c
index 76853779..cbed1254 100644
--- a/array.c
+++ b/array.c
@@ -1212,11 +1212,12 @@ do_sort_up_value_type(const void *p1, const void *p2)
(void) fixtype(n1);
(void) fixtype(n2);
+ /* 3a. Numbers first */
if ((n1->flags & NUMBER) != 0 && (n2->flags & NUMBER) != 0) {
return cmp_numbers(n1, n2);
}
- /* 3. All numbers are less than all strings. This is aribitrary. */
+ /* 3b. All numbers are less than all strings. This is aribitrary. */
if ((n1->flags & NUMBER) != 0 && (n2->flags & STRING) != 0) {
return -1;
} else if ((n1->flags & STRING) != 0 && (n2->flags & NUMBER) != 0) {
diff --git a/awk.h b/awk.h
index cb7c4990..9e6f2ca1 100644
--- a/awk.h
+++ b/awk.h
@@ -436,6 +436,10 @@ typedef struct exp_node {
* is a hint to indicate that an integer array optimization may be
* used when this value appears as a subscript.
*
+ * The BOOL flag indicates that this number should be converted to True
+ * or False by extensions that interchange data with other languages,
+ * via JSON, XML or some other serialization mechanism.
+ *
* We hope that the rest of the flags are self-explanatory. :-)
*/
MALLOC = 0x0001, /* stptr can be free'd, i.e. not a field node pointing into a shared buffer */
@@ -445,24 +449,25 @@ typedef struct exp_node {
NUMBER = 0x0010, /* assigned as number */
USER_INPUT = 0x0020, /* user input: if NUMERIC then
* a NUMBER */
- INTLSTR = 0x0040, /* use localized version */
- NUMINT = 0x0080, /* numeric value is an integer */
- INTIND = 0x0100, /* integral value is array index;
+ BOOL = 0x0040, /* this is a boolean value */
+ INTLSTR = 0x0080, /* use localized version */
+ NUMINT = 0x0100, /* numeric value is an integer */
+ INTIND = 0x0200, /* integral value is array index;
* lazy conversion to string.
*/
- WSTRCUR = 0x0200, /* wide str value is current */
- MPFN = 0x0400, /* arbitrary-precision floating-point number */
- MPZN = 0x0800, /* arbitrary-precision integer */
- NO_EXT_SET = 0x1000, /* extension cannot set a value for this variable */
- NULL_FIELD = 0x2000, /* this is the null field */
+ WSTRCUR = 0x0400, /* wide str value is current */
+ MPFN = 0x0800, /* arbitrary-precision floating-point number */
+ MPZN = 0x01000, /* arbitrary-precision integer */
+ NO_EXT_SET = 0x02000, /* extension cannot set a value for this variable */
+ NULL_FIELD = 0x04000, /* this is the null field */
/* type = Node_var_array */
- ARRAYMAXED = 0x4000, /* array is at max size */
- HALFHAT = 0x8000, /* half-capacity Hashed Array Tree;
+ ARRAYMAXED = 0x08000, /* array is at max size */
+ HALFHAT = 0x010000, /* half-capacity Hashed Array Tree;
* See cint_array.c */
- XARRAY = 0x10000,
- NUMCONSTSTR = 0x20000, /* have string value for numeric constant */
- REGEX = 0x40000, /* this is a typed regex */
+ XARRAY = 0x020000,
+ NUMCONSTSTR = 0x040000, /* have string value for numeric constant */
+ REGEX = 0x080000, /* this is a typed regex */
} flags;
long valref;
} NODE;
@@ -1513,6 +1518,7 @@ extern int strncasecmpmbs(const unsigned char *,
const unsigned char *, size_t);
extern int sanitize_exit_status(int status);
extern void check_symtab_functab(NODE *dest, const char *fname, const char *msg);
+extern NODE *do_mkbool(int nargs);
/* debug.c */
extern void init_debug(void);
extern int debug_prog(INSTRUCTION *pc);
@@ -1586,6 +1592,15 @@ typedef enum {
extern field_sep_type current_field_sep(void);
extern const char *current_field_sep_str(void);
+typedef enum {
+ SCALAR_EQ,
+ SCALAR_NEQ,
+ SCALAR_LT,
+ SCALAR_LE,
+ SCALAR_GT,
+ SCALAR_GE,
+} scalar_cmp_t;
+
/* gawkapi.c: */
extern gawk_api_t api_impl;
extern void init_ext_api(void);
@@ -1715,6 +1730,7 @@ extern NODE *r_force_number(NODE *n);
extern NODE *r_format_val(const char *format, int index, NODE *s);
extern NODE *r_dupnode(NODE *n);
extern NODE *make_str_node(const char *s, size_t len, int flags);
+extern NODE *make_bool_node(bool value);
extern NODE *make_typed_regex(const char *re, size_t len);
extern void *more_blocks(int id);
extern int parse_escape(const char **string_ptr);
diff --git a/awkgram.c b/awkgram.c
index caa62a75..c47bb43c 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4822,6 +4822,7 @@ static const struct token tokentab[] = {
{"log", Op_builtin, LEX_BUILTIN, A(1), do_log, MPF(log)},
{"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift, MPF(lshift)},
{"match", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match, 0},
+{"mkbool", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_mkbool, 0},
{"mktime", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_mktime, 0},
{"namespace", Op_symbol, LEX_NAMESPACE, GAWKX, 0, 0},
{"next", Op_K_next, LEX_NEXT, 0, 0, 0},
diff --git a/awkgram.y b/awkgram.y
index 88bd2967..e09d1117 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -2314,6 +2314,7 @@ static const struct token tokentab[] = {
{"log", Op_builtin, LEX_BUILTIN, A(1), do_log, MPF(log)},
{"lshift", Op_builtin, LEX_BUILTIN, GAWKX|A(2), do_lshift, MPF(lshift)},
{"match", Op_builtin, LEX_BUILTIN, NOT_OLD|A(2)|A(3), do_match, 0},
+{"mkbool", Op_builtin, LEX_BUILTIN, GAWKX|A(1), do_mkbool, 0},
{"mktime", Op_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2), do_mktime, 0},
{"namespace", Op_symbol, LEX_NAMESPACE, GAWKX, 0, 0},
{"next", Op_K_next, LEX_NEXT, 0, 0, 0},
diff --git a/awklib/eg/test-programs/gen-float-table.awk b/awklib/eg/test-programs/gen-float-table.awk
new file mode 100644
index 00000000..ea6269c3
--- /dev/null
+++ b/awklib/eg/test-programs/gen-float-table.awk
@@ -0,0 +1,59 @@
+function eq(left, right)
+{
+ return left == right
+}
+
+function ne(left, right)
+{
+ return left != right
+}
+
+function lt(left, right)
+{
+ return left < right
+}
+
+function le(left, right)
+{
+ return left <= right
+}
+
+function gt(left, right)
+{
+ return left > right
+}
+
+function ge(left, right)
+{
+ return left >= right
+}
+
+BEGIN {
+ nan = sqrt(-1)
+ inf = -log(0)
+ split("== != < <= > >=", names)
+ names[3] = names[3] " "
+ names[5] = names[5] " "
+ split("eq ne lt le gt ge", funcs)
+
+ compare[1] = 2.0
+ compare[2] = values[1] = -sqrt(-1.0) # nan
+ compare[3] = values[2] = sqrt(-1.0) # -nan
+ compare[4] = values[3] = -log(0.0) # inf
+ compare[5] = values[4] = log(0.0) # -inf
+
+ for (i = 1; i in values; i++) {
+ for (j = 1; j in compare; j++) {
+ for (k = 1; k in names; k++) {
+ the_func = funcs[k]
+ printf("%g %s %g -> %s\n",
+ values[i],
+ names[k],
+ compare[j],
+ @the_func(values[i], compare[j]) ?
+ "True" : "False");
+ }
+ printf("\n");
+ }
+ }
+}
diff --git a/awklib/eg/test-programs/gen-float-table.c b/awklib/eg/test-programs/gen-float-table.c
new file mode 100644
index 00000000..ba3a0d05
--- /dev/null
+++ b/awklib/eg/test-programs/gen-float-table.c
@@ -0,0 +1,60 @@
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+#define def_func(name, op) \
+ bool name(double left, double right) { \
+ return left op right; \
+ }
+
+def_func(eq, ==)
+def_func(ne, !=)
+def_func(lt, <)
+def_func(le, <=)
+def_func(gt, >)
+def_func(ge, >=)
+
+struct {
+ const char *name;
+ bool (*func)(double left, double right);
+} functions[] = {
+ { "==", eq },
+ { "!=", ne },
+ { "< ", lt },
+ { "<=", le },
+ { "> ", gt },
+ { ">=", ge },
+ { 0, 0 }
+};
+
+int main()
+{
+ double values[] = {
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ };
+ double compare[] = { 2.0,
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ };
+
+ int i, j, k;
+
+ for (i = 0; i < 4; i++) {
+ for (j = 0; j < 5; j++) {
+ for (k = 0; functions[k].name != NULL; k++) {
+ printf("%g %s %g -> %s\n", values[i],
+ functions[k].name,
+ compare[j],
+ functions[k].func(values[i], compare[j]) ? "True" : "False");
+ }
+ printf("\n");
+ }
+ }
+
+ return 0;
+}
diff --git a/awklib/eg/test-programs/gen-float-table.py b/awklib/eg/test-programs/gen-float-table.py
new file mode 100644
index 00000000..8631b817
--- /dev/null
+++ b/awklib/eg/test-programs/gen-float-table.py
@@ -0,0 +1,42 @@
+from math import *
+
+nan = float('NaN')
+inf = float('Inf')
+
+def eq(left, right):
+ return left == right
+
+def ne(left, right):
+ return left != right
+
+def lt(left, right):
+ return left < right
+
+def le(left, right):
+ return left <= right
+
+def gt(left, right):
+ return left > right
+
+def ge(left, right):
+ return left >= right
+
+func_map = {
+ "==": eq,
+ "!=": ne,
+ "< ": lt,
+ "<=": le,
+ "> ": gt,
+ ">=": ge,
+}
+
+compare = [2.0, nan, -nan, inf, -inf]
+values = [nan, -nan, inf, -inf]
+
+for i in range(len(values)):
+ for j in range(len(compare)):
+ for op in func_map:
+ print("%g %s %g -> %s" %
+ (values[i], op, compare[j], func_map[op](values[i], compare[j])))
+
+ print("")
diff --git a/builtin.c b/builtin.c
index d7ba82c9..c27b5081 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4154,7 +4154,10 @@ do_typeof(int nargs)
}
break;
case Node_val:
- switch (fixtype(arg)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(arg)->flags & (STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case NUMBER|BOOL:
+ res = "number|bool";
+ break;
case NUMBER:
res = "number";
break;
@@ -4319,7 +4322,7 @@ format_nan_inf(NODE *n, char format)
goto fmt;
} else if (mpfr_inf_p(n->mpg_numbr)) {
- strcpy(buf, mpfr_sgn(n->mpg_numbr) < 0 ? "-inf" : "+inf");
+ strcpy(buf, mpfr_signbit(n->mpg_numbr) ? "-inf" : "+inf");
goto fmt;
} else
@@ -4364,6 +4367,21 @@ check_symtab_functab(NODE *dest, const char *fname, const char *msg)
fatal(msg, fname, "FUNCTAB");
}
+/* do_mkbool --- create boolean values */
+
+NODE *
+do_mkbool(int nargs)
+{
+ NODE *tmp;
+ bool result;
+
+ tmp = POP_SCALAR();
+ result = boolval(tmp);
+ DEREF(tmp);
+
+ return make_bool_node(result);
+}
+
/* reverse --- reverse the contents of a string in place */
static void
diff --git a/cmake/ChangeLog b/cmake/ChangeLog
deleted file mode 100644
index fb2691b6..00000000
--- a/cmake/ChangeLog
+++ /dev/null
@@ -1,32 +0,0 @@
-2020-04-14 Arnold D. Robbins <arnold@skeeve.com>
-
- * 5.1.0: Release tar ball made.
-
-2019-06-18 Arnold D. Robbins <arnold@skeeve.com>
-
- * 5.0.1: Release tar ball made.
-
-2019-04-12 Arnold D. Robbins <arnold@skeeve.com>
-
- * 5.0.0: Release tar ball made.
-
-2018-02-25 Arnold D. Robbins <arnold@skeeve.com>
-
- * 4.2.1: Release tar ball made.
-
-2017-10-19 Arnold D. Robbins <arnold@skeeve.com>
-
- * 4.2.0: Release tar ball made.
-
-2016-12-27 Juergen Kahrs <Juergen.Kahrs@googlemail.com>
-
- * configure.cmake: Include po directory.
-
-2014-08-12 Juergen Kahrs <jkahrs@users.sourceforge.net>
-
- (Date is approximate).
-
- * Toolchain_clang.cmake, Toolchain_generic.cmake,
- Toolchain_mingw32.cmake, Toolchain_s390.cmake,
- auk.ico, basictest, configure, configure.cmake,
- docmaker, package.cmake: New files.
diff --git a/cmake/Toolchain_clang.cmake b/cmake/Toolchain_clang.cmake
deleted file mode 100644
index 89353570..00000000
--- a/cmake/Toolchain_clang.cmake
+++ /dev/null
@@ -1,19 +0,0 @@
-# http://www.cmake.org/Wiki/CmakeMingw
-# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
-
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Generic)
-
-# which compilers to use for C and C++
-SET(CMAKE_C_COMPILER /usr/bin/clang)
-
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH /usr/lib64/clang/3.1)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/cmake/Toolchain_generic.cmake b/cmake/Toolchain_generic.cmake
deleted file mode 100644
index 91ddc6e7..00000000
--- a/cmake/Toolchain_generic.cmake
+++ /dev/null
@@ -1,21 +0,0 @@
-# http://www.cmake.org/Wiki/CmakeMingw
-# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
-
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Generic)
-
-# which compilers to use for C and C++
-# Settings for Ubuntu 12.04.1 LTS
-SET(CMAKE_C_COMPILER /usr/bin/gcc)
-
-# here is the target environment located
-# Settings for Ubuntu 12.04.1 LTS
-SET(CMAKE_FIND_ROOT_PATH /usr/)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/cmake/Toolchain_mingw32.cmake b/cmake/Toolchain_mingw32.cmake
deleted file mode 100644
index bb885f2f..00000000
--- a/cmake/Toolchain_mingw32.cmake
+++ /dev/null
@@ -1,23 +0,0 @@
-# http://www.cmake.org/Wiki/CmakeMingw
-# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
-
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Windows)
-
-# which compilers to use for C and C++
-# Settings for Ubuntu 12.04.1 LTS
-SET(CMAKE_C_COMPILER /usr/bin/i686-w64-mingw32-gcc)
-SET(CMAKE_CXX_COMPILER /usr/bin/i686-w64-mingw32-g++)
-SET(CMAKE_RC_COMPILER /usr/bin/i686-w64-mingw32-windres)
-
-# here is the target environment located
-# Settings for Ubuntu 12.04.1 LTS
-SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/cmake/Toolchain_s390.cmake b/cmake/Toolchain_s390.cmake
deleted file mode 100644
index e1cdcfff..00000000
--- a/cmake/Toolchain_s390.cmake
+++ /dev/null
@@ -1,20 +0,0 @@
-# http://www.cmake.org/Wiki/CmakeMingw
-# http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file
-# http://wiki.debian.org/EmdebianToolchain#Get_the_binaries
-
-# the name of the target operating system
-SET(CMAKE_SYSTEM_NAME Generic)
-
-# which compilers to use for C and C++
-SET(CMAKE_C_COMPILER /usr/bin/s390-linux-gnu-gcc-4.4)
-
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH /usr/s390-linux-gnu/)
-
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
diff --git a/cmake/auk.ico b/cmake/auk.ico
deleted file mode 100644
index 795ef1d9..00000000
--- a/cmake/auk.ico
+++ /dev/null
Binary files differ
diff --git a/cmake/basictest b/cmake/basictest
deleted file mode 100755
index 210ed224..00000000
--- a/cmake/basictest
+++ /dev/null
@@ -1,553 +0,0 @@
-#!/bin/sh
-
-# Use this for debugging the test cases.
-# The resulting textual output will not destroy the test cases.
-set -x
-# After test case execution, the output can be found in
-# build/Testing/Temporary/LastTest.log
-
-export PATH=$PATH:/c/MinGW/msys/1.0/bin
-export GAWKEXE=$1
-export TESTCASE=$2
-TOPSRCDIR=$(dirname ${0})/..
-SRCDIR=${TOPSRCDIR}/test
-export AWKPATH=${SRCDIR}
-export AWKLIBPATH=$(dirname ${GAWKEXE})/extension/
-export LANG=C
-# Is this shell running in a native MinGW shell (MSYS) ?
-if test -n "$COMSPEC"; then
- # Ignore all differences in white space.
- COMPARE="diff -w"
- PATH_SEPARATOR="\\"
-else
- # This is a shell running in Unix environment.
- COMPARE="cmp"
- PATH_SEPARATOR="/"
-fi
-
-# This is the central function for executing a standard test case.
-# Many of the more specialized test cases rely on this function.
-function simple_test_case() {
- local options=$1 # options passed to the gawk executable
- local parameters=$2 # parameters passed to the test case script
- cd ${SRCDIR}
- if test -r ${TESTCASE}.in
- # Any existing .in file will be redirected to standard input.
- # The output redirection must be bound to the test script, otherwise
- # the "set -x" logging would mix with the test case output.
- then
- ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} < ${TESTCASE}.in ${postgawk} > _${TESTCASE} 2>&1
- else
- ${pregawk} $GAWKEXE ${options} -f ${TESTCASE}.awk ${parameters} ${postgawk} > _${TESTCASE} 2>&1
- fi || echo EXIT CODE: $? >> _${TESTCASE}
- # Compare the expected (correct) output with the actual output.
- ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
- # If the comparison succeeds then remove the actual output.
- # Else leave the actual output file untouched for later analysis.
-}
-
-# Each test case that cannot be handle in the "standard way" shall
-# be implemented as a function here.
-
-function lintold() { simple_test_case "--lint-old" "" ; }
-function defref() { simple_test_case "--lint" "" ; }
-function fmtspcl() { simple_test_case "--lint" "" ; }
-function lintwarn() { simple_test_case "--lint" "" ; }
-function noeffect() { simple_test_case "--lint" "" ; }
-function nofmtch() { simple_test_case "--lint" "" ; }
-function shadow() { simple_test_case "--lint" "" ; }
-function uninit2() { simple_test_case "--lint" "" ; }
-function uninit3() { simple_test_case "--lint" "" ; }
-function uninit4() { simple_test_case "--lint" "" ; }
-function uninit5() { simple_test_case "--lint" "" ; }
-function uninitialized() { simple_test_case "--lint" "" ; }
-
-function regtest() {
- echo 'Some of the output from regtest is very system specific, do not'
- echo 'be distressed if your output differs from that distributed.'
- echo 'Manual inspection is called for.'
- AWK=$GAWKEXE ${SRCDIR}/regtest.sh
-}
-
-function compare() { simple_test_case "" "0 1" ; }
-
-function inftest() {
- echo This test is very machine specific...
- $GAWKEXE -f ${SRCDIR}/inftest.awk | sed "s/inf/Inf/g" >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function getline2() { simple_test_case "" "getline2.awk getline2.awk" ; }
-
-function awkpath() {
- AWKPATH="${SRCDIR}$(PATH_SEPARATOR)/lib" $GAWKEXE -f awkpath.awk >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function argtest() { simple_test_case "" "-x -y abc" ; }
-
-function badargs() {
- $GAWKEXE -f 2>&1 | grep -v patchlevel >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function nonl() { simple_test_case "--lint" "/dev/null" ; }
-
-function poundbang() {
-# The original poundbang test case looks a bit non-deterministic.
-# This is a shortened version.
- sed "s;/tmp/gawk;$GAWKEXE;" < ${SRCDIR}/poundbang.awk > ./_pbd.awk
- chmod +x ./_pbd.awk
- ./_pbd.awk ${SRCDIR}/poundbang.awk > _`basename ${TESTCASE}` ;
- ${COMPARE} ${SRCDIR}/poundbang.awk _`basename ${TESTCASE}` && rm -f _`basename ${TESTCASE}` _pbd.awk
-}
-
-function messages() {
- $GAWKEXE -f ${SRCDIR}/messages.awk >_out2 2>_out3
- ${COMPARE} ${SRCDIR}/out1.ok _out1 && ${COMPARE} ${SRCDIR}/out2.ok _out2 && ${COMPARE} ${SRCDIR}/out3.ok _out3 && rm -f _out1 _out2 _out3
-}
-
-function argarray() {
- case ${SRCDIR} in
- .) : ;;
- *) cp ${SRCDIR}/argarray.in . ;;
- esac
- TEST=test echo just a test | $GAWKEXE -f ${SRCDIR}/argarray.awk ./argarray.in - >_${TESTCASE}
- case ${SRCDIR} in
- .) : ;;
- *) rm -f ./argarray.in ;;
- esac
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-
-function localenl() {
- ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} 2>/dev/null
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function mbprintf1() {
- GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
- LANG=en_US.UTF-8
- $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function mbfw1() {
- GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
- LANG=en_US.UTF-8
- $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function printfbad2() {
- $GAWKEXE --lint -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in 2>&1 | sed "s;$SRCDIR/;;g" >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function beginfile1() {
- AWKPATH=${SRCDIR} $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.awk . ./no/such/file Makefile >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function beginfile2() {
- # This differs from the original, the pwd part is new.
- # The re-direction is now bound to the .sh file.
- # This way the output of "set -x" is not written to the script's output file.
- ( cd ${SRCDIR} && LC_ALL=C AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh ${SRCDIR}/${TESTCASE}.in > `pwd`/_${TESTCASE} 2>&1 )
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
-}
-
-function dumpvars() {
- AWKPATH=${SRCDIR} $GAWKEXE --dump-variables 1 < ${SRCDIR}/${TESTCASE}.in >/dev/null 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- mv awkvars.out _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function manyfiles() {
- rm -rf junk
- mkdir junk
- $GAWKEXE 'BEGIN { for (i = 1; i <= 1030; i++) print i, i}' >_${TESTCASE}
- $GAWKEXE -f ${SRCDIR}/manyfiles.awk _${TESTCASE} _${TESTCASE}
- wc -l junk/* | $GAWKEXE '$1 != 2' | wc -l | sed "s/ *//g" > _${TESTCASE}
- rm -rf junk
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function exitval1() {
- $GAWKEXE -f ${SRCDIR}/exitval1.awk >_${TESTCASE} 2>&1; echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function fsspcoln() {
- $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 'FS=[ :]+' ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rsstart2() {
- $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/rsstart1.in >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rsstart3() {
- head ${SRCDIR}/rsstart1.in | $GAWKEXE -f ${SRCDIR}/rsstart2.awk >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function strftime() {
- echo This test could fail on slow machines or on a minute boundary,
- echo so if it does, double check the actual results:
- GAWKLOCALE=C; export GAWKLOCALE
- TZ=GMT0; export TZ
- (LC_ALL=C date) | $GAWKEXE -v OUTPUT=_${TESTCASE} -f ${SRCDIR}/strftime.awk
- ${COMPARE} strftime.ok _${TESTCASE} && rm -f _${TESTCASE} strftime.ok || exit 0
-}
-
-function inplace1() {
- cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
- cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
- AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
- ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
-}
-
-function inplace2() {
- cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
- cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
- AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
- ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
- ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
- ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
-}
-
-function inplace3() {
- cp ${SRCDIR}/inplace.1.in _${TESTCASE}.1
- cp ${SRCDIR}/inplace.2.in _${TESTCASE}.2
- AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "before"} {gsub(/foo/, "bar"); print} END {print "after"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- AWKPATH=${SRCDIR}/../awklib/eg/lib $GAWKEXE -i inplace -v INPLACE_SUFFIX=.bak 'BEGIN {print "Before"} {gsub(/bar/, "foo"); print} END {print "After"}' _${TESTCASE}.1 - _${TESTCASE}.2 < ${SRCDIR}/inplace.in >>_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.1.ok _${TESTCASE}.1 && rm -f _${TESTCASE}.1
- ${COMPARE} ${SRCDIR}/${TESTCASE}.1.bak.ok _${TESTCASE}.1.bak && rm -f _${TESTCASE}.1.bak
- ${COMPARE} ${SRCDIR}/${TESTCASE}.2.ok _${TESTCASE}.2 && rm -f _${TESTCASE}.2
- ${COMPARE} ${SRCDIR}/${TESTCASE}.2.bak.ok _${TESTCASE}.2.bak && rm -f _${TESTCASE}.2.bak
-}
-
-function testext() {
- $GAWKEXE ' /^(@load|BEGIN)/,/^}/' ${SRCDIR}/../extension/testext.c > testext.awk
- $GAWKEXE -f ${TESTCASE}.awk > ${SRCDIR}/_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> ${SRCDIR}/_${TESTCASE}
- rm -f testext.awk
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE}
-}
-
-function readdir() {
- if [ "`uname`" = Linux ] && [ "`stat -f . 2>/dev/null | awk 'NR == 2 { print $NF }'`" = nfs ]; then
- echo This test may fail on GNU/Linux systems when run on an NFS filesystem.;
- echo If it does, try rerunning on an ext'[234]' filesystem. ;
- fi
- $GAWKEXE -f ${TESTCASE}.awk ${SRCDIR}/.. > ${SRCDIR}/_${TESTCASE} 2>&1
- ls -afli ${TOPSRCDIR} | sed 1d | $GAWKEXE -f ${SRCDIR}/readdir0.awk -v extout=${SRCDIR}/_${TESTCASE} > ${SRCDIR}/${TESTCASE}.ok
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok ${SRCDIR}/_${TESTCASE} && rm -f ${SRCDIR}/_${TESTCASE} ${SRCDIR}/${TESTCASE}.ok
-}
-
-function ordchr2() {
- $GAWKEXE -l ordchr 'BEGIN {print chr(ord("z"))}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function include2() {
- AWKPATH=${SRCDIR} $GAWKEXE -i inclib 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -i inclib -i inclib.awk 'BEGIN {print sandwich("a", "b", "c")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe2() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -f inclib -f inclib.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe3() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe4() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe5() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -i hello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe6() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -i inchello -f hello.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function incdupe7() {
- AWKPATH=${SRCDIR} $GAWKEXE --lint -f hello -i inchello >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-# TODO: The compare operation passes even when there are diffs.
-function readfile() {
- $GAWKEXE -l readfile 'BEGIN {printf "%s", readfile("Makefile")}' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} Makefile _${TESTCASE} && rm -f _${TESTCASE} || cp -p Makefile ${TESTCASE}.ok
-}
-
-function fts() {
- if [ "`uname`" = IRIX ]; then \
- echo This test may fail on IRIX systems when run on an NFS filesystem.; \
- echo If it does, try rerunning on an xfs filesystem. ; \
- fi
- simple_test_case "" ""
-}
-
-function charasbytes() {
- [ -z "$GAWKLOCALE" ] && GAWKLOCALE=en_US.UTF-8; \
- AWKPATH=${SRCDIR} $GAWKEXE -b -v BINMODE=2 -f ${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in | \
- od -c -t x1 | sed -e 's/ */ /g' -e 's/ *$//' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function symtab6() {
- $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk
- grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' > _${TESTCASE} ; rm __${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function symtab8() {
- $GAWKEXE -d__${TESTCASE} -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
- grep -v '^ENVIRON' __${TESTCASE} | grep -v '^PROCINFO' | grep -v '^FILENAME' >> _${TESTCASE} ; rm __${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function colonwarn() {
- for i in 1 2 3 ; \
- do $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk $i < ${SRCDIR}/${TESTCASE}.in ; \
- done > _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function litoct() {
- echo ab | $GAWKEXE --traditional -f ${SRCDIR}/litoct.awk >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function devfd() {
- $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4<${SRCDIR}/devfd.in4 5<${SRCDIR}/devfd.in5 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >> _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function fflush() {
- ${SRCDIR}/fflush.sh >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function mmap8k() {
- $GAWKEXE '{ print }' ${SRCDIR}/mmap8k.in >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/mmap8k.in _${TESTCASE} && rm -f _${TESTCASE} || cp ${SRCDIR}/${TESTCASE}.in ${TESTCASE}.ok
-}
-
-function pid() {
- AWKPATH=${SRCDIR} AWK=$GAWKEXE ${SHELL} ${SRCDIR}/pid.sh $$ > _${TESTCASE} ; :
- ${COMPARE} ${SRCDIR}/pid.ok _`basename ${TESTCASE}` && rm -f _${TESTCASE}
-}
-
-function strftlng() {
- TZ=UTC; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE}
- if ${COMPARE} ${SRCDIR}/strftlng.ok _${TESTCASE} >/dev/null 2>&1 ; then : ; else \
- TZ=UTC0; export TZ; $GAWKEXE -f ${SRCDIR}/strftlng.awk >_${TESTCASE} ; \
- fi
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function nors() {
- echo A B C D E | tr -d '\12\15' | $GAWKEXE '{ print $NF }' - ${SRCDIR}/nors.in > _${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function fmtspcl() {
- $GAWKEXE -v "sd=${SRCDIR}" 'BEGIN {pnan = sprintf("%g",sqrt(-1)); nnan = sprintf("%g",-sqrt(-1)); pinf = sprintf("%g",-log(0)); ninf = sprintf("%g",log(0))} {sub(/positive_nan/,pnan); sub(/negative_nan/,nnan); sub(/positive_infinity/,pinf); sub(/negative_infinity/,ninf); sub(/fmtspcl/,(sd"/fmtspcl")); print}' < ${SRCDIR}/fmtspcl.tok > ${TESTCASE}.ok 2>/dev/null
- $GAWKEXE $AWKFLAGS -f ${SRCDIR}/fmtspcl.awk --lint >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- if test -z "$AWKFLAGS" ; then
- ${COMPARE} ${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
- else
- ${COMPARE} ${SRCDIR}/${TESTCASE}-mpfr.ok _${TESTCASE} && rm -f _${TESTCASE}
- fi
-}
-
-function pipeio2() { simple_test_case "-v SRCDIR=${SRCDIR}" "" ; }
-
-function arynocls() {
- AWKPATH=${SRCDIR} $GAWKEXE -v INPUT=${SRCDIR}/arynocls.in -f arynocls.awk >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function inetechu() {
- echo This test is for establishing UDP connections
- $GAWKEXE 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}'
-}
-
-function inetecht() {
- echo This test is for establishing TCP connections
- $GAWKEXE 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}'
-}
-
-function inetdayu() {
- echo This test is for bidirectional UDP transmission
- $GAWKEXE 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \
- "/inet/udp/0/127.0.0.1/13" |& getline; print $0}'
-}
-
-function inetdayt() {
- echo This test is for bidirectional TCP transmission
- $GAWKEXE 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \
- "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}'
-}
-
-function redfilnm() { simple_test_case "" "srcdir=${SRCDIR}" ; }
-
-function leaddig() { simple_test_case "-v x=2E" "" ; }
-function longwrds() { simple_test_case "-vSORT=sort" "" ; }
-
-function gsubtst3() {
- $GAWKEXE --re-interval -f ${SRCDIR}/${TESTCASE}.awk ${SRCDIR}/${TESTCASE}.in >_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function space() {
- $GAWKEXE -f ' ' ${SRCDIR}/space.awk >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rsnulbig() {
- # Suppose that block size for pipe is at most 128kB:
- $GAWKEXE 'BEGIN { for (i = 1; i <= 128*64+1; i++) print "abcdefgh123456\n" }' 2>&1 | \
- $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" }; { print }' 2>&1 | \
- $GAWKEXE '/^[^a]/; END{ print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rsnulbig2() {
- $GAWKEXE 'BEGIN { ORS = ""; n = "\n"; for (i = 1; i <= 10; i++) n = (n n); \
- for (i = 1; i <= 128; i++) print n; print "abc\n" }' 2>&1 | \
- $GAWKEXE 'BEGIN { RS = ""; ORS = "\n\n" };{ print }' 2>&1 | \
- $GAWKEXE '/^[^a]/; END { print NR }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function printf0() { simple_test_case "--posix" "" ; }
-
-function profile1() {
- $GAWKEXE --pretty-print=ap-${TESTCASE}.out -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out1
- $GAWKEXE -f ap-${TESTCASE}.out ${SRCDIR}/dtdgport.awk > _${TESTCASE}.out2 ; rm ap-${TESTCASE}.out
- ${COMPARE} _${TESTCASE}.out1 _${TESTCASE}.out2 && rm _${TESTCASE}.out[12] || { echo EXIT CODE: $$? >>_${TESTCASE} ; \
- cp $(srcdir)/dtdgport.awk > ${TESTCASE}.ok ; }
-}
-
-function profile2() {
- $GAWKEXE --profile=ap-${TESTCASE}.out -v sortcmd=sort -f ${SRCDIR}/xref.awk ${SRCDIR}/dtdgport.awk > /dev/null
- sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function profile3() {
- $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
- sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function profile4() {
- GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
- sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function profile5() {
- GAWK_NO_PP_RUN=1 $GAWKEXE --profile=ap-${TESTCASE}.out -f ${SRCDIR}/${TESTCASE}.awk > /dev/null
- sed 1,2d < ap-${TESTCASE}.out > _${TESTCASE}; rm ap-${TESTCASE}.out
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function posix2008sub() {
- $GAWKEXE --posix -f ${SRCDIR}/${TESTCASE}.awk > _${TESTCASE} 2>&1
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function next() {
- LC_ALL=${GAWKLOCALE:-C} LANG=${GAWKLOCALE:-C} AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1
- LC_ALL=C ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function exit() {
- AWK="$GAWKEXE" ${SRCDIR}/${TESTCASE}.sh > _${TESTCASE} 2>&1
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function mpfrexprange() { simple_test_case "-M -vPREC=53 " "" ; }
-function mpfrrnd() { simple_test_case "-M -vPREC=53 " "" ; }
-function mpfrnr() { simple_test_case "-M -vPREC=113" "" ; }
-function mpfrbigint() { simple_test_case "-M " "" ; }
-
-function jarebug() {
- ${SRCDIR}/${TESTCASE}.sh "$GAWKEXE" "${SRCDIR}/${TESTCASE}.awk" "${SRCDIR}/${TESTCASE}.in" "_${TESTCASE}"
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rtlen() {
- ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rtlen01() {
- ${SRCDIR}/${TESTCASE}.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function rtlenmb() {
- GAWKLOCALE=en_US.UTF-8 ; export GAWKLOCALE
- ${SRCDIR}/rtlen.sh >_${TESTCASE} || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function nondec2() { simple_test_case "--non-decimal-data -v a=0x1" "" ; }
-
-function nofile() {
- $GAWKEXE '{}' no/such/file >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function binmode1() {
- $GAWKEXE -v BINMODE=3 'BEGIN { print BINMODE }' >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function devfd1() {
- $GAWKEXE -f ${SRCDIR}/${TESTCASE}.awk 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-function devfd2() {
- # The program text is the '1' which will print each record. How compact can you get?
- $GAWKEXE 1 /dev/fd/4 /dev/fd/5 4< ${SRCDIR}/devfd.in1 5< ${SRCDIR}/devfd.in2 >_${TESTCASE} 2>&1 || echo EXIT CODE: $? >>_${TESTCASE}
- ${COMPARE} ${SRCDIR}/${TESTCASE}.ok _${TESTCASE} && rm -f _${TESTCASE}
-}
-
-# Is this test case implemented as a function ?
-if [ "$( type -t $TESTCASE )" = "function" ]
-then
- $TESTCASE
-else
- # If no function exists, then treat the test case in standard way.
- simple_test_case "" ""
-fi
-
diff --git a/cmake/configure b/cmake/configure
deleted file mode 100755
index d375a81c..00000000
--- a/cmake/configure
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-# On 2013-05-14 Arnold wrote in an e-mail:
-
-# <QUOTE)
-# I think that using CMake would be more palatable if there is also a simple
-# configure wrapper that can be used by people who build distributions. This would
-# mean things like
-#
-# configure CC=XXXX # XXXX in { gcc, clang, tcc } or native platform cc
-# configure --prefix=/path/to/install
-#
-# And the few other current configure options like --with-whiny-user-strftime,
-# --disable-nls, etc. I don't know if we need all the standard configure options,
-# but I do want the ones I've added in configure.ac.
-# </QUOTE)
-
-
-# Anyone using this script still needs an out-of-source build directory.
-if [ -f CMakeLists.txt ] ; then
- echo "Your current working directory contains a file CMakeLists.txt, indicating"
- echo "that this is a source directory. Create a new directory elsewhere, change into"
- echo "this empty directory and try again."
- echo " mkdir build"
- echo " cd build"
- echo " ../$0"
- exit 1
-fi
-
-# TODO: Evaluate all the options and translate the options into CMake variables.
-CC=$( which cc )
-PREFIX=""
-SRCDIR=".."
-WHINY=""
-
-for p in $@
-do
- if [ ${p:0:3} = "CC=" ]; then CC=${p:3}; fi
- if [ ${p:0:9} = "--prefix=" ]; then PREFIX=-DCMAKE_INSTALL_PREFIX=${p:9}; fi
- if [ ${p:0:9} = "--srcdir=" ]; then SRCDIR=${p:9}; fi
- if [ ${p:0:26} = "--with-whiny-user-strftime" ]; then WHINY=-DUSE_INCLUDED_STRFTIME=1; fi
-done
-CC=$( which $CC )
-
-rm -f Toolchain.cmake
-(
- echo "set(CMAKE_C_COMPILER $CC)"
- echo "set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)"
- echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)"
- echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)"
-) > Toolchain.cmake
-
-if ! [ -f ${SRCDIR}/CMakeLists.txt ] ; then
- echo "The source directory (${SRCDIR}) does not contain a file CMakeLists.txt."
- exit 1
-fi
-
-cmake ${PREFIX} ${WHINY} -DCMAKE_TOOLCHAIN_FILE=Toolchain.cmake ${SRCDIR}
-
diff --git a/cmake/configure.cmake b/cmake/configure.cmake
deleted file mode 100644
index 6e18c7c9..00000000
--- a/cmake/configure.cmake
+++ /dev/null
@@ -1,309 +0,0 @@
-#
-# cmake/configure --- CMake input file for gawk
-#
-# Copyright (C) 2013-2014
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-option (USE_CONFIG_H "Generate a file config.h for inclusion into C source code" ON)
-if (USE_CONFIG_H)
- file( WRITE config.h "/* all settings defined by CMake. */\n\n" )
- ADD_DEFINITIONS (-D HAVE_CONFIG_H)
- # Configure a header file to pass some of the CMake settings
- # to the source code
- # http://www.cmake.org/cmake/help/v2.8.8/cmake.html#command:configure_file
- # CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h IMMEDIATE )
-else()
- file( WRITE config.h "/* empty file, all settings defined by CMake. */" )
-endif()
-
-include(CheckIncludeFiles)
-include(CheckIncludeFile)
-include(CheckSymbolExists)
-include(CheckFunctionExists)
-include(CheckLibraryExists)
-include(CheckTypeSize)
-include(CheckStructHasMember)
-INCLUDE(CheckCSourceCompiles)
-include(CheckPrototypeDefinition)
-
-MACRO(DefineConfigH feature)
-# message(STATUS feature=${feature}=${${feature}})
- if (${feature})
- if (${USE_CONFIG_H} STREQUAL ON)
- FILE( APPEND config.h "#define ${feature} ${${feature}}\n")
- else()
- #ADD_DEFINITIONS (-D ${feature})
- ADD_DEFINITIONS (-D${feature}=${${feature}})
- endif ()
- endif ()
-ENDMACRO(DefineConfigH)
-
-MACRO(DefineConfigHValue feature value)
- set(${feature} ${value})
- DefineConfigH(${feature})
-ENDMACRO(DefineConfigHValue)
-
-MACRO(DefineFunctionIfAvailable func feature)
- check_function_exists("${func}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineFunctionIfAvailable)
-
-MACRO(DefineHFileIfAvailable hfile feature)
- check_include_file("${hfile}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineHFileIfAvailable)
-
-MACRO(DefineTypeIfAvailable type feature)
- check_type_size("${type}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineTypeIfAvailable)
-
-MACRO(DefineSymbolIfAvailable symbol hfile feature)
- check_symbol_exists("${symbol}" "${hfile}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineSymbolIfAvailable)
-
-MACRO(DefineStructHasMemberIfAvailable struct member hfile feature)
- check_struct_has_member("${struct}" "${member}" "${hfile}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineStructHasMemberIfAvailable)
-
-MACRO(DefineLibraryIfAvailable lib func location feature)
- check_library_exists("${lib}" "${func}" "${location}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineLibraryIfAvailable)
-
-MACRO(DefineIfSourceCompiles source feature)
- check_c_source_compiles( "${source}" "${feature}")
- DefineConfigH(${feature})
-ENDMACRO(DefineIfSourceCompiles)
-
-FILE( READ ${CMAKE_SOURCE_DIR}/configure.ac CONFIG_AUTOMAKE )
-STRING( REGEX MATCH "AC_INIT\\(\\[GNU Awk\\], ([0-9]+\\.[0-9]+\\.[0-9]+)" GAWK_AUTOMAKE_LINE_VERSION "${CONFIG_AUTOMAKE}")
-STRING( REGEX REPLACE ".*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" GAWK_MAJOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
-STRING( REGEX REPLACE ".*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" GAWK_MINOR_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
-STRING( REGEX REPLACE ".*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" GAWK_BUGFIX_VERSION "${GAWK_AUTOMAKE_LINE_VERSION}")
-
-# The definition of the symbol GAWK cannot be passed in config.h
-# because the extensions will fail to build.
-add_definitions(-DGAWK)
-add_definitions(-DSTDC_HEADERS)
-# Tell the C compiler to accept C99.
-if (CMAKE_VERSION VERSION_LESS "3.1")
- if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
- set (CMAKE_C_FLAGS "--std=gnu99 ${CMAKE_C_FLAGS}")
- endif ()
-else ()
- set (CMAKE_C_STANDARD 99)
-endif ()
-DefineConfigHValue(_GL_ATTRIBUTE_PURE "__attribute__ ((__pure__))")
-DefineConfigHValue(GAWK_VERSION "${GAWK_MAJOR_VERSION}.${GAWK_MINOR_VERSION}.${GAWK_BUGFIX_VERSION}")
-DefineConfigHValue(VERSION \\"${GAWK_VERSION}\\")
-DefineConfigHValue(PACKAGE \\"gawk\\")
-DefineConfigHValue(PACKAGE_STRING \\"GNU Awk ${GAWK_VERSION}\\")
-DefineConfigHValue(PACKAGE_TARNAME \\"gawk\\")
-DefineConfigHValue(PACKAGE_URL \\"http://www.gnu.org/software/gawk/\\")
-DefineConfigHValue(PACKAGE_VERSION \\"${GAWK_VERSION}\\")
-DefineConfigHValue(DEFPATH \\"${CMAKE_BINARY_DIR}/awk\\")
-DefineConfigHValue(DEFLIBPATH \\"${CMAKE_BINARY_DIR}/lib\\")
-if (CMAKE_DL_LIBS)
- message(STATUS "Found CMAKE_DL_LIBS:${CMAKE_DL_LIBS}")
-else()
- message(STATUS "Found no CMAKE_DL_LIBS")
-endif()
-if (CMAKE_SHARED_LIBRARY_SUFFIX)
- DefineConfigHValue(DYNAMIC 1)
- STRING( REGEX REPLACE "^(\\.)([a-zA-Z0-9])" "\\2" SHLIBEXT "${CMAKE_SHARED_LIBRARY_SUFFIX}")
- DefineConfigHValue(SHLIBEXT \\"${SHLIBEXT}\\")
- message(STATUS "Found SHLIBEXT: ${SHLIBEXT}")
-else()
- message(STATUS "Found no SHLIBEXT")
-endif()
-DefineTypeIfAvailable("unsigned int" SIZEOF_UNSIGNED_INT)
-DefineTypeIfAvailable("unsigned long" SIZEOF_UNSIGNED_LONG)
-#/* Define to 1 if *printf supports %F format */
-add_definitions(-D PRINTF_HAS_F_FORMAT)
-#/* Define as the return type of signal handlers (`int' or `void'). */
-add_definitions(-D RETSIGTYPE=void)
-#add_definitions(-D PIPES_SIMULATED)
-check_prototype_definition(getpgrp "pid_t getpgrp(void)" "NULL" "unistd.h" GETPGRP_VOID)
-DefineConfigH(GETPGRP_VOID)
-#add_definitions(-D YYPARSE_PARAM)
-
-DefineFunctionIfAvailable(snprintf HAVE_SNPRINTF)
-DefineFunctionIfAvailable(vprintf HAVE_VPRINTF)
-DefineHFileIfAvailable(sys/types.h HAVE_SYS_TYPES_H)
-DefineHFileIfAvailable(sys/stat.h HAVE_SYS_STAT_H)
-DefineHFileIfAvailable(string.h HAVE_STRING_H)
-DefineHFileIfAvailable(memory.h HAVE_MEMORY_H)
-DefineHFileIfAvailable(strings.h HAVE_STRINGS_H)
-DefineHFileIfAvailable(stdint.h HAVE_STDINT_H)
-DefineHFileIfAvailable(inttypes.h HAVE_INTTYPES_H)
-DefineHFileIfAvailable(stdlib.h HAVE_STDLIB_H)
-DefineHFileIfAvailable(unistd.h HAVE_UNISTD_H)
-FIND_PATH(INTL_INCLUDE_DIR libintl.h PATHS /usr/include /usr/local/include)
-FIND_LIBRARY(INTL_LIBRARIES intl c PATHS /usr/lib/ /usr/local/lib)
-DefineSymbolIfAvailable("CODESET" "langinfo.h" HAVE_LANGINFO_CODESET)
-DefineSymbolIfAvailable("LC_MESSAGES" "locale.h" HAVE_LC_MESSAGES)
-DefineTypeIfAvailable("_Bool" HAVE__BOOL)
-if (${HAVE_GETTEXT} AND ${HAVE_DCGETTEXT} AND ${HAVE_LANGINFO_CODESET} AND ${HAVE_LC_MESSAGES})
- add_definitions(-D LOCALEDIR=\\"/usr/share/locale\\")
- add_definitions(-D ENABLE_NLS)
- ADD_SUBDIRECTORY( ${CMAKE_SOURCE_DIR}/po )
-endif()
-DefineHFileIfAvailable(stdbool.h HAVE_STDBOOL_H)
-DefineHFileIfAvailable(sys/wait.h HAVE_SYS_WAIT_H)
-DefineHFileIfAvailable(arpa/inet.h HAVE_ARPA_INET_H)
-DefineHFileIfAvailable(fcntl.h HAVE_FCNTL_H)
-DefineHFileIfAvailable(limits.h HAVE_LIMITS_H)
-DefineHFileIfAvailable(locale.h HAVE_LOCALE_H)
-DefineHFileIfAvailable(libintl.h HAVE_LIBINTL_H)
-DefineHFileIfAvailable(mcheck.h HAVE_MCHECK_H)
-DefineHFileIfAvailable(netdb.h HAVE_NETDB_H)
-DefineHFileIfAvailable(netinet/in.h HAVE_NETINET_IN_H)
-DefineHFileIfAvailable(stdarg.h HAVE_STDARG_H)
-DefineHFileIfAvailable(stddef.h HAVE_STDDEF_H)
-DefineHFileIfAvailable(sys/ioctl.h HAVE_SYS_IOCTL_H)
-DefineHFileIfAvailable(sys/param.h HAVE_SYS_PARAM_H)
-DefineHFileIfAvailable(sys/socket.h HAVE_SYS_SOCKET_H)
-DefineHFileIfAvailable(sys/termios.h HAVE_TERMIOS_H)
-DefineHFileIfAvailable(stropts.h HAVE_STROPTS_H)
-DefineHFileIfAvailable(wchar.h HAVE_WCHAR_H)
-DefineHFileIfAvailable(wctype.h HAVE_WCTYPE_H)
-DefineTypeIfAvailable("long long int" HAVE_LONG_LONG_INT)
-DefineTypeIfAvailable("unsigned long long int" HAVE_UNSIGNED_LONG_LONG_INT)
-DefineTypeIfAvailable(intmax_t INTMAX_T)
-DefineTypeIfAvailable(uintmax_t UINTMAX_T)
-DefineTypeIfAvailable("time_t" TIME_T_IN_SYS_TYPES_H)
-SET(CMAKE_EXTRA_INCLUDE_FILES wctype.h)
-DefineTypeIfAvailable("wctype_t" HAVE_WCTYPE_T)
-DefineTypeIfAvailable("wint_t" HAVE_WINT_T)
-SET(CMAKE_EXTRA_INCLUDE_FILES)
-
-DefineStructHasMemberIfAvailable("struct sockaddr_storage" ss_family sys/socket.h HAVE_SOCKADDR_STORAGE)
-DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_STRUCT_STAT_ST_BLKSIZE)
-DefineStructHasMemberIfAvailable("struct stat" st_blksize sys/stat.h HAVE_ST_BLKSIZE)
-DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_TM_ZONE)
-DefineStructHasMemberIfAvailable("struct tm" tm_zone time.h HAVE_STRUCT_TM_TM_ZONE)
-
-DefineHFileIfAvailable(sys/time.h HAVE_SYS_TIME_H)
-DefineFunctionIfAvailable(alarm HAVE_ALARM)
-DefineFunctionIfAvailable(tzname HAVE_DECL_TZNAME)
-DefineFunctionIfAvailable(mktime HAVE_MKTIME)
-DefineFunctionIfAvailable(getaddrinfo HAVE_GETADDRINFO)
-DefineFunctionIfAvailable(atexit HAVE_ATEXIT)
-DefineFunctionIfAvailable(btowc HAVE_BTOWC)
-DefineFunctionIfAvailable(fmod HAVE_FMOD)
-DefineFunctionIfAvailable(isinf HAVE_ISINF)
-DefineFunctionIfAvailable(ismod HAVE_ISMOD)
-DefineFunctionIfAvailable(getgrent HAVE_GETGRENT)
-DefineSymbolIfAvailable("getgroups" "unistd.h" HAVE_GETGROUPS)
-if (${HAVE_GETGROUPS})
- check_prototype_definition(getgroups "int getgroups(int size, gid_t list[])" "NULL" "unistd.h" GETGROUPS_T)
- if (${GETGROUPS_T})
- DefineConfigHValue(GETGROUPS_T gid_t)
- else()
- DefineConfigHValue(GETGROUPS_T int)
- endif()
-endif()
-
-DefineTypeIfAvailable("pid_t" PID_T)
-DefineTypeIfAvailable("intmax_t" HAVE_INTMAX_T)
-DefineFunctionIfAvailable(grantpt HAVE_GRANTPT)
-DefineFunctionIfAvailable(isascii HAVE_ISASCII)
-DefineFunctionIfAvailable(iswctype HAVE_ISWCTYPE)
-DefineFunctionIfAvailable(iswlower HAVE_ISWLOWER)
-DefineFunctionIfAvailable(iswupper HAVE_ISWUPPER)
-DefineFunctionIfAvailable(mbrlen HAVE_MBRLEN)
-DefineFunctionIfAvailable(memcmp HAVE_MEMCMP)
-DefineFunctionIfAvailable(memcpy HAVE_MEMCPY)
-DefineFunctionIfAvailable(memmove HAVE_MEMMOVE)
-DefineFunctionIfAvailable(memset HAVE_MEMSET)
-DefineFunctionIfAvailable(mkstemp HAVE_MKSTEMP)
-DefineFunctionIfAvailable(posix_openpt HAVE_POSIX_OPENPT)
-DefineFunctionIfAvailable(setenv HAVE_SETENV)
-DefineFunctionIfAvailable(setlocale HAVE_SETLOCALE)
-DefineFunctionIfAvailable(setsid HAVE_SETSID)
-DefineFunctionIfAvailable(strchr HAVE_STRCHR)
-DefineFunctionIfAvailable(strerror HAVE_STRERROR)
-DefineFunctionIfAvailable(strftime HAVE_STRFTIME)
-DefineFunctionIfAvailable(strncasecmp HAVE_STRNCASECMP)
-DefineFunctionIfAvailable(strcoll HAVE_STRCOLL)
-DefineFunctionIfAvailable(strtod HAVE_STRTOD)
-DefineFunctionIfAvailable(strtoul HAVE_STRTOUL)
-DefineFunctionIfAvailable(system HAVE_SYSTEM)
-DefineFunctionIfAvailable(tmpfile HAVE_TMPFILE)
-DefineFunctionIfAvailable(towlower HAVE_TOWLOWER)
-DefineFunctionIfAvailable(towupper HAVE_TOWUPPER)
-DefineFunctionIfAvailable(tzset HAVE_TZSET)
-DefineFunctionIfAvailable(usleep HAVE_USLEEP)
-DefineFunctionIfAvailable(wcrtomb HAVE_WCRTOMB)
-DefineFunctionIfAvailable(wcscoll HAVE_WCSCOLL)
-DefineFunctionIfAvailable(wctype HAVE_WCTYPE)
-DefineFunctionIfAvailable(mbrtowc HAVE_MBRTOWC)
-
-add_definitions(-D HAVE_STRINGIZE)
-add_definitions(-D _Noreturn=)
-
-find_package(BISON QUIET)
-# If there is a bison installed on this platform,
-if (${BISON_FOUND} STREQUAL "TRUE")
- # then let bison generate awkgram.c.
- BISON_TARGET(awkgram awkgram.y ${CMAKE_SOURCE_DIR}/awkgram.c)
-else()
- # otherwise use the existing awkgram.c.
- set(BISON_awkgram_OUTPUTS ${CMAKE_SOURCE_DIR}/awkgram.c)
-endif()
-
-find_package(Gettext REQUIRED)
-if (GETTEXT_FOUND STREQUAL "TRUE")
- include_directories(${GETTEXT_INCLUDE_DIR})
- DefineFunctionIfAvailable(gettext HAVE_GETTEXT)
- DefineFunctionIfAvailable(dcgettext HAVE_DCGETTEXT)
-else ()
- message( FATAL_ERROR "Gettext not found" )
-endif()
-
-find_package(LATEX)
-include(GNUInstallDirs)
-include(GetPrerequisites)
-
-# For some unknown reason the defines for the extensions
-# are written into config.h only if they are implemented
-# here and not in extension/CMakeLists.txt.
-DefineLibraryIfAvailable(m sin "" HAVE_LIBM)
-DefineLibraryIfAvailable(mpfr mpfr_add_si "" HAVE_MPFR)
-DefineLibraryIfAvailable(c socket "" HAVE_SOCKETS)
-DefineLibraryIfAvailable(readline readline "" HAVE_LIBREADLINE)
-DefineFunctionIfAvailable(fnmatch HAVE_FNMATCH)
-DefineHFileIfAvailable(fnmatch.h HAVE_FNMATCH_H)
-DefineHFileIfAvailable(dirent.h HAVE_DIRENT_H)
-DefineFunctionIfAvailable(dirfd HAVE_DIRFD)
-DefineFunctionIfAvailable(getdtablesize HAVE_GETDTABLESIZE)
-DefineFunctionIfAvailable(select HAVE_SELECT)
-DefineFunctionIfAvailable(gettimeofday HAVE_GETTIMEOFDAY)
-DefineHFileIfAvailable(sys/select.h HAVE_SYS_SELECT_H)
-DefineFunctionIfAvailable(nanosleep HAVE_NANOSLEEP)
-DefineHFileIfAvailable(time.h HAVE_TIME_H)
-DefineFunctionIfAvailable(GetSystemTimeAsFileTime HAVE_GETSYSTEMTIMEASFILETIME)
-
diff --git a/cmake/docmaker b/cmake/docmaker
deleted file mode 100755
index 4af7cee1..00000000
--- a/cmake/docmaker
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-# The first parameter is the target, the file to be built.
-# All remaining parameters are dependencies (file names).
-if [ $# -lt 1 ] ; then
- echo " $0: Incorrect number ($#) of parameters passed: $*"
- exit 1
-fi
-OUTFILE=$1
-shift 1
-INFILES="$@"
-
-MAKEINFO="makeinfo --no-split --force"
-TROFF="groff -t -Tps -U"
-SEDME="sed -e \"s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/\" -e \"s/^\/level0 save def/\/level0 save def 30 -48 translate/\""
-SEDME2="sed '/%%Page: 10 10/,/0 Cg EP/d'"
-
-function BuildTarget()
-{
- local OUTFILE=$1
- local INFILE=""
- local COMMAND=""
-
- FILEBASE=${OUTFILE%.*}
- case $OUTFILE in
- *\.in | *\.1 | macros | cardfonts | colors | ad.block | setter.outline | \
- gawkinet.texi | rflashlight.eps | api-figure1.fig | api-figure2.fig | api-figure3.fig | \
- general-program.fig | process-flow.fig | statist.eps)
- INFILE=$OUTFILE
- ;;
- *\.texi)
- if [ $FILEBASE = gawk ] ; then
- INFILE=gawktexi.in
- else
- INFILE=$OUTFILE.in
- fi
- COMMAND="awk -f sidebar.awk < $INFILE > $OUTFILE"
- ;;
- *\.dvi)
- INFILE=$FILEBASE.texi
- COMMAND="texi2dvi -q --clean $INFILE"
- ;;
- *\.info)
- INFILE=$FILEBASE.texi
- COMMAND="${MAKEINFO} $INFILE"
- ;;
- *\.ps)
- if [ $FILEBASE = awkcard ] ; then
- INFILE=awkcard.in
- COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > awkcard.ps"
- elif [ $FILEBASE = gawk.1 -o $FILEBASE = igawk.1 ] ; then
- INFILE=$FILEBASE
- COMMAND="groff -z -man $INFILE > $OUTFILE"
- else
- INFILE=$FILEBASE.dvi
- COMMAND="dvips -q -o $OUTFILE $INFILE"
- fi
- ;;
- *\.pdf)
- INFILE=$FILEBASE.ps
- COMMAND="ps2pdf -q $INFILE $OUTFILE"
- ;;
- *\.tr)
- INFILE=$FILEBASE.in
- COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE"
- ;;
- *\.nc)
- INFILE=$FILEBASE.in
- COMMAND="sed 's:SRCDIR:.:' < $INFILE > $OUTFILE"
- COMMAND="${TROFF} $* | ${SEDME} | cat setter.outline - | ${SEDME2} > $FILEBASE.ps && touch $OUTFILE"
- ;;
- *)
- echo " unknwon target $OUTFILE"
- exit 1
- esac
-
- if [ ! -r "$INFILE" ] ; then
- echo " $0: Cannot read input file $INFILE"
- exit 1
- fi
-
- if [ -f "$OUTFILE" ] ; then
- if [ "$INFILE" -ot "$OUTFILE" ] ; then
- #printf " Target %15s is up-to-date\n" $OUTFILE
- COMMAND=""
- fi
- fi
- #echo " Generating $OUTFILE from $INFILE"
- echo $COMMAND | sh -x
- #echo "COMMAND=$COMMAND"
-}
-
-# Build all dependencies first, then build the target.
-for dep in $INFILES
-do
- #echo $OUTFILE depends on $dep
- BuildTarget $dep
-done
-BuildTarget $OUTFILE
-
diff --git a/cmake/package.cmake b/cmake/package.cmake
deleted file mode 100644
index f1127797..00000000
--- a/cmake/package.cmake
+++ /dev/null
@@ -1,71 +0,0 @@
-#
-# cmake/package --- CMake input file for gawk
-#
-# Copyright (C) 2013-2014
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "This is GNU Awk ${GAWK_VERSION}")
-set(CPACK_PACKAGE_VENDOR "GNU Project - Free Software Foundation (FSF)")
-SET(CPACK_PACKAGE_NAME "gawk")
-SET(CPACK_PACKAGE_VERSION "${GAWK_VERSION}")
-SET(CPACK_PACKAGE_VERSION_MAJOR "${GAWK_MAJOR_VERSION}")
-SET(CPACK_PACKAGE_VERSION_MINOR "${GAWK_MINOR_VERSION}")
-SET(CPACK_PACKAGE_VERSION_PATCH "${GAWK_BUGFIX_VERSION}")
-SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
-SET(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README")
-set(CPACK_PACKAGE_CONTACT "bug-gawk@gnu.org")
-
-IF (WIN32)
- SET(CPACK_GENERATOR "NSIS")
- set(CPACK_NSIS_INSTALL_ROOT "C:")
- set(CPACK_NSIS_MENU_LINKS "http://www.gnu.org/software/gawk" "GNU Awk")
- set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico")
- set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/cmake/auk.ico")
- set(CPACK_NSIS_MODIFY_PATH true)
- set(CPACK_NSIS_CONTACT "bug-gawk@gnu.org")
- set(CPACK_NSIS_DISPLAY_NAME "GNU Awk")
- include(CPack)
-ELSE()
- set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CMAKE_SYSTEM_PROCESSOR}")
- set(CPACK_PACKAGING_INSTALL_PREFIX /usr)
- if (CPACK_GENERATOR STREQUAL "TGZ")
- include(CPack)
- elseif (CPACK_GENERATOR STREQUAL "RPM")
- include(CPack)
- elseif (CPACK_GENERATOR STREQUAL "DEB")
- set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_VENDOR} <${CPACK_PACKAGE_CONTACT}>")
- set(CPACK_DEBIAN_PACKAGE_SECTION "interpreters")
- set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
- set(CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR})
- set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://www.gnu.org/software/gawk")
- set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
- set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libgcc1 (>= 1:3.4.2-12)")
- include(CPack)
- else()
- # No package format selected. Don't create the "package" target.
- endif()
- if (CPACK_GENERATOR)
- message(STATUS "CPACK_GENERATOR set to ${CPACK_GENERATOR}")
- endif()
-ENDIF()
-
diff --git a/configure b/configure
index 26955393..521fa6a4 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for GNU Awk 5.1.1f.
+# Generated by GNU Autoconf 2.71 for GNU Awk 5.1.60.
#
# Report bugs to <bug-gawk@gnu.org>.
#
@@ -611,8 +611,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='GNU Awk'
PACKAGE_TARNAME='gawk'
-PACKAGE_VERSION='5.1.1f'
-PACKAGE_STRING='GNU Awk 5.1.1f'
+PACKAGE_VERSION='5.1.60'
+PACKAGE_STRING='GNU Awk 5.1.60'
PACKAGE_BUGREPORT='bug-gawk@gnu.org'
PACKAGE_URL='https://www.gnu.org/software/gawk/'
@@ -1371,7 +1371,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures GNU Awk 5.1.1f to adapt to many kinds of systems.
+\`configure' configures GNU Awk 5.1.60 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1442,7 +1442,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU Awk 5.1.1f:";;
+ short | recursive ) echo "Configuration of GNU Awk 5.1.60:";;
esac
cat <<\_ACEOF
@@ -1565,7 +1565,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNU Awk configure 5.1.1f
+GNU Awk configure 5.1.60
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2222,7 +2222,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by GNU Awk $as_me 5.1.1f, which was
+It was created by GNU Awk $as_me 5.1.60, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
@@ -3516,7 +3516,7 @@ fi
# Define the identity of the package.
PACKAGE='gawk'
- VERSION='5.1.1f'
+ VERSION='5.1.60'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -14224,7 +14224,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by GNU Awk $as_me 5.1.1f, which was
+This file was extended by GNU Awk $as_me 5.1.60, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -14294,7 +14294,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
-GNU Awk config.status 5.1.1f
+GNU Awk config.status 5.1.60
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index cd58b08a..82f0d98a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT([GNU Awk],[5.1.1f],[bug-gawk@gnu.org],[gawk])
+AC_INIT([GNU Awk],[5.1.60],[bug-gawk@gnu.org],[gawk])
# This is a hack. Different versions of install on different systems
# are just too different. Chuck it and use install-sh.
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
deleted file mode 100644
index e12f5de0..00000000
--- a/doc/CMakeLists.txt
+++ /dev/null
@@ -1,95 +0,0 @@
-#
-# doc/CMakeLists.txt --- CMake input file for gawk
-#
-# Copyright (C) 2013
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-MACRO(DocDependency outfile)
- add_dependencies(doc ${outfile})
- add_custom_target(
- ${outfile}
- DEPENDS ${ARGN}
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- COMMAND ${CMAKE_SOURCE_DIR}/cmake/docmaker ${outfile} ${ARGN}
- )
-ENDMACRO(DocDependency)
-
-find_program(TEXI2DVI_CONVERTER texi2dvi)
-if (TEXI2DVI_CONVERTER)
- add_custom_target(doc)
- DocDependency(gawk.texi gawktexi.in rflashlight.eps api-figure1.fig api-figure2.fig api-figure3.fig general-program.fig process-flow.fig)
- DocDependency(rflashlight.eps)
- DocDependency(api-figure1.fig)
- DocDependency(api-figure2.fig)
- DocDependency(api-figure3.fig)
- DocDependency(general-program.fig)
- DocDependency(process-flow.fig)
- DocDependency(gawk.dvi gawk.texi)
- DocDependency(gawk.info gawk.texi)
- DocDependency(gawkinet.dvi gawkinet.texi)
- DocDependency(gawkinet.info gawkinet.texi)
- DocDependency(gawkinet.texi statist.eps)
- DocDependency(gawk.1.ps gawk.1)
- DocDependency(igawk.1.ps igawk.1)
- find_program(DVIPS_CONVERTER dvips)
- if (DVIPS_CONVERTER)
- DocDependency(gawk.ps gawk.dvi)
- DocDependency(gawkinet.ps gawkinet.dvi)
- find_program(PS2PDF_CONVERTER ps2pdf)
- if (PS2PDF_CONVERTER)
- DocDependency(gawk.1.pdf gawk.1.ps)
- DocDependency(igawk.1.pdf igawk.1.ps)
- DocDependency(gawk.pdf gawk.ps)
- DocDependency(gawkinet.pdf gawkinet.ps)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.1.pdf DESTINATION doc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/igawk.1.pdf DESTINATION doc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.info DESTINATION doc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawk.pdf DESTINATION doc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.info DESTINATION doc)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gawkinet.pdf DESTINATION doc)
-
- set(CARDSRC macros cardfonts colors awkcard.tr)
- set(CARDSRC_N macros cardfonts no.colors awkcard.tr)
- set(CARDFILES ${CARDSRC} ad.block awkcard.in setter.outline)
- DocDependency(awkcard.tr awkcard.in)
- DocDependency(awkcard.nc ${CARDFILES})
- DocDependency(awkcard.ps ${CARDFILES})
- DocDependency(awkcard.pdf awkcard.ps)
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/awkcard.pdf DESTINATION doc)
-
- else()
- message(WARNING "Found no ps2pdf tool; no doc will be generated")
- install(CODE "MESSAGE(\"doc generated only in .ps files\")")
- endif()
- else()
- message(WARNING "Found no dvips tool; no doc will be generated")
- install(CODE "MESSAGE(\"doc generated only in .dvi files and man pages in .ps files\")")
- endif()
-else()
- message(WARNING "Found no texi2dvi tool; no doc will be generated")
- add_custom_command(
- TARGET doc
- COMMAND echo no doc generated because of missing texi2dvi
- )
-endif()
-
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 7a1f8c61..939f43f9 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -112,12 +112,49 @@
2021-05-30 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Feature History): Fix a typo and clarify wording.
- Thanks to Antonio Columbo for the report.
+ Additionally, fix some other small mistakes.
+ * gawk.1: Also, fix a small typo.
+
+ Thanks to Antonio Columbo for the reports.
2021-05-27 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Feature History): Add features from 5.1.1.
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * CMakeLists.txt: Removed.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Typo fix.
+
+2021-05-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in, gawk.1, awkcard.in: Renamed bool to mkbool.
+
+2021-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Revise doc for bools; they're now just numbers
+ with an extra flag.
+ * gawk.1: Ditto.
+ * awkcard.in: Ditto.
+
+2021-04-14 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Controlling Scanning): Document bools for
+ "@val_type_asc".
+ * awkcard.in: Add doc on bool() function.
+
+2021-04-06 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Finish documenting bool features.
+ * gawk.1: Add minimal documentation on bool.
+
+2021-04-04 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Start documenting bool features.
+
2021-04-04 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Update menues.
@@ -129,10 +166,26 @@
<arkadiusz@drabczyk.org> for pointing out the lack of
documentation.
+2021-03-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Constructor Functions): Add doc on `make_bool'.
+
+2021-03-21 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Other Environment Variables): Document "fnv1a"
+ possible value for AWK_HASH environment variable.
+
2021-03-18 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
+2021-02-01 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): Fix a typo in the awk test
+ program. Make the C and Awk versions print "True" and
+ "False" to match Python, making comparisons easier. Thanks to
+ Antonio Columbo for the suggestions.
+
2021-01-25 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Fix some spelling errors.
@@ -203,12 +256,39 @@
* gawkworkflow.texi: Add an additional web resource.
* gawktexi.in: More edits in sample programs chapter.
+2020-11-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): Correct the description of what
+ happens with infinity. Thanks to Antonio Columbo for pointing
+ out the problem.
+
2020-11-16 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Nextfile Statement): Clarify what happens in
a BEGINFILE rule.
* gawktexi.in: Additional small fixes.
+2020-11-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): Add test programs inside
+ @ignore; extracted to example directory.
+
+2020-11-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Samll improvement in strange numbers section.
+
+2020-11-04 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): New section on NaN and infinity.
+ Update some other bits to point to it.
+ * wordlist: Updated with more words.
+
+2020-11-16 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Nextfile Statement): Clarify what happens in
+ a BEGINFILE rule.
+>>>>>>> master
+
2020-10-31 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
diff --git a/doc/awkcard.in b/doc/awkcard.in
index cbc6761d..f83cec63 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -2,7 +2,7 @@
.\"
.\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
.\" 2005, 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
-.\" 2019, 2020
+.\" 2019, 2020, 2021
.\" Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
@@ -100,7 +100,7 @@ Variables 5\*(CX
\*(CD
.SL
.nf
-\*(FRCopyright \(co 1996\(en2005, 2007, 2009\(en2020
+\*(FRCopyright \(co 1996\(en2005, 2007, 2009\(en2021
Free Software Foundation, Inc.
.nf
.BT
@@ -1916,6 +1916,19 @@ See the manual for details.\*(CB
.EB "\s+2\f(HBDYNAMIC EXTENSIONS (\*(GK\f(HB)\*(FR\s0"
.BT
+.\" --- Generator Functions
+.ES
+.fi
+.in +.2i
+.ti -.2i
+\*(CD\*(FCmkbool(\*(FIexpression\*(FC)\*(FR
+.br
+Return a Boolean-typed value based on the Boolean value
+of \*(FIexpression\fP. True values have a numeric value of one.
+False values have a numeric value of zero.\*(CB
+.in -.2i
+.EB "\s+2\f(HBGENERATOR FUNCTIONS (\*(GK\f(HB)\*(FR\s0"
+.sp .5
.\" --- Type Functions
.ES
.fi
@@ -1959,11 +1972,6 @@ Return the translation of \*(FIstring\*(FR in text domain
\*(FIdomain\*(FR for locale category \*(FIcategory\*(FR.
The default value for \*(FIdomain\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR.
The default value for \*(FIcategory\*(FR is \*(FC"LC_MESSAGES"\*(FR.
-.sp .5
-If you supply a value for \*(FIcategory\*(FR, it must be a string equal to
-one of the known locale categories.
-You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR
-to use the current domain.
.ti -.2i
\*(FCdcngettext(\*(FIstring1\*(FC, \*(FIstring2\*(FC, \*(FInumber\*(FR [\*(FC, \*(FIdom \*(FR[\*(FC, \*(FIcat\*(FR]]\*(FC)\*(FR
.br
@@ -1971,12 +1979,7 @@ Return the plural form used for \*(FInumber\*(FR of the translation of
\*(FIstring1\*(FR and \*(FIstring2\*(FR in text domain
\*(FIdom\*(FR for locale category \*(FIcat\*(FR.
The default value for \*(FIdom\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR.
-The default for \*(FIcat\*(FR is \*(FC"LC_MESSAGES"\*(FR.
-.sp .5
-If you supply a value for \*(FIcat\*(FR, it must be a string equal to
-one of the known locale categories.
-You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR
-to use the current domain.\*(CB
+The default for \*(FIcat\*(FR is \*(FC"LC_MESSAGES"\*(FR.\*(CB
.in -.2i
.EB "\s+2\f(HBINTERNATIONALIZATION (\*(GK\f(HB)\*(FR\s0"
.sp .5
@@ -2012,7 +2015,7 @@ maintains it.\*(CX
.ES
.fi
\*(CDCopyright \(co 1996\(en2005,
-2007, 2009\(en2020 Free Software Foundation, Inc.
+2007, 2009\(en2021 Free Software Foundation, Inc.
.sp .5
Permission is granted to make and distribute verbatim copies of this
reference card provided the copyright notice and this permission notice
diff --git a/doc/gawk.1 b/doc/gawk.1
index 0d498ab1..b22a9485 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -3487,6 +3487,16 @@ in \*(EP.
You must also supply a text domain. Use
.B TEXTDOMAIN
if you want to use the current domain.
+.SS Boolean Valued Functions
+You can create special Boolean-typed values; see the manual for how
+they work and why they exist.
+.TP
+.BI mkbool( expression\^ )
+Based on the boolean value of
+.I expression
+return either a true value or a false value.
+True values have numeric value one.
+False values have numeric value zero.
.SH USER-DEFINED FUNCTIONS
Functions in \*(AK are defined as follows:
.PP
diff --git a/doc/gawk.info b/doc/gawk.info
index 1c7dfa20..1169d3da 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -381,6 +381,8 @@ in (a) below. A copy of the license is included in the section entitled
* Arrays Summary:: Summary of arrays.
* Built-in:: Summarizes the built-in functions.
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean
+ values.
* Numeric Functions:: Functions that work with numbers,
including 'int()', 'sin()'
and 'rand()'.
@@ -490,6 +492,7 @@ in (a) below. A copy of the license is included in the section entitled
* Programs Summary:: Summary of programs.
* Programs Exercises:: Exercises.
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with 'number|bool' type.
* Array Sorting:: Facilities for controlling array
traversal and sorting arrays.
* Controlling Array Traversal:: How to use PROCINFO["sorted_in"].
@@ -553,6 +556,7 @@ in (a) below. A copy of the license is included in the section entitled
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.
* Getting Accuracy:: Getting more accuracy takes some work.
* Try To Round:: Add digits and round.
* Setting precision:: How to set the precision.
@@ -3226,7 +3230,9 @@ change. The variables are:
'AWK_HASH'
If this variable exists with a value of 'gst', 'gawk' switches to
using the hash function from GNU Smalltalk for managing arrays.
- This function may be marginally faster than the standard function.
+ With a value of 'fnv1a', 'gawk' uses the FNV1-A hash function
+ (http://www.isthe.com/chongo/tech/comp/fnv/index.html). These
+ functions may be marginally faster than the standard function.
'AWKREADFUNC'
If this variable exists, 'gawk' switches to reading source files
@@ -6993,8 +6999,8 @@ width. Here is a list of the format-control letters:
On systems supporting IEEE 754 floating-point format, values
representing negative infinity are formatted as '-inf' or
'-infinity', and positive infinity as 'inf' or 'infinity'. The
- special "not a number" value formats as '-nan' or 'nan' (*note Math
- Definitions::).
+ special "not a number" value formats as '-nan' or 'nan' (*note
+ Strange values::).
'%F'
Like '%f', but the infinity and "not a number" values are spelled
@@ -12823,6 +12829,7 @@ your convenience.
* Menu:
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean values.
* Numeric Functions:: Functions that work with numbers, including
'int()', 'sin()' and 'rand()'.
* String Functions:: Functions for string manipulation, such as
@@ -12835,7 +12842,7 @@ your convenience.
* I18N Functions:: Functions for string translation.

-File: gawk.info, Node: Calling Built-in, Next: Numeric Functions, Up: Built-in
+File: gawk.info, Node: Calling Built-in, Next: Boolean Functions, Up: Built-in
9.1.1 Calling Built-in Functions
--------------------------------
@@ -12879,9 +12886,24 @@ six, and then 12, and 'atan2()' is called with the two arguments six and
10, then 11, and 'atan2()' is called with the two arguments 11 and 10.

-File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Calling Built-in, Up: Built-in
+File: gawk.info, Node: Boolean Functions, Next: Numeric Functions, Prev: Calling Built-in, Up: Built-in
-9.1.2 Numeric Functions
+9.1.2 Generating Boolean Values
+-------------------------------
+
+This function is specific to 'gawk'. It is not available in
+compatibility mode (*note Options::):
+
+'mkbool(EXPRESSION)'
+ Return a Boolean-typed value based on the regular Boolean value of
+ EXPRESSION. Boolean "true" values have numeric value one. Boolean
+ "false" values have numeric zero. This is discussed in more detail
+ in *note Boolean Typed Values::.
+
+
+File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Boolean Functions, Up: Built-in
+
+9.1.3 Numeric Functions
-----------------------
The following list describes all of the built-in functions that work
@@ -12907,7 +12929,7 @@ brackets ([ ]):
'log(X)'
Return the natural logarithm of X, if X is positive; otherwise,
- return 'NaN' ("not a number") on IEEE 754 systems. Additionally,
+ return NaN ("not a number") on IEEE 754 systems. Additionally,
'gawk' prints a warning message when 'x' is negative.
'rand()'
@@ -13005,7 +13027,7 @@ the same sequence of random numbers over and over again.

File: gawk.info, Node: String Functions, Next: I/O Functions, Prev: Numeric Functions, Up: Built-in
-9.1.3 String-Manipulation Functions
+9.1.4 String-Manipulation Functions
-----------------------------------
The functions in this minor node look at or change the text of one or
@@ -13581,7 +13603,7 @@ number zero.

File: gawk.info, Node: Gory Details, Up: String Functions
-9.1.3.1 More about '\' and '&' with 'sub()', 'gsub()', and 'gensub()'
+9.1.4.1 More about '\' and '&' with 'sub()', 'gsub()', and 'gensub()'
.....................................................................
CAUTION: This subsubsection has been reported to cause headaches.
@@ -13727,7 +13749,7 @@ POSIX rules.

File: gawk.info, Node: I/O Functions, Next: Time Functions, Prev: String Functions, Up: Built-in
-9.1.4 Input/Output Functions
+9.1.5 Input/Output Functions
----------------------------
The following functions relate to input/output (I/O). Optional
@@ -13944,7 +13966,7 @@ the way this was done was probably a mistake.

File: gawk.info, Node: Time Functions, Next: Bitwise Functions, Prev: I/O Functions, Up: Built-in
-9.1.5 Time Functions
+9.1.6 Time Functions
--------------------
'awk' programs are commonly used to process log files containing
@@ -14261,7 +14283,7 @@ does not appear in the returned string or appears literally.

File: gawk.info, Node: Bitwise Functions, Next: Type Functions, Prev: Time Functions, Up: Built-in
-9.1.6 Bit-Manipulation Functions
+9.1.7 Bit-Manipulation Functions
--------------------------------
I can explain it for you, but I can't understand it for you.
@@ -14443,7 +14465,7 @@ that range are reduced to fit within the range.

File: gawk.info, Node: Type Functions, Next: I18N Functions, Prev: Bitwise Functions, Up: Built-in
-9.1.7 Getting Type Information
+9.1.8 Getting Type Information
------------------------------
'gawk' provides two functions that let you distinguish the type of a
@@ -14467,6 +14489,9 @@ contexts.
'"number"'
X is a number.
+ '"number|bool"'
+ X is a Boolean typed value (*note Boolean Typed Values::).
+
'"string"'
X is a string.
@@ -14545,7 +14570,7 @@ not remain a scalar forever (or until deleted).

File: gawk.info, Node: I18N Functions, Prev: Type Functions, Up: Built-in
-9.1.8 String-Translation Functions
+9.1.9 String-Translation Functions
----------------------------------
'gawk' provides facilities for internationalizing 'awk' programs. These
@@ -15224,7 +15249,7 @@ File: gawk.info, Node: Indirect Calls, Next: Functions Summary, Prev: User-de
9.3 Indirect Function Calls
===========================
-This section describes an advanced, 'gawk'-specific extension.
+This minor node describes an advanced, 'gawk'-specific extension.
Often, you may wish to defer the choice of function to call until
runtime. For example, you may have different kinds of records, each of
@@ -20977,6 +21002,7 @@ their own:
* Menu:
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with 'number|bool' type.
* Array Sorting:: Facilities for controlling array traversal and
sorting arrays.
* Two-way I/O:: Two-way communications with another process.
@@ -20986,7 +21012,7 @@ their own:
* Advanced Features Summary:: Summary of advanced features.

-File: gawk.info, Node: Nondecimal Data, Next: Array Sorting, Up: Advanced Features
+File: gawk.info, Node: Nondecimal Data, Next: Boolean Typed Values, Up: Advanced Features
12.1 Allowing Nondecimal Input Data
===================================
@@ -21029,9 +21055,53 @@ request it.
This option may disappear in a future version of 'gawk'.

-File: gawk.info, Node: Array Sorting, Next: Two-way I/O, Prev: Nondecimal Data, Up: Advanced Features
+File: gawk.info, Node: Boolean Typed Values, Next: Array Sorting, Prev: Nondecimal Data, Up: Advanced Features
+
+12.2 Boolean Typed Values
+=========================
+
+Scalar values in 'awk' are either numbers or strings. 'gawk' also
+supports values of type 'regexp' (*note Strong Regexp Constants::).
+
+ As described in *note Truth Values::, Boolean values in 'awk' don't
+have a separate type: a value counts as "true" if it is nonzero or
+non-null, and as "false" otherwise.
+
+ When interchanging data with languages that do have a real Boolean
+type, using a standard format such as JSON or XML, the lack of a true
+Boolean type in 'awk' is problematic. (See, for example, the 'json'
+extension provided by the 'gawkextlib' project
+(https://sourceforge.net/projects/gawkextlib).)
+
+ It's easy to import Boolean data into 'awk', but then the fact that
+it was originally Boolean is lost. Exporting data is even harder;
+there's no way to indicate that a value is really Boolean.
+
+ To solve this problem, 'gawk' provides a function named 'mkbool()'.
+It takes one argument, which is any 'awk' expression, and it returns a
+value of Boolean type.
+
+ The returned values are normal 'awk' numeric values, with values of
+either one or zero, depending upon the truth value of the original
+expression passed in the call to 'mkbool()'.
+
+ The 'typeof()' function (*note Type Functions::) returns
+'"number|bool"' for these values.
+
+ Thus Boolean-typed values _are_ numbers as far as 'gawk' is
+concerned, except that extension code can treat them as Booleans if
+desired.
+
+ While it would have been possible to add two new built-in variables
+of Boolean type named 'TRUE' and 'FALSE', doing so would undoubtedly
+have broken many existing 'awk' programs. Instead, having a "generator"
+function that creates Boolean values gives flexibility, without breaking
+as much existing code.
+
+
+File: gawk.info, Node: Array Sorting, Next: Two-way I/O, Prev: Boolean Typed Values, Up: Advanced Features
-12.2 Controlling Array Traversal and Array Sorting
+12.3 Controlling Array Traversal and Array Sorting
==================================================
'gawk' lets you control the order in which a 'for (INDX in ARRAY)' loop
@@ -21050,7 +21120,7 @@ to order the elements during sorting.

File: gawk.info, Node: Controlling Array Traversal, Next: Array Sorting Functions, Up: Array Sorting
-12.2.1 Controlling Array Traversal
+12.3.1 Controlling Array Traversal
----------------------------------
By default, the order in which a 'for (INDX in ARRAY)' loop scans an
@@ -21289,7 +21359,7 @@ character, which cannot be part of an identifier.

File: gawk.info, Node: Array Sorting Functions, Prev: Controlling Array Traversal, Up: Array Sorting
-12.2.2 Sorting Array Values and Indices with 'gawk'
+12.3.2 Sorting Array Values and Indices with 'gawk'
---------------------------------------------------
In most 'awk' implementations, sorting an array requires writing a
@@ -21434,7 +21504,7 @@ POSIX-compatibility mode, and because 'asort()' and 'asorti()' are

File: gawk.info, Node: Two-way I/O, Next: TCP/IP Networking, Prev: Array Sorting, Up: Advanced Features
-12.3 Two-Way Communications with Another Process
+12.4 Two-Way Communications with Another Process
================================================
It is often useful to be able to send data to a separate program for
@@ -21629,7 +21699,7 @@ in Bash.

File: gawk.info, Node: TCP/IP Networking, Next: Profiling, Prev: Two-way I/O, Up: Advanced Features
-12.4 Using 'gawk' for Network Programming
+12.5 Using 'gawk' for Network Programming
=========================================
'EMRED':
@@ -21709,7 +21779,7 @@ complete introduction and discussion, as well as extensive examples.

File: gawk.info, Node: Profiling, Next: Extension Philosophy, Prev: TCP/IP Networking, Up: Advanced Features
-12.5 Profiling Your 'awk' Programs
+12.6 Profiling Your 'awk' Programs
==================================
You may produce execution traces of your 'awk' programs. This is done
@@ -21971,7 +22041,7 @@ source code, it will appear that way in the output.

File: gawk.info, Node: Extension Philosophy, Next: Advanced Features Summary, Prev: Profiling, Up: Advanced Features
-12.6 Builtin Features versus Extensions
+12.7 Builtin Features versus Extensions
=======================================
As this and subsequent major nodes show, 'gawk' has a large number of
@@ -22007,7 +22077,7 @@ or need.

File: gawk.info, Node: Advanced Features Summary, Prev: Extension Philosophy, Up: Advanced Features
-12.7 Summary
+12.8 Summary
============
* The '--non-decimal-data' option causes 'gawk' to treat octal- and
@@ -24364,18 +24434,10 @@ material here:
another number and infinity produce infinity.
"NaN"
- "Not a number."(1) A special value that results from attempting a
- calculation that has no answer as a real number. In such a case,
- programs can either receive a floating-point exception, or get
- 'NaN' back as the result. The IEEE 754 standard recommends that
- systems return 'NaN'. Some examples:
-
- 'sqrt(-1)'
- This makes sense in the range of complex numbers, but not in
- the range of real numbers, so the result is 'NaN'.
-
- 'log(-8)'
- -8 is out of the domain of 'log()', so the result is 'NaN'.
+ "Not a number." A special value that results from attempting a
+ calculation that has no answer as a real number. *Note Strange
+ values::, for more information about infinity and not-a-number
+ values.
"Normalized"
How the significand (see later in this list) is usually stored.
@@ -24434,11 +24496,6 @@ Table 16.3: Basic IEEE format values
NOTE: The precision numbers include the implied leading one that
gives them one extra bit of significand.
- ---------- Footnotes ----------
-
- (1) Thanks to Michael Brennan for this description, which we have
-paraphrased, and for the examples.
-

File: gawk.info, Node: MPFR features, Next: FP Math Caution, Prev: Math Definitions, Up: Arbitrary Precision Arithmetic
@@ -24531,6 +24588,7 @@ be sure of the number of significant decimal places in the final result.
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.

File: gawk.info, Node: Inexact representation, Next: Comparing FP Values, Up: Inexactness of computations
@@ -24595,7 +24653,7 @@ values with a delta, you should be sure to use 'difference < abs(delta)'
in case someone passes in a negative delta value.

-File: gawk.info, Node: Errors accumulate, Prev: Comparing FP Values, Up: Inexactness of computations
+File: gawk.info, Node: Errors accumulate, Next: Strange values, Prev: Comparing FP Values, Up: Inexactness of computations
16.4.1.3 Errors Accumulate
..........................
@@ -24643,6 +24701,64 @@ representations yield an unexpected result:
-| 4

+File: gawk.info, Node: Strange values, Prev: Errors accumulate, Up: Inexactness of computations
+
+16.4.1.4 Floating Point Values They Didn't Talk About In School
+...............................................................
+
+Both IEEE 754 floating-point hardware, and MPFR, support two kinds of
+values that you probably didn't learn about in school. The first is
+"infinity", a special value, that can be either negative or positive,
+and which is either smaller than any other value (negative infinity), or
+larger than any other value (positive infinity). When such values are
+generated, 'gawk' prints them as either '-inf' or '+inf', respectively.
+It accepts those strings as data input and converts them to the proper
+floating-point values internally.
+
+ Infinity values of the same sign compare as equal to each other.
+Otherwise, operations (addition, subtraction, etc.) involving another
+number and infinity produce mathematically reasonable results.
+
+ The second kind of value is "not a number", or NaN for short.(1)
+This is a special value that results from attempting a calculation that
+has no answer as a real number. In such a case, programs can either
+receive a floating-point exception, or get NaN back as the result. The
+IEEE 754 standard recommends that systems return NaN. Some examples:
+
+'sqrt(-1)'
+ This makes sense in the range of complex numbers, but not in the
+ range of real numbers, so the result is NaN.
+
+'log(-8)'
+ -8 is out of the domain of 'log()', so the result is NaN.
+
+ NaN values are strange. In particular, they cannot be compared with
+other floating point values; any such comparison, except for "is not
+equal to", returns false. NaN values are so much unequal to other
+values that even comparing two identical NaN values with '!=' returns
+true!
+
+ NaN values can also be signed, although it depends upon the
+implementation as to which sign you get for any operation that returns a
+NaN. For example, on some systems, 'sqrt(-1)' returns a negative NaN. On
+others, it returns a positive NaN.
+
+ When such values are generated, 'gawk' prints them as either '-nan'
+or '+nan', respectively. Here too, 'gawk' accepts those strings as data
+input and converts them to the proper floating-point values internally.
+
+ If you want to dive more deeply into this topic, you can find test
+programs in C, 'awk' and Python in the directory
+'awklib/eg/test-programs' in the 'gawk' distribution. These programs
+enable comparison among programming languages as to how they handle NaN
+and infinity values.
+
+ ---------- Footnotes ----------
+
+ (1) Thanks to Michael Brennan for this description, which we have
+paraphrased, and for the examples.
+
+
File: gawk.info, Node: Getting Accuracy, Next: Try To Round, Prev: Inexactness of computations, Up: FP Math Caution
16.4.2 Getting the Accuracy You Need
@@ -25589,7 +25705,8 @@ use them.
' AWK_STRNUM,'
' AWK_ARRAY,'
' AWK_SCALAR, /* opaque access to a variable */'
-' AWK_VALUE_COOKIE /* for updating a previously created value */'
+' AWK_VALUE_COOKIE, /* for updating a previously created value */'
+' AWK_BOOL'
'} awk_valtype_t;'
This 'enum' indicates the type of a value. It is used in the
following 'struct'.
@@ -25602,6 +25719,7 @@ use them.
' awk_array_t a;'
' awk_scalar_t scl;'
' awk_value_cookie_t vc;'
+' awk_bool_t b;'
' } u;'
'} awk_value_t;'
An "'awk' value." The 'val_type' member indicates what kind of
@@ -25617,6 +25735,7 @@ use them.
'#define array_cookie u.a'
'#define scalar_cookie u.scl'
'#define value_cookie u.vc'
+'#define bool_value u.b'
Using these macros makes accessing the fields of the 'awk_value_t'
more readable.
@@ -25927,6 +26046,11 @@ code would use them:
a 'char *' value pointing to data previously obtained from
'gawk_malloc()', 'gawk_calloc()', or 'gawk_realloc()'.
+'static inline awk_value_t *'
+'make_bool(awk_bool_t boolval, awk_value_t *result);'
+ This function creates a boolean value in the 'awk_value_t' variable
+ pointed to by 'result'.
+

File: gawk.info, Node: API Ownership of MPFR and GMP Values, Next: Registration Functions, Prev: Constructor Functions, Up: Extension API Description
@@ -26652,16 +26776,17 @@ summarized in *note Table 17.2: table-value-types-returned.
Type of Actual Value
--------------------------------------------------------------------------
- String Strnum Number Regex Array Undefined
--------------------------------------------------------------------------------
- String String String String String false false
- Strnum false Strnum Strnum false false false
- Number Number Number Number false false false
-Type Regex false false false Regex false false
-Requested Array false false false false Array false
- Scalar Scalar Scalar Scalar Scalar false false
- Undefined String Strnum Number Regex Array Undefined
- Value false false false false false false
+ String Strnum Number Regex Bool Array Undefined
+----------------------------------------------------------------------------------------
+ String String String String String String false false
+ Strnum false Strnum Strnum false false false false
+ Number Number Number Number false Number false false
+Type Regex false false false Regex false false false
+Requested Bool false false false false Bool false false
+ Array false false false false false Array false
+ Scalar Scalar Scalar Scalar Scalar Scalar false false
+ Undefined String Strnum Number Regex Bool Array Undefined
+ Value false false false false false false false
cookie
Table 17.2: API value types returned
@@ -33525,8 +33650,8 @@ Localization
Logical Expression
An expression using the operators for logic, AND, OR, and NOT,
- written '&&', '||', and '!' in 'awk'. Often called Boolean
- expressions, after the mathematician who pioneered this kind of
+ written '&&', '||', and '!' in 'awk'. Often called "Boolean
+ expressions", after the mathematician who pioneered this kind of
mathematical logic.
Lvalue
@@ -35683,6 +35808,7 @@ Index
* body, in loops: While Statement. (line 14)
* Boolean expressions: Boolean Ops. (line 6)
* Boolean expressions, as patterns: Expression Patterns. (line 39)
+* boolean function: Boolean Functions. (line 6)
* Bourne shell, quoting rules for: Quoting. (line 18)
* braces ({}), regexp operator: Regexp Operator Details.
(line 118)
@@ -36039,7 +36165,7 @@ Index
* dark corner, length() function: String Functions. (line 201)
* dark corner, split() function: String Functions. (line 380)
* dark corner, array elements created by reference: Type Functions.
- (line 85)
+ (line 88)
* dark corner, parameter name restrictions: Definition Syntax.
(line 44)
* dark corner <1>: Glossary. (line 266)
@@ -37283,6 +37409,7 @@ Index
* metacharacters, escape sequences for: Escape Sequences. (line 140)
* metacharacters, in regular expressions: Regexp Operators. (line 6)
* minimum precision required by MPFR library: Auto-set. (line 279)
+* mkbool: Boolean Functions. (line 10)
* mktime: Time Functions. (line 25)
* modifiers, in format specifiers: Format Modifiers. (line 6)
* module, definition of: Global Namespace. (line 18)
@@ -38510,609 +38637,612 @@ Index

Tag Table:
Node: Top1200
-Node: Foreword345252
-Node: Foreword449694
-Node: Preface51226
-Ref: Preface-Footnote-154085
-Ref: Preface-Footnote-254194
-Ref: Preface-Footnote-354428
-Node: History54570
-Node: Names56922
-Ref: Names-Footnote-158026
-Node: This Manual58173
-Ref: This Manual-Footnote-164812
-Node: Conventions64912
-Node: Manual History67281
-Ref: Manual History-Footnote-170278
-Ref: Manual History-Footnote-270319
-Node: How To Contribute70393
-Node: Acknowledgments71319
-Node: Getting Started76256
-Node: Running gawk78695
-Node: One-shot79885
-Node: Read Terminal81148
-Node: Long83141
-Node: Executable Scripts84654
-Ref: Executable Scripts-Footnote-187287
-Node: Comments87390
-Node: Quoting89874
-Node: DOS Quoting95400
-Node: Sample Data Files97456
-Node: Very Simple100051
-Node: Two Rules106153
-Node: More Complex108038
-Node: Statements/Lines110370
-Ref: Statements/Lines-Footnote-1114854
-Node: Other Features115119
-Node: When116055
-Ref: When-Footnote-1117809
-Node: Intro Summary117874
-Node: Invoking Gawk118758
-Node: Command Line120272
-Node: Options121070
-Ref: Options-Footnote-1138984
-Ref: Options-Footnote-2139215
-Node: Other Arguments139240
-Node: Naming Standard Input143251
-Node: Environment Variables144461
-Node: AWKPATH Variable145019
-Ref: AWKPATH Variable-Footnote-1148431
-Ref: AWKPATH Variable-Footnote-2148465
-Node: AWKLIBPATH Variable148836
-Ref: AWKLIBPATH Variable-Footnote-1150533
-Node: Other Environment Variables150908
-Node: Exit Status154729
-Node: Include Files155406
-Node: Loading Shared Libraries159096
-Node: Obsolete160524
-Node: Undocumented161216
-Node: Invoking Summary161513
-Node: Regexp164354
-Node: Regexp Usage165808
-Node: Escape Sequences167845
-Node: Regexp Operators174086
-Node: Regexp Operator Details174571
-Ref: Regexp Operator Details-Footnote-1181935
-Node: Interval Expressions182082
-Ref: Interval Expressions-Footnote-1184282
-Node: Bracket Expressions184380
-Ref: table-char-classes186856
-Node: Leftmost Longest190182
-Node: Computed Regexps191485
-Node: GNU Regexp Operators194912
-Node: Case-sensitivity198649
-Ref: Case-sensitivity-Footnote-1201515
-Ref: Case-sensitivity-Footnote-2201750
-Node: Regexp Summary201858
-Node: Reading Files203324
-Node: Records205593
-Node: awk split records206668
-Node: gawk split records211368
-Ref: gawk split records-Footnote-1216442
-Node: Fields216479
-Node: Nonconstant Fields219220
-Ref: Nonconstant Fields-Footnote-1221456
-Node: Changing Fields221660
-Node: Field Separators227691
-Node: Default Field Splitting230389
-Node: Regexp Field Splitting231507
-Node: Single Character Fields235184
-Node: Command Line Field Separator236244
-Node: Full Line Fields239462
-Ref: Full Line Fields-Footnote-1240984
-Ref: Full Line Fields-Footnote-2241030
-Node: Field Splitting Summary241131
-Node: Constant Size243205
-Node: Fixed width data243937
-Node: Skipping intervening247404
-Node: Allowing trailing data248202
-Node: Fields with fixed data249239
-Node: Splitting By Content250757
-Ref: Splitting By Content-Footnote-1254540
-Node: More CSV254703
-Node: Testing field creation256295
-Node: Multiple Line257920
-Node: Getline264197
-Node: Plain Getline266666
-Node: Getline/Variable269239
-Node: Getline/File270390
-Node: Getline/Variable/File271778
-Ref: Getline/Variable/File-Footnote-1273383
-Node: Getline/Pipe273471
-Node: Getline/Variable/Pipe276175
-Node: Getline/Coprocess277310
-Node: Getline/Variable/Coprocess278577
-Node: Getline Notes279319
-Node: Getline Summary282116
-Ref: table-getline-variants282540
-Node: Read Timeout283288
-Ref: Read Timeout-Footnote-1287194
-Node: Retrying Input287252
-Node: Command-line directories288451
-Node: Input Summary289357
-Node: Input Exercises292529
-Node: Printing292963
-Node: Print294797
-Node: Print Examples296254
-Node: Output Separators299034
-Node: OFMT301051
-Node: Printf302407
-Node: Basic Printf303192
-Node: Control Letters304766
-Node: Format Modifiers309930
-Node: Printf Examples315945
-Node: Redirection318431
-Node: Special FD325272
-Ref: Special FD-Footnote-1328440
-Node: Special Files328514
-Node: Other Inherited Files329131
-Node: Special Network330132
-Node: Special Caveats330992
-Node: Close Files And Pipes331941
-Ref: table-close-pipe-return-values338848
-Ref: Close Files And Pipes-Footnote-1339661
-Ref: Close Files And Pipes-Footnote-2339809
-Node: Nonfatal339961
-Node: Output Summary342299
-Node: Output Exercises343521
-Node: Expressions344200
-Node: Values345388
-Node: Constants346066
-Node: Scalar Constants346757
-Ref: Scalar Constants-Footnote-1349267
-Node: Nondecimal-numbers349517
-Node: Regexp Constants352518
-Node: Using Constant Regexps353044
-Node: Standard Regexp Constants353666
-Node: Strong Regexp Constants356854
-Node: Variables360567
-Node: Using Variables361224
-Node: Assignment Options363134
-Node: Conversion365605
-Node: Strings And Numbers366129
-Ref: Strings And Numbers-Footnote-1369192
-Node: Locale influences conversions369301
-Ref: table-locale-affects372059
-Node: All Operators372677
-Node: Arithmetic Ops373306
-Node: Concatenation376022
-Ref: Concatenation-Footnote-1378869
-Node: Assignment Ops378976
-Ref: table-assign-ops383967
-Node: Increment Ops385280
-Node: Truth Values and Conditions388740
-Node: Truth Values389814
-Node: Typing and Comparison390862
-Node: Variable Typing391682
-Ref: Variable Typing-Footnote-1398145
-Ref: Variable Typing-Footnote-2398217
-Node: Comparison Operators398294
-Ref: table-relational-ops398713
-Node: POSIX String Comparison402208
-Ref: POSIX String Comparison-Footnote-1403903
-Ref: POSIX String Comparison-Footnote-2404042
-Node: Boolean Ops404126
-Ref: Boolean Ops-Footnote-1408608
-Node: Conditional Exp408700
-Node: Function Calls410436
-Node: Precedence414313
-Node: Locales417972
-Node: Expressions Summary419604
-Node: Patterns and Actions422177
-Node: Pattern Overview423297
-Node: Regexp Patterns424974
-Node: Expression Patterns425516
-Node: Ranges429297
-Node: BEGIN/END432405
-Node: Using BEGIN/END433166
-Ref: Using BEGIN/END-Footnote-1435920
-Node: I/O And BEGIN/END436026
-Node: BEGINFILE/ENDFILE438339
-Node: Empty441570
-Node: Using Shell Variables441887
-Node: Action Overview444161
-Node: Statements446486
-Node: If Statement448334
-Node: While Statement449829
-Node: Do Statement451857
-Node: For Statement453005
-Node: Switch Statement456176
-Node: Break Statement458617
-Node: Continue Statement460709
-Node: Next Statement462536
-Node: Nextfile Statement464919
-Node: Exit Statement467608
-Node: Built-in Variables470011
-Node: User-modified471144
-Node: Auto-set478911
-Ref: Auto-set-Footnote-1495718
-Ref: Auto-set-Footnote-2495924
-Node: ARGC and ARGV495980
-Node: Pattern Action Summary500193
-Node: Arrays502623
-Node: Array Basics503952
-Node: Array Intro504796
-Ref: figure-array-elements506771
-Ref: Array Intro-Footnote-1509475
-Node: Reference to Elements509603
-Node: Assigning Elements512067
-Node: Array Example512558
-Node: Scanning an Array514317
-Node: Controlling Scanning517339
-Ref: Controlling Scanning-Footnote-1523795
-Node: Numeric Array Subscripts524111
-Node: Uninitialized Subscripts526295
-Node: Delete527914
-Ref: Delete-Footnote-1530666
-Node: Multidimensional530723
-Node: Multiscanning533818
-Node: Arrays of Arrays535409
-Node: Arrays Summary540177
-Node: Functions542270
-Node: Built-in543308
-Node: Calling Built-in544389
-Node: Numeric Functions546385
-Ref: Numeric Functions-Footnote-1550413
-Ref: Numeric Functions-Footnote-2551061
-Ref: Numeric Functions-Footnote-3551109
-Node: String Functions551381
-Ref: String Functions-Footnote-1575896
-Ref: String Functions-Footnote-2576024
-Ref: String Functions-Footnote-3576272
-Node: Gory Details576359
-Ref: table-sub-escapes578150
-Ref: table-sub-proposed579669
-Ref: table-posix-sub581032
-Ref: table-gensub-escapes582573
-Ref: Gory Details-Footnote-1583396
-Node: I/O Functions583550
-Ref: table-system-return-values590004
-Ref: I/O Functions-Footnote-1592084
-Ref: I/O Functions-Footnote-2592232
-Node: Time Functions592352
-Ref: Time Functions-Footnote-1603023
-Ref: Time Functions-Footnote-2603091
-Ref: Time Functions-Footnote-3603249
-Ref: Time Functions-Footnote-4603360
-Ref: Time Functions-Footnote-5603472
-Ref: Time Functions-Footnote-6603699
-Node: Bitwise Functions603965
-Ref: table-bitwise-ops604559
-Ref: Bitwise Functions-Footnote-1610622
-Ref: Bitwise Functions-Footnote-2610795
-Node: Type Functions610986
-Node: I18N Functions614505
-Node: User-defined616156
-Node: Definition Syntax616968
-Ref: Definition Syntax-Footnote-1622662
-Node: Function Example622733
-Ref: Function Example-Footnote-1625655
-Node: Function Calling625677
-Node: Calling A Function626265
-Node: Variable Scope627223
-Node: Pass By Value/Reference630217
-Node: Function Caveats632861
-Ref: Function Caveats-Footnote-1634908
-Node: Return Statement635028
-Node: Dynamic Typing638007
-Node: Indirect Calls638937
-Ref: Indirect Calls-Footnote-1649189
-Node: Functions Summary649317
-Node: Library Functions652022
-Ref: Library Functions-Footnote-1655629
-Ref: Library Functions-Footnote-2655772
-Node: Library Names655943
-Ref: Library Names-Footnote-1659610
-Ref: Library Names-Footnote-2659833
-Node: General Functions659919
-Node: Strtonum Function661101
-Node: Assert Function664123
-Node: Round Function667449
-Node: Cliff Random Function668989
-Node: Ordinal Functions670005
-Ref: Ordinal Functions-Footnote-1673068
-Ref: Ordinal Functions-Footnote-2673320
-Node: Join Function673530
-Ref: Join Function-Footnote-1675300
-Node: Getlocaltime Function675500
-Node: Readfile Function679242
-Node: Shell Quoting681219
-Node: Isnumeric Function682647
-Node: Data File Management684035
-Node: Filetrans Function684667
-Node: Rewind Function688763
-Node: File Checking690672
-Ref: File Checking-Footnote-1692006
-Node: Empty Files692207
-Node: Ignoring Assigns694186
-Node: Getopt Function695736
-Ref: Getopt Function-Footnote-1710959
-Node: Passwd Functions711159
-Ref: Passwd Functions-Footnote-1719998
-Node: Group Functions720086
-Ref: Group Functions-Footnote-1727984
-Node: Walking Arrays728191
-Node: Library Functions Summary731199
-Node: Library Exercises732605
-Node: Sample Programs733070
-Node: Running Examples733840
-Node: Clones734568
-Node: Cut Program735792
-Node: Egrep Program745932
-Node: Id Program754933
-Node: Split Program764880
-Ref: Split Program-Footnote-1774773
-Node: Tee Program774946
-Node: Uniq Program777736
-Node: Wc Program785324
-Node: Bytes vs. Characters785711
-Node: Using extensions787259
-Node: wc program788013
-Node: Miscellaneous Programs792878
-Node: Dupword Program794091
-Node: Alarm Program796121
-Node: Translate Program800976
-Ref: Translate Program-Footnote-1805541
-Node: Labels Program805811
-Ref: Labels Program-Footnote-1809162
-Node: Word Sorting809246
-Node: History Sorting813318
-Node: Extract Program815543
-Node: Simple Sed823597
-Node: Igawk Program826671
-Ref: Igawk Program-Footnote-1841002
-Ref: Igawk Program-Footnote-2841204
-Ref: Igawk Program-Footnote-3841326
-Node: Anagram Program841441
-Node: Signature Program844503
-Node: Programs Summary845750
-Node: Programs Exercises846964
-Ref: Programs Exercises-Footnote-1851094
-Node: Advanced Features851180
-Node: Nondecimal Data853247
-Node: Array Sorting854838
-Node: Controlling Array Traversal855538
-Ref: Controlling Array Traversal-Footnote-1863906
-Node: Array Sorting Functions864024
-Ref: Array Sorting Functions-Footnote-1869398
-Node: Two-way I/O869594
-Ref: Two-way I/O-Footnote-1877320
-Ref: Two-way I/O-Footnote-2877507
-Node: TCP/IP Networking877589
-Node: Profiling880707
-Node: Extension Philosophy890016
-Node: Advanced Features Summary891495
-Node: Internationalization893510
-Node: I18N and L10N895184
-Node: Explaining gettext895871
-Ref: Explaining gettext-Footnote-1901763
-Ref: Explaining gettext-Footnote-2901948
-Node: Programmer i18n902113
-Ref: Programmer i18n-Footnote-1907062
-Node: Translator i18n907111
-Node: String Extraction907905
-Ref: String Extraction-Footnote-1909037
-Node: Printf Ordering909123
-Ref: Printf Ordering-Footnote-1911909
-Node: I18N Portability911973
-Ref: I18N Portability-Footnote-1914429
-Node: I18N Example914492
-Ref: I18N Example-Footnote-1917767
-Ref: I18N Example-Footnote-2917840
-Node: Gawk I18N917949
-Node: I18N Summary918598
-Node: Debugger919939
-Node: Debugging920939
-Node: Debugging Concepts921380
-Node: Debugging Terms923189
-Node: Awk Debugging925764
-Ref: Awk Debugging-Footnote-1926709
-Node: Sample Debugging Session926841
-Node: Debugger Invocation927375
-Node: Finding The Bug928761
-Node: List of Debugger Commands935235
-Node: Breakpoint Control936568
-Node: Debugger Execution Control940262
-Node: Viewing And Changing Data943624
-Node: Execution Stack947165
-Node: Debugger Info948802
-Node: Miscellaneous Debugger Commands952873
-Node: Readline Support957935
-Node: Limitations958831
-Node: Debugging Summary961385
-Node: Namespaces962664
-Node: Global Namespace963775
-Node: Qualified Names965173
-Node: Default Namespace966172
-Node: Changing The Namespace966913
-Node: Naming Rules968527
-Node: Internal Name Management970375
-Node: Namespace Example971417
-Node: Namespace And Features973979
-Node: Namespace Summary975414
-Node: Arbitrary Precision Arithmetic976891
-Node: Computer Arithmetic978378
-Ref: table-numeric-ranges982144
-Ref: table-floating-point-ranges982637
-Ref: Computer Arithmetic-Footnote-1983295
-Node: Math Definitions983352
-Ref: table-ieee-formats986668
-Ref: Math Definitions-Footnote-1987271
-Node: MPFR features987376
-Node: FP Math Caution989094
-Ref: FP Math Caution-Footnote-1990166
-Node: Inexactness of computations990535
-Node: Inexact representation991495
-Node: Comparing FP Values992855
-Node: Errors accumulate994096
-Node: Getting Accuracy995529
-Node: Try To Round998239
-Node: Setting precision999138
-Ref: table-predefined-precision-strings999835
-Node: Setting the rounding mode1001665
-Ref: table-gawk-rounding-modes1002039
-Ref: Setting the rounding mode-Footnote-11005970
-Node: Arbitrary Precision Integers1006149
-Ref: Arbitrary Precision Integers-Footnote-11009324
-Node: Checking for MPFR1009473
-Node: POSIX Floating Point Problems1010947
-Ref: POSIX Floating Point Problems-Footnote-11015232
-Node: Floating point summary1015270
-Node: Dynamic Extensions1017460
-Node: Extension Intro1019013
-Node: Plugin License1020279
-Node: Extension Mechanism Outline1021076
-Ref: figure-load-extension1021515
-Ref: figure-register-new-function1023080
-Ref: figure-call-new-function1024172
-Node: Extension API Description1026234
-Node: Extension API Functions Introduction1027947
-Ref: table-api-std-headers1029783
-Node: General Data Types1034032
-Ref: General Data Types-Footnote-11042662
-Node: Memory Allocation Functions1042961
-Ref: Memory Allocation Functions-Footnote-11047462
-Node: Constructor Functions1047561
-Node: API Ownership of MPFR and GMP Values1051027
-Node: Registration Functions1052340
-Node: Extension Functions1053040
-Node: Exit Callback Functions1058362
-Node: Extension Version String1059612
-Node: Input Parsers1060275
-Node: Output Wrappers1072996
-Node: Two-way processors1077508
-Node: Printing Messages1079773
-Ref: Printing Messages-Footnote-11080944
-Node: Updating ERRNO1081097
-Node: Requesting Values1081836
-Ref: table-value-types-returned1082573
-Node: Accessing Parameters1083509
-Node: Symbol Table Access1084746
-Node: Symbol table by name1085258
-Ref: Symbol table by name-Footnote-11088283
-Node: Symbol table by cookie1088411
-Ref: Symbol table by cookie-Footnote-11092596
-Node: Cached values1092660
-Ref: Cached values-Footnote-11096196
-Node: Array Manipulation1096349
-Ref: Array Manipulation-Footnote-11097440
-Node: Array Data Types1097477
-Ref: Array Data Types-Footnote-11100135
-Node: Array Functions1100227
-Node: Flattening Arrays1104725
-Node: Creating Arrays1111701
-Node: Redirection API1116468
-Node: Extension API Variables1119301
-Node: Extension Versioning1120012
-Ref: gawk-api-version1120441
-Node: Extension GMP/MPFR Versioning1122172
-Node: Extension API Informational Variables1123800
-Node: Extension API Boilerplate1124873
-Node: Changes from API V11128847
-Node: Finding Extensions1130419
-Node: Extension Example1130978
-Node: Internal File Description1131776
-Node: Internal File Ops1135856
-Ref: Internal File Ops-Footnote-11147206
-Node: Using Internal File Ops1147346
-Ref: Using Internal File Ops-Footnote-11149729
-Node: Extension Samples1150003
-Node: Extension Sample File Functions1151532
-Node: Extension Sample Fnmatch1159181
-Node: Extension Sample Fork1160668
-Node: Extension Sample Inplace1161886
-Node: Extension Sample Ord1165512
-Node: Extension Sample Readdir1166348
-Ref: table-readdir-file-types1167237
-Node: Extension Sample Revout1168304
-Node: Extension Sample Rev2way1168893
-Node: Extension Sample Read write array1169633
-Node: Extension Sample Readfile1171575
-Node: Extension Sample Time1172670
-Node: Extension Sample API Tests1174422
-Node: gawkextlib1174914
-Node: Extension summary1177832
-Node: Extension Exercises1181534
-Node: Language History1182776
-Node: V7/SVR3.11184432
-Node: SVR41186584
-Node: POSIX1188018
-Node: BTL1189399
-Node: POSIX/GNU1190128
-Node: Feature History1195906
-Node: Common Extensions1213081
-Node: Ranges and Locales1214364
-Ref: Ranges and Locales-Footnote-11218980
-Ref: Ranges and Locales-Footnote-21219007
-Ref: Ranges and Locales-Footnote-31219242
-Node: Contributors1219465
-Node: History summary1225462
-Node: Installation1226842
-Node: Gawk Distribution1227786
-Node: Getting1228270
-Node: Extracting1229233
-Node: Distribution contents1230871
-Node: Unix Installation1238013
-Node: Quick Installation1238817
-Node: Compiling with MPFR1241293
-Node: Shell Startup Files1241985
-Node: Additional Configuration Options1243074
-Node: Configuration Philosophy1245389
-Node: Compiling from Git1247785
-Node: Building the Documentation1248340
-Node: Non-Unix Installation1249724
-Node: PC Installation1250184
-Node: PC Binary Installation1251022
-Node: PC Compiling1251457
-Node: PC Using1252574
-Node: Cygwin1256127
-Node: MSYS1257351
-Node: VMS Installation1257953
-Node: VMS Compilation1258672
-Ref: VMS Compilation-Footnote-11259901
-Node: VMS Dynamic Extensions1259959
-Node: VMS Installation Details1261644
-Node: VMS Running1263906
-Node: VMS GNV1268185
-Node: Bugs1268899
-Node: Bug definition1269811
-Node: Bug address1272315
-Node: Usenet1275703
-Node: Performance bugs1276712
-Node: Asking for help1279633
-Node: Maintainers1281595
-Node: Other Versions1282789
-Node: Installation summary1290641
-Node: Notes1292005
-Node: Compatibility Mode1292799
-Node: Additions1293581
-Node: Accessing The Source1294506
-Node: Adding Code1295943
-Node: New Ports1302162
-Node: Derived Files1306537
-Ref: Derived Files-Footnote-11312197
-Ref: Derived Files-Footnote-21312232
-Ref: Derived Files-Footnote-31312830
-Node: Future Extensions1312944
-Node: Implementation Limitations1313602
-Node: Extension Design1314812
-Node: Old Extension Problems1315956
-Ref: Old Extension Problems-Footnote-11317474
-Node: Extension New Mechanism Goals1317531
-Ref: Extension New Mechanism Goals-Footnote-11320895
-Node: Extension Other Design Decisions1321084
-Node: Extension Future Growth1323197
-Node: Notes summary1323803
-Node: Basic Concepts1324961
-Node: Basic High Level1325642
-Ref: figure-general-flow1325924
-Ref: figure-process-flow1326609
-Ref: Basic High Level-Footnote-11329910
-Node: Basic Data Typing1330095
-Node: Glossary1333423
-Node: Copying1365308
-Node: GNU Free Documentation License1402851
-Node: Index1427971
+Node: Foreword345523
+Node: Foreword449965
+Node: Preface51497
+Ref: Preface-Footnote-154356
+Ref: Preface-Footnote-254465
+Ref: Preface-Footnote-354699
+Node: History54841
+Node: Names57193
+Ref: Names-Footnote-158297
+Node: This Manual58444
+Ref: This Manual-Footnote-165083
+Node: Conventions65183
+Node: Manual History67552
+Ref: Manual History-Footnote-170549
+Ref: Manual History-Footnote-270590
+Node: How To Contribute70664
+Node: Acknowledgments71590
+Node: Getting Started76527
+Node: Running gawk78966
+Node: One-shot80156
+Node: Read Terminal81419
+Node: Long83412
+Node: Executable Scripts84925
+Ref: Executable Scripts-Footnote-187558
+Node: Comments87661
+Node: Quoting90145
+Node: DOS Quoting95671
+Node: Sample Data Files97727
+Node: Very Simple100322
+Node: Two Rules106424
+Node: More Complex108309
+Node: Statements/Lines110641
+Ref: Statements/Lines-Footnote-1115125
+Node: Other Features115390
+Node: When116326
+Ref: When-Footnote-1118080
+Node: Intro Summary118145
+Node: Invoking Gawk119029
+Node: Command Line120543
+Node: Options121341
+Ref: Options-Footnote-1139255
+Ref: Options-Footnote-2139486
+Node: Other Arguments139511
+Node: Naming Standard Input143522
+Node: Environment Variables144732
+Node: AWKPATH Variable145290
+Ref: AWKPATH Variable-Footnote-1148702
+Ref: AWKPATH Variable-Footnote-2148736
+Node: AWKLIBPATH Variable149107
+Ref: AWKLIBPATH Variable-Footnote-1150804
+Node: Other Environment Variables151179
+Node: Exit Status155131
+Node: Include Files155808
+Node: Loading Shared Libraries159498
+Node: Obsolete160926
+Node: Undocumented161618
+Node: Invoking Summary161915
+Node: Regexp164756
+Node: Regexp Usage166210
+Node: Escape Sequences168247
+Node: Regexp Operators174488
+Node: Regexp Operator Details174973
+Ref: Regexp Operator Details-Footnote-1182337
+Node: Interval Expressions182484
+Ref: Interval Expressions-Footnote-1184684
+Node: Bracket Expressions184782
+Ref: table-char-classes187258
+Node: Leftmost Longest190584
+Node: Computed Regexps191887
+Node: GNU Regexp Operators195314
+Node: Case-sensitivity199051
+Ref: Case-sensitivity-Footnote-1201917
+Ref: Case-sensitivity-Footnote-2202152
+Node: Regexp Summary202260
+Node: Reading Files203726
+Node: Records205995
+Node: awk split records207070
+Node: gawk split records211770
+Ref: gawk split records-Footnote-1216844
+Node: Fields216881
+Node: Nonconstant Fields219622
+Ref: Nonconstant Fields-Footnote-1221858
+Node: Changing Fields222062
+Node: Field Separators228093
+Node: Default Field Splitting230791
+Node: Regexp Field Splitting231909
+Node: Single Character Fields235586
+Node: Command Line Field Separator236646
+Node: Full Line Fields239864
+Ref: Full Line Fields-Footnote-1241386
+Ref: Full Line Fields-Footnote-2241432
+Node: Field Splitting Summary241533
+Node: Constant Size243607
+Node: Fixed width data244339
+Node: Skipping intervening247806
+Node: Allowing trailing data248604
+Node: Fields with fixed data249641
+Node: Splitting By Content251159
+Ref: Splitting By Content-Footnote-1254942
+Node: More CSV255105
+Node: Testing field creation256697
+Node: Multiple Line258322
+Node: Getline264599
+Node: Plain Getline267068
+Node: Getline/Variable269641
+Node: Getline/File270792
+Node: Getline/Variable/File272180
+Ref: Getline/Variable/File-Footnote-1273785
+Node: Getline/Pipe273873
+Node: Getline/Variable/Pipe276577
+Node: Getline/Coprocess277712
+Node: Getline/Variable/Coprocess278979
+Node: Getline Notes279721
+Node: Getline Summary282518
+Ref: table-getline-variants282942
+Node: Read Timeout283690
+Ref: Read Timeout-Footnote-1287596
+Node: Retrying Input287654
+Node: Command-line directories288853
+Node: Input Summary289759
+Node: Input Exercises292931
+Node: Printing293365
+Node: Print295199
+Node: Print Examples296656
+Node: Output Separators299436
+Node: OFMT301453
+Node: Printf302809
+Node: Basic Printf303594
+Node: Control Letters305168
+Node: Format Modifiers310330
+Node: Printf Examples316345
+Node: Redirection318831
+Node: Special FD325672
+Ref: Special FD-Footnote-1328840
+Node: Special Files328914
+Node: Other Inherited Files329531
+Node: Special Network330532
+Node: Special Caveats331392
+Node: Close Files And Pipes332341
+Ref: table-close-pipe-return-values339248
+Ref: Close Files And Pipes-Footnote-1340061
+Ref: Close Files And Pipes-Footnote-2340209
+Node: Nonfatal340361
+Node: Output Summary342699
+Node: Output Exercises343921
+Node: Expressions344600
+Node: Values345788
+Node: Constants346466
+Node: Scalar Constants347157
+Ref: Scalar Constants-Footnote-1349667
+Node: Nondecimal-numbers349917
+Node: Regexp Constants352918
+Node: Using Constant Regexps353444
+Node: Standard Regexp Constants354066
+Node: Strong Regexp Constants357254
+Node: Variables360967
+Node: Using Variables361624
+Node: Assignment Options363534
+Node: Conversion366005
+Node: Strings And Numbers366529
+Ref: Strings And Numbers-Footnote-1369592
+Node: Locale influences conversions369701
+Ref: table-locale-affects372459
+Node: All Operators373077
+Node: Arithmetic Ops373706
+Node: Concatenation376422
+Ref: Concatenation-Footnote-1379269
+Node: Assignment Ops379376
+Ref: table-assign-ops384367
+Node: Increment Ops385680
+Node: Truth Values and Conditions389140
+Node: Truth Values390214
+Node: Typing and Comparison391262
+Node: Variable Typing392082
+Ref: Variable Typing-Footnote-1398545
+Ref: Variable Typing-Footnote-2398617
+Node: Comparison Operators398694
+Ref: table-relational-ops399113
+Node: POSIX String Comparison402608
+Ref: POSIX String Comparison-Footnote-1404303
+Ref: POSIX String Comparison-Footnote-2404442
+Node: Boolean Ops404526
+Ref: Boolean Ops-Footnote-1409008
+Node: Conditional Exp409100
+Node: Function Calls410836
+Node: Precedence414713
+Node: Locales418372
+Node: Expressions Summary420004
+Node: Patterns and Actions422577
+Node: Pattern Overview423697
+Node: Regexp Patterns425374
+Node: Expression Patterns425916
+Node: Ranges429697
+Node: BEGIN/END432805
+Node: Using BEGIN/END433566
+Ref: Using BEGIN/END-Footnote-1436320
+Node: I/O And BEGIN/END436426
+Node: BEGINFILE/ENDFILE438739
+Node: Empty441970
+Node: Using Shell Variables442287
+Node: Action Overview444561
+Node: Statements446886
+Node: If Statement448734
+Node: While Statement450229
+Node: Do Statement452257
+Node: For Statement453405
+Node: Switch Statement456576
+Node: Break Statement459017
+Node: Continue Statement461109
+Node: Next Statement462936
+Node: Nextfile Statement465319
+Node: Exit Statement468008
+Node: Built-in Variables470411
+Node: User-modified471544
+Node: Auto-set479311
+Ref: Auto-set-Footnote-1496118
+Ref: Auto-set-Footnote-2496324
+Node: ARGC and ARGV496380
+Node: Pattern Action Summary500593
+Node: Arrays503023
+Node: Array Basics504352
+Node: Array Intro505196
+Ref: figure-array-elements507171
+Ref: Array Intro-Footnote-1509875
+Node: Reference to Elements510003
+Node: Assigning Elements512467
+Node: Array Example512958
+Node: Scanning an Array514717
+Node: Controlling Scanning517739
+Ref: Controlling Scanning-Footnote-1524195
+Node: Numeric Array Subscripts524511
+Node: Uninitialized Subscripts526695
+Node: Delete528314
+Ref: Delete-Footnote-1531066
+Node: Multidimensional531123
+Node: Multiscanning534218
+Node: Arrays of Arrays535809
+Node: Arrays Summary540577
+Node: Functions542670
+Node: Built-in543708
+Node: Calling Built-in544861
+Node: Boolean Functions546857
+Node: Numeric Functions547411
+Ref: Numeric Functions-Footnote-1551438
+Ref: Numeric Functions-Footnote-2552086
+Ref: Numeric Functions-Footnote-3552134
+Node: String Functions552406
+Ref: String Functions-Footnote-1576921
+Ref: String Functions-Footnote-2577049
+Ref: String Functions-Footnote-3577297
+Node: Gory Details577384
+Ref: table-sub-escapes579175
+Ref: table-sub-proposed580694
+Ref: table-posix-sub582057
+Ref: table-gensub-escapes583598
+Ref: Gory Details-Footnote-1584421
+Node: I/O Functions584575
+Ref: table-system-return-values591029
+Ref: I/O Functions-Footnote-1593109
+Ref: I/O Functions-Footnote-2593257
+Node: Time Functions593377
+Ref: Time Functions-Footnote-1604048
+Ref: Time Functions-Footnote-2604116
+Ref: Time Functions-Footnote-3604274
+Ref: Time Functions-Footnote-4604385
+Ref: Time Functions-Footnote-5604497
+Ref: Time Functions-Footnote-6604724
+Node: Bitwise Functions604990
+Ref: table-bitwise-ops605584
+Ref: Bitwise Functions-Footnote-1611647
+Ref: Bitwise Functions-Footnote-2611820
+Node: Type Functions612011
+Node: I18N Functions615621
+Node: User-defined617272
+Node: Definition Syntax618084
+Ref: Definition Syntax-Footnote-1623778
+Node: Function Example623849
+Ref: Function Example-Footnote-1626771
+Node: Function Calling626793
+Node: Calling A Function627381
+Node: Variable Scope628339
+Node: Pass By Value/Reference631333
+Node: Function Caveats633977
+Ref: Function Caveats-Footnote-1636024
+Node: Return Statement636144
+Node: Dynamic Typing639123
+Node: Indirect Calls640053
+Ref: Indirect Calls-Footnote-1650308
+Node: Functions Summary650436
+Node: Library Functions653141
+Ref: Library Functions-Footnote-1656748
+Ref: Library Functions-Footnote-2656891
+Node: Library Names657062
+Ref: Library Names-Footnote-1660729
+Ref: Library Names-Footnote-2660952
+Node: General Functions661038
+Node: Strtonum Function662220
+Node: Assert Function665242
+Node: Round Function668568
+Node: Cliff Random Function670108
+Node: Ordinal Functions671124
+Ref: Ordinal Functions-Footnote-1674187
+Ref: Ordinal Functions-Footnote-2674439
+Node: Join Function674649
+Ref: Join Function-Footnote-1676419
+Node: Getlocaltime Function676619
+Node: Readfile Function680361
+Node: Shell Quoting682338
+Node: Isnumeric Function683766
+Node: Data File Management685154
+Node: Filetrans Function685786
+Node: Rewind Function689882
+Node: File Checking691791
+Ref: File Checking-Footnote-1693125
+Node: Empty Files693326
+Node: Ignoring Assigns695305
+Node: Getopt Function696855
+Ref: Getopt Function-Footnote-1712078
+Node: Passwd Functions712278
+Ref: Passwd Functions-Footnote-1721117
+Node: Group Functions721205
+Ref: Group Functions-Footnote-1729103
+Node: Walking Arrays729310
+Node: Library Functions Summary732318
+Node: Library Exercises733724
+Node: Sample Programs734189
+Node: Running Examples734959
+Node: Clones735687
+Node: Cut Program736911
+Node: Egrep Program747051
+Node: Id Program756052
+Node: Split Program765999
+Ref: Split Program-Footnote-1775892
+Node: Tee Program776065
+Node: Uniq Program778855
+Node: Wc Program786443
+Node: Bytes vs. Characters786830
+Node: Using extensions788378
+Node: wc program789132
+Node: Miscellaneous Programs793997
+Node: Dupword Program795210
+Node: Alarm Program797240
+Node: Translate Program802095
+Ref: Translate Program-Footnote-1806660
+Node: Labels Program806930
+Ref: Labels Program-Footnote-1810281
+Node: Word Sorting810365
+Node: History Sorting814437
+Node: Extract Program816662
+Node: Simple Sed824716
+Node: Igawk Program827790
+Ref: Igawk Program-Footnote-1842121
+Ref: Igawk Program-Footnote-2842323
+Ref: Igawk Program-Footnote-3842445
+Node: Anagram Program842560
+Node: Signature Program845622
+Node: Programs Summary846869
+Node: Programs Exercises848083
+Ref: Programs Exercises-Footnote-1852213
+Node: Advanced Features852299
+Node: Nondecimal Data854430
+Node: Boolean Typed Values856028
+Node: Array Sorting857909
+Node: Controlling Array Traversal858614
+Ref: Controlling Array Traversal-Footnote-1866982
+Node: Array Sorting Functions867100
+Ref: Array Sorting Functions-Footnote-1872474
+Node: Two-way I/O872670
+Ref: Two-way I/O-Footnote-1880396
+Ref: Two-way I/O-Footnote-2880583
+Node: TCP/IP Networking880665
+Node: Profiling883783
+Node: Extension Philosophy893092
+Node: Advanced Features Summary894571
+Node: Internationalization896586
+Node: I18N and L10N898260
+Node: Explaining gettext898947
+Ref: Explaining gettext-Footnote-1904839
+Ref: Explaining gettext-Footnote-2905024
+Node: Programmer i18n905189
+Ref: Programmer i18n-Footnote-1910138
+Node: Translator i18n910187
+Node: String Extraction910981
+Ref: String Extraction-Footnote-1912113
+Node: Printf Ordering912199
+Ref: Printf Ordering-Footnote-1914985
+Node: I18N Portability915049
+Ref: I18N Portability-Footnote-1917505
+Node: I18N Example917568
+Ref: I18N Example-Footnote-1920843
+Ref: I18N Example-Footnote-2920916
+Node: Gawk I18N921025
+Node: I18N Summary921674
+Node: Debugger923015
+Node: Debugging924015
+Node: Debugging Concepts924456
+Node: Debugging Terms926265
+Node: Awk Debugging928840
+Ref: Awk Debugging-Footnote-1929785
+Node: Sample Debugging Session929917
+Node: Debugger Invocation930451
+Node: Finding The Bug931837
+Node: List of Debugger Commands938311
+Node: Breakpoint Control939644
+Node: Debugger Execution Control943338
+Node: Viewing And Changing Data946700
+Node: Execution Stack950241
+Node: Debugger Info951878
+Node: Miscellaneous Debugger Commands955949
+Node: Readline Support961011
+Node: Limitations961907
+Node: Debugging Summary964461
+Node: Namespaces965740
+Node: Global Namespace966851
+Node: Qualified Names968249
+Node: Default Namespace969248
+Node: Changing The Namespace969989
+Node: Naming Rules971603
+Node: Internal Name Management973451
+Node: Namespace Example974493
+Node: Namespace And Features977055
+Node: Namespace Summary978490
+Node: Arbitrary Precision Arithmetic979967
+Node: Computer Arithmetic981454
+Ref: table-numeric-ranges985220
+Ref: table-floating-point-ranges985713
+Ref: Computer Arithmetic-Footnote-1986371
+Node: Math Definitions986428
+Ref: table-ieee-formats989404
+Node: MPFR features989971
+Node: FP Math Caution991689
+Ref: FP Math Caution-Footnote-1992761
+Node: Inexactness of computations993130
+Node: Inexact representation994161
+Node: Comparing FP Values995521
+Node: Errors accumulate996762
+Node: Strange values998218
+Ref: Strange values-Footnote-11000806
+Node: Getting Accuracy1000911
+Node: Try To Round1003621
+Node: Setting precision1004520
+Ref: table-predefined-precision-strings1005217
+Node: Setting the rounding mode1007047
+Ref: table-gawk-rounding-modes1007421
+Ref: Setting the rounding mode-Footnote-11011352
+Node: Arbitrary Precision Integers1011531
+Ref: Arbitrary Precision Integers-Footnote-11014706
+Node: Checking for MPFR1014855
+Node: POSIX Floating Point Problems1016329
+Ref: POSIX Floating Point Problems-Footnote-11020614
+Node: Floating point summary1020652
+Node: Dynamic Extensions1022842
+Node: Extension Intro1024395
+Node: Plugin License1025661
+Node: Extension Mechanism Outline1026458
+Ref: figure-load-extension1026897
+Ref: figure-register-new-function1028462
+Ref: figure-call-new-function1029554
+Node: Extension API Description1031616
+Node: Extension API Functions Introduction1033329
+Ref: table-api-std-headers1035165
+Node: General Data Types1039414
+Ref: General Data Types-Footnote-11048120
+Node: Memory Allocation Functions1048419
+Ref: Memory Allocation Functions-Footnote-11052920
+Node: Constructor Functions1053019
+Node: API Ownership of MPFR and GMP Values1056672
+Node: Registration Functions1057985
+Node: Extension Functions1058685
+Node: Exit Callback Functions1064007
+Node: Extension Version String1065257
+Node: Input Parsers1065920
+Node: Output Wrappers1078641
+Node: Two-way processors1083153
+Node: Printing Messages1085418
+Ref: Printing Messages-Footnote-11086589
+Node: Updating ERRNO1086742
+Node: Requesting Values1087481
+Ref: table-value-types-returned1088218
+Node: Accessing Parameters1089326
+Node: Symbol Table Access1090563
+Node: Symbol table by name1091075
+Ref: Symbol table by name-Footnote-11094100
+Node: Symbol table by cookie1094228
+Ref: Symbol table by cookie-Footnote-11098413
+Node: Cached values1098477
+Ref: Cached values-Footnote-11102013
+Node: Array Manipulation1102166
+Ref: Array Manipulation-Footnote-11103257
+Node: Array Data Types1103294
+Ref: Array Data Types-Footnote-11105952
+Node: Array Functions1106044
+Node: Flattening Arrays1110542
+Node: Creating Arrays1117518
+Node: Redirection API1122285
+Node: Extension API Variables1125118
+Node: Extension Versioning1125829
+Ref: gawk-api-version1126258
+Node: Extension GMP/MPFR Versioning1127989
+Node: Extension API Informational Variables1129617
+Node: Extension API Boilerplate1130690
+Node: Changes from API V11134664
+Node: Finding Extensions1136236
+Node: Extension Example1136795
+Node: Internal File Description1137593
+Node: Internal File Ops1141673
+Ref: Internal File Ops-Footnote-11153023
+Node: Using Internal File Ops1153163
+Ref: Using Internal File Ops-Footnote-11155546
+Node: Extension Samples1155820
+Node: Extension Sample File Functions1157349
+Node: Extension Sample Fnmatch1164998
+Node: Extension Sample Fork1166485
+Node: Extension Sample Inplace1167703
+Node: Extension Sample Ord1171329
+Node: Extension Sample Readdir1172165
+Ref: table-readdir-file-types1173054
+Node: Extension Sample Revout1174121
+Node: Extension Sample Rev2way1174710
+Node: Extension Sample Read write array1175450
+Node: Extension Sample Readfile1177392
+Node: Extension Sample Time1178487
+Node: Extension Sample API Tests1180239
+Node: gawkextlib1180731
+Node: Extension summary1183649
+Node: Extension Exercises1187351
+Node: Language History1188593
+Node: V7/SVR3.11190249
+Node: SVR41192401
+Node: POSIX1193835
+Node: BTL1195216
+Node: POSIX/GNU1195945
+Node: Feature History1201723
+Node: Common Extensions1218898
+Node: Ranges and Locales1220181
+Ref: Ranges and Locales-Footnote-11224797
+Ref: Ranges and Locales-Footnote-21224824
+Ref: Ranges and Locales-Footnote-31225059
+Node: Contributors1225282
+Node: History summary1231279
+Node: Installation1232659
+Node: Gawk Distribution1233603
+Node: Getting1234087
+Node: Extracting1235050
+Node: Distribution contents1236688
+Node: Unix Installation1243830
+Node: Quick Installation1244634
+Node: Compiling with MPFR1247110
+Node: Shell Startup Files1247802
+Node: Additional Configuration Options1248891
+Node: Configuration Philosophy1251206
+Node: Compiling from Git1253602
+Node: Building the Documentation1254157
+Node: Non-Unix Installation1255541
+Node: PC Installation1256001
+Node: PC Binary Installation1256839
+Node: PC Compiling1257274
+Node: PC Using1258391
+Node: Cygwin1261944
+Node: MSYS1263168
+Node: VMS Installation1263770
+Node: VMS Compilation1264489
+Ref: VMS Compilation-Footnote-11265718
+Node: VMS Dynamic Extensions1265776
+Node: VMS Installation Details1267461
+Node: VMS Running1269723
+Node: VMS GNV1274002
+Node: Bugs1274716
+Node: Bug definition1275628
+Node: Bug address1278132
+Node: Usenet1281520
+Node: Performance bugs1282529
+Node: Asking for help1285450
+Node: Maintainers1287412
+Node: Other Versions1288606
+Node: Installation summary1296458
+Node: Notes1297822
+Node: Compatibility Mode1298616
+Node: Additions1299398
+Node: Accessing The Source1300323
+Node: Adding Code1301760
+Node: New Ports1307979
+Node: Derived Files1312354
+Ref: Derived Files-Footnote-11318014
+Ref: Derived Files-Footnote-21318049
+Ref: Derived Files-Footnote-31318647
+Node: Future Extensions1318761
+Node: Implementation Limitations1319419
+Node: Extension Design1320629
+Node: Old Extension Problems1321773
+Ref: Old Extension Problems-Footnote-11323291
+Node: Extension New Mechanism Goals1323348
+Ref: Extension New Mechanism Goals-Footnote-11326712
+Node: Extension Other Design Decisions1326901
+Node: Extension Future Growth1329014
+Node: Notes summary1329620
+Node: Basic Concepts1330778
+Node: Basic High Level1331459
+Ref: figure-general-flow1331741
+Ref: figure-process-flow1332426
+Ref: Basic High Level-Footnote-11335727
+Node: Basic Data Typing1335912
+Node: Glossary1339240
+Node: Copying1371127
+Node: GNU Free Documentation License1408670
+Node: Index1433790

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index c7099447..349abd15 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -755,6 +755,8 @@ particular records in a file and perform operations upon them.
* Arrays Summary:: Summary of arrays.
* Built-in:: Summarizes the built-in functions.
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean
+ values.
* Numeric Functions:: Functions that work with numbers,
including @code{int()}, @code{sin()}
and @code{rand()}.
@@ -864,6 +866,7 @@ particular records in a file and perform operations upon them.
* Programs Summary:: Summary of programs.
* Programs Exercises:: Exercises.
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with @code{number|bool} type.
* Array Sorting:: Facilities for controlling array
traversal and sorting arrays.
* Controlling Array Traversal:: How to use PROCINFO["sorted_in"].
@@ -927,6 +930,7 @@ particular records in a file and perform operations upon them.
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.
* Getting Accuracy:: Getting more accuracy takes some work.
* Try To Round:: Add digits and round.
* Setting precision:: How to set the precision.
@@ -3148,11 +3152,12 @@ column means that the person is a friend.
An @samp{R} means that the person is a relative:
@example
-@c system if test ! -d eg ; then mkdir eg ; fi
-@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
-@c system if test ! -d eg/data ; then mkdir eg/data ; fi
-@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
-@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg ; then mkdir eg ; fi
+@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
+@c system if test ! -d eg/data ; then mkdir eg/data ; fi
+@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
+@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg/test-programs ; then mkdir eg/test-programs ; fi
@c file eg/data/mail-list
Amelia 555-5553 amelia.zodiacusque@@gmail.com F
Anthony 555-3412 anthony.asserturo@@hotmail.com A
@@ -4852,7 +4857,10 @@ blocksize, which is usually the filesystem's I/O blocksize.)
If this variable exists with a value of @samp{gst}, @command{gawk}
switches to using the hash function from GNU Smalltalk for
managing arrays.
-This function may be marginally faster than the standard function.
+With a value of @samp{fnv1a}, @command{gawk} uses the
+@uref{http://www.isthe.com/chongo/tech/comp/fnv/index.html,
+FNV1-A hash function}.
+These functions may be marginally faster than the standard function.
@item AWKREADFUNC
If this variable exists, @command{gawk} switches to reading source
@@ -10227,7 +10235,7 @@ infinity are formatted as
and positive infinity as
@samp{inf} or @samp{infinity}.
The special ``not a number'' value formats as @samp{-nan} or @samp{nan}
-(@pxref{Math Definitions}).
+(@pxref{Strange values}).
@item @code{%F}
Like @samp{%f}, but the infinity and ``not a number'' values are spelled
@@ -18356,6 +18364,7 @@ but are summarized here for your convenience.
@menu
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean values.
* Numeric Functions:: Functions that work with numbers, including
@code{int()}, @code{sin()} and @code{rand()}.
* String Functions:: Functions for string manipulation, such as
@@ -18425,6 +18434,25 @@ and 12. But if the order of evaluation is right to left, @code{i}
first becomes 10, then 11, and @code{atan2()} is called with the
two arguments 11 and 10.
+
+@node Boolean Functions
+@subsection Generating Boolean Values
+@cindex boolean function
+
+This function is specific to @command{gawk}. It is not
+available in compatibility mode (@pxref{Options}):
+
+@c @asis for docbook
+@table @asis
+@item @code{mkbool(@var{expression})}
+@cindexgawkfunc{mkbool}
+Return a Boolean-typed value based on the regular Boolean value
+of @var{expression}. Boolean ``true'' values have numeric value one.
+Boolean ``false'' values have numeric
+zero. This is discussed in more
+detail in @ref{Boolean Typed Values}.
+@end table
+
@node Numeric Functions
@subsection Numeric Functions
@cindex numeric @subentry functions
@@ -18489,7 +18517,7 @@ compatibility mode (@pxref{Options}).
@cindexawkfunc{log}
@cindex logarithm
Return the natural logarithm of @var{x}, if @var{x} is positive;
-otherwise, return @code{NaN} (``not a number'') on IEEE 754 systems.
+otherwise, return NaN (``not a number'') on IEEE 754 systems.
Additionally, @command{gawk} prints a warning message when @code{x}
is negative.
@@ -20954,6 +20982,9 @@ Return one of the following strings, depending upon the type of @var{x}:
@item "number"
@var{x} is a number.
+@item "number|bool"
+@var{x} is a Boolean typed value (@pxref{Boolean Typed Values}).
+
@item "string"
@var{x} is a string.
@@ -21855,7 +21886,7 @@ being aware of them.
@cindex pointers to functions
@cindex differences in @command{awk} and @command{gawk} @subentry indirect function calls
-This section describes an advanced, @command{gawk}-specific extension.
+This @value{SECTION} describes an advanced, @command{gawk}-specific extension.
Often, you may wish to defer the choice of function to call until runtime.
For example, you may have different kinds of records, each of which
@@ -29506,6 +29537,7 @@ discusses the ability to dynamically add new built-in functions to
@menu
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with @code{number|bool} type.
* Array Sorting:: Facilities for controlling array traversal and
sorting arrays.
* Two-way I/O:: Two-way communications with another process.
@@ -29572,6 +29604,49 @@ leads to less surprising results.
This option may disappear in a future version of @command{gawk}.
@end quotation
+@node Boolean Typed Values
+@section Boolean Typed Values
+
+Scalar values in @command{awk} are either numbers or strings.
+@command{gawk} also supports values of type @code{regexp}
+(@pxref{Strong Regexp Constants}).
+
+As described in @ref{Truth Values}, Boolean values in @command{awk}
+don't have a separate type: a value counts as ``true'' if it is nonzero
+or non-null, and as ``false'' otherwise.
+
+When interchanging data with languages that do have a real Boolean type,
+using a standard format such as JSON or XML, the lack of a true Boolean
+type in @command{awk} is problematic.
+(See, for example, the @code{json} extension provided by
+@uref{https://sourceforge.net/projects/gawkextlib, the @code{gawkextlib} project}.)
+
+It's easy to import Boolean data into @command{awk}, but then the fact
+that it was originally Boolean is lost. Exporting data is even harder;
+there's no way to indicate that a value is really Boolean.
+
+To solve this problem, @command{gawk} provides a function named @code{mkbool()}.
+It takes one argument, which is any @command{awk} expression, and it
+returns a value of Boolean type.
+
+The returned values are normal @command{awk} numeric values, with
+values of either one or zero,
+depending upon the truth
+value of the original expression passed in the call to @code{mkbool()}.
+
+The @code{typeof()} function (@pxref{Type Functions}) returns
+@code{"number|bool"} for these values.
+
+Thus Boolean-typed values @emph{are} numbers as far as @command{gawk}
+is concerned, except that extension code can treat them as Booleans
+if desired.
+
+While it would have been possible to add two new built-in variables
+of Boolean type named @code{TRUE} and @code{FALSE}, doing so would
+undoubtedly have broken many existing @command{awk} programs. Instead,
+having a ``generator'' function that creates Boolean values gives
+flexibility, without breaking as much existing code.
+
@node Array Sorting
@section Controlling Array Traversal and Array Sorting
@@ -33926,21 +34001,9 @@ A special value representing infinity. Operations involving another
number and infinity produce infinity.
@item NaN
-``Not a number.''@footnote{Thanks to Michael Brennan for this description,
-which we have paraphrased, and for the examples.} A special value that
-results from attempting a calculation that has no answer as a real number.
-In such a case, programs can either receive a floating-point exception,
-or get @code{NaN} back as the result. The IEEE 754 standard recommends
-that systems return @code{NaN}. Some examples:
-
-@table @code
-@item sqrt(-1)
-This makes sense in the range of complex numbers, but not in the
-range of real numbers, so the result is @code{NaN}.
-
-@item log(-8)
-@minus{}8 is out of the domain of @code{log()}, so the result is @code{NaN}.
-@end table
+``Not a number.'' A special value that results from attempting a
+calculation that has no answer as a real number. @xref{Strange values},
+for more information about infinity and not-a-number values.
@item Normalized
How the significand (see later in this list) is usually stored. The
@@ -34109,6 +34172,7 @@ decimal places in the final result.
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.
@end menu
@node Inexact representation
@@ -34230,6 +34294,242 @@ $ @kbd{gawk 'BEGIN @{}
@print{} 4
@end example
+@node Strange values
+@subsubsection Floating Point Values They Didn't Talk About In School
+
+Both IEEE 754 floating-point hardware, and MPFR, support two kinds of
+values that you probably didn't learn about in school. The first is
+@dfn{infinity}, a special value, that can be either negative or positive,
+and which is either smaller than any other value (negative infinity),
+or larger than any other value (positive infinity). When such values
+are generated, @command{gawk} prints them as either @samp{-inf} or
+@samp{+inf}, respectively. It accepts those strings as data input and
+converts them to the proper floating-point values internally.
+
+Infinity values of the same sign compare as equal to each other.
+Otherwise, operations (addition, subtraction, etc.) involving another
+number and infinity produce mathematically reasonable results.
+
+The second kind of value is ``not a number'', or NaN for
+short.@footnote{Thanks to Michael Brennan for this description, which we
+have paraphrased, and for the examples.} This is a special value that results
+from attempting a calculation that has no answer as a real number.
+In such a case, programs can either receive a floating-point exception,
+or get NaN back as the result. The IEEE 754 standard recommends
+that systems return NaN. Some examples:
+
+@table @code
+@item sqrt(-1)
+@iftex
+The @math{\sqrt{-1}}
+@end iftex
+@ifnottex
+This
+@end ifnottex
+makes sense in the range of complex numbers, but not in the
+range of real numbers, so the result is NaN.
+
+@item log(-8)
+@minus{}8 is out of the domain of @code{log()}, so the result is NaN.
+@end table
+
+NaN values are strange. In particular, they cannot be compared with other
+floating point values; any such comparison, except for ``is not equal
+to'', returns false. NaN values are so much unequal to other values that
+even comparing two identical NaN values with @code{!=} returns true!
+
+NaN values can also be signed, although it depends upon the implementation
+as to which sign you get for any operation that returns a NaN. For
+example, on some systems, @code{sqrt(-1)} returns a negative NaN. On
+others, it returns a positive NaN.
+
+When such values are generated, @command{gawk} prints them as either
+@samp{-nan} or @samp{+nan}, respectively. Here too, @command{gawk}
+accepts those strings as data input and converts them to the proper
+floating-point values internally.
+
+If you want to dive more deeply into this topic, you can find
+test programs in C, @command{awk} and Python in the directory
+@file{awklib/eg/test-programs} in the @command{gawk} distribution.
+These programs enable comparison among programming languages as to how
+they handle NaN and infinity values.
+
+@ignore
+@c file eg/test-programs/gen-float-table.awk
+function eq(left, right)
+@{
+ return left == right
+@}
+
+function ne(left, right)
+@{
+ return left != right
+@}
+
+function lt(left, right)
+@{
+ return left < right
+@}
+
+function le(left, right)
+@{
+ return left <= right
+@}
+
+function gt(left, right)
+@{
+ return left > right
+@}
+
+function ge(left, right)
+@{
+ return left >= right
+@}
+
+BEGIN @{
+ nan = sqrt(-1)
+ inf = -log(0)
+ split("== != < <= > >=", names)
+ names[3] = names[3] " "
+ names[5] = names[5] " "
+ split("eq ne lt le gt ge", funcs)
+
+ compare[1] = 2.0
+ compare[2] = values[1] = -sqrt(-1.0) # nan
+ compare[3] = values[2] = sqrt(-1.0) # -nan
+ compare[4] = values[3] = -log(0.0) # inf
+ compare[5] = values[4] = log(0.0) # -inf
+
+ for (i = 1; i in values; i++) @{
+ for (j = 1; j in compare; j++) @{
+ for (k = 1; k in names; k++) @{
+ the_func = funcs[k]
+ printf("%g %s %g -> %s\n",
+ values[i],
+ names[k],
+ compare[j],
+ @@the_func(values[i], compare[j]) ?
+ "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.c
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+#define def_func(name, op) \
+ bool name(double left, double right) @{ \
+ return left op right; \
+ @}
+
+def_func(eq, ==)
+def_func(ne, !=)
+def_func(lt, <)
+def_func(le, <=)
+def_func(gt, >)
+def_func(ge, >=)
+
+struct @{
+ const char *name;
+ bool (*func)(double left, double right);
+@} functions[] = @{
+ @{ "==", eq @},
+ @{ "!=", ne @},
+ @{ "< ", lt @},
+ @{ "<=", le @},
+ @{ "> ", gt @},
+ @{ ">=", ge @},
+ @{ 0, 0 @}
+@};
+
+int main()
+@{
+ double values[] = @{
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+ double compare[] = @{ 2.0,
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+
+ int i, j, k;
+
+ for (i = 0; i < 4; i++) @{
+ for (j = 0; j < 5; j++) @{
+ for (k = 0; functions[k].name != NULL; k++) @{
+ printf("%g %s %g -> %s\n", values[i],
+ functions[k].name,
+ compare[j],
+ functions[k].func(values[i], compare[j]) ? "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+
+ return 0;
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.py
+from math import *
+
+nan = float('NaN')
+inf = float('Inf')
+
+def eq(left, right):
+ return left == right
+
+def ne(left, right):
+ return left != right
+
+def lt(left, right):
+ return left < right
+
+def le(left, right):
+ return left <= right
+
+def gt(left, right):
+ return left > right
+
+def ge(left, right):
+ return left >= right
+
+func_map = {
+ "==": eq,
+ "!=": ne,
+ "< ": lt,
+ "<=": le,
+ "> ": gt,
+ ">=": ge,
+}
+
+compare = [2.0, nan, -nan, inf, -inf]
+values = [nan, -nan, inf, -inf]
+
+for i in range(len(values)):
+ for j in range(len(compare)):
+ for op in func_map:
+ print("%g %s %g -> %s" %
+ (values[i], op, compare[j], func_map[op](values[i], compare[j])))
+
+ print("")
+@c endfile
+@end ignore
+
@node Getting Accuracy
@subsection Getting the Accuracy You Need
@@ -35501,7 +35801,8 @@ multibyte encoding.
@itemx @ @ @ @ AWK_STRNUM,
@itemx @ @ @ @ AWK_ARRAY,
@itemx @ @ @ @ AWK_SCALAR,@ @ @ @ @ @ @ @ @ /* opaque access to a variable */
-@itemx @ @ @ @ AWK_VALUE_COOKIE@ @ @ @ /* for updating a previously created value */
+@itemx @ @ @ @ AWK_VALUE_COOKIE,@ @ @ /* for updating a previously created value */
+@itemx @ @ @ @ AWK_BOOL
@itemx @} awk_valtype_t;
This @code{enum} indicates the type of a value.
It is used in the following @code{struct}.
@@ -35514,6 +35815,7 @@ It is used in the following @code{struct}.
@itemx @ @ @ @ @ @ @ @ awk_array_t@ @ @ @ @ @ @ @ a;
@itemx @ @ @ @ @ @ @ @ awk_scalar_t@ @ @ @ @ @ @ scl;
@itemx @ @ @ @ @ @ @ @ awk_value_cookie_t@ vc;
+@itemx @ @ @ @ @ @ @ @ awk_bool_t@ @ @ @ @ @ @ @ @ b;
@itemx @ @ @ @ @} u;
@itemx @} awk_value_t;
An ``@command{awk} value.''
@@ -35529,6 +35831,7 @@ The @code{val_type} member indicates what kind of value the
@itemx #define array_cookie@ @ @ u.a
@itemx #define scalar_cookie@ @ u.scl
@itemx #define value_cookie@ @ @ u.vc
+@itemx #define bool_value@ @ @ @ @ u.b
Using these macros makes accessing the fields of the @code{awk_value_t} more
readable.
@@ -35856,6 +36159,11 @@ the regular expression of length @code{len}. It expects @code{string}
to be a @samp{char *} value pointing to data previously obtained from
@code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}.
+@item static inline awk_value_t *
+@itemx make_bool(awk_bool_t boolval, awk_value_t *result);
+This function creates a boolean value in the @code{awk_value_t} variable
+pointed to by @code{result}.
+
@end table
@node API Ownership of MPFR and GMP Values
@@ -36656,7 +36964,8 @@ value type, as appropriate. This behavior is summarized in
<colspec colname="c6"/>
<colspec colname="c7"/>
<colspec colname="c8"/>
- <spanspec spanname="hspan" namest="c3" nameend="c8" align="center"/>
+ <colspec colname="c9"/>
+ <spanspec spanname="hspan" namest="c3" nameend="c9" align="center"/>
<thead>
<row><entry></entry><entry spanname="hspan"><para>Type of Actual Value</para></entry></row>
<row>
@@ -36666,6 +36975,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Strnum</para></entry>
<entry><para>Number</para></entry>
<entry><para>Regex</para></entry>
+ <entry><para>Bool</para></entry>
<entry><para>Array</para></entry>
<entry><para>Undefined</para></entry>
</row>
@@ -36678,6 +36988,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>String</para></entry>
<entry><para>String</para></entry>
<entry><para>String</para></entry>
+ <entry><para>String</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -36690,6 +37001,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
<row>
<entry></entry>
@@ -36698,6 +37010,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Number</para></entry>
<entry><para>Number</para></entry>
<entry><para>false</para></entry>
+ <entry><para>Number</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -36706,6 +37019,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para><emphasis role="bold">Regex</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Regex</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
@@ -36713,11 +37027,23 @@ value type, as appropriate. This behavior is summarized in
</row>
<row>
<entry><para><emphasis role="bold">Requested</emphasis></para></entry>
+ <entry><para><emphasis role="bold">Bool</emphasis></para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>Bool</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ </row>
+ <row>
+ <entry><para></para></entry>
<entry><para><emphasis role="bold">Array</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Array</para></entry>
<entry><para>false</para></entry>
</row>
@@ -36728,6 +37054,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Scalar</para></entry>
<entry><para>Scalar</para></entry>
<entry><para>Scalar</para></entry>
+ <entry><para>Scalar</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -36738,6 +37065,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Strnum</para></entry>
<entry><para>Number</para></entry>
<entry><para>Regex</para></entry>
+ <entry><para>Bool</para></entry>
<entry><para>Array</para></entry>
<entry><para>Undefined</para></entry>
</row>
@@ -36750,6 +37078,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
</tbody>
</tgroup>
@@ -36766,43 +37095,46 @@ value type, as appropriate. This behavior is summarized in
\vglue-1.1\baselineskip
@end tex
@c @multitable @columnfractions .166 .166 .198 .15 .15 .166
-@multitable {Requested} {Undefined} {Number} {Number} {Scalar} {Regex} {Array} {Undefined}
-@headitem @tab @tab String @tab Strnum @tab Number @tab Regex @tab Array @tab Undefined
-@item @tab @b{String} @tab String @tab String @tab String @tab String @tab false @tab false
-@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false
-@item @tab @b{Number} @tab Number @tab Number @tab Number @tab false @tab false @tab false
-@item @b{Type} @tab @b{Regex} @tab false @tab false @tab false @tab Regex @tab false @tab false
-@item @b{Requested} @tab @b{Array} @tab false @tab false @tab false @tab false @tab Array @tab false
-@item @tab @b{Scalar} @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab false @tab false
-@item @tab @b{Undefined} @tab String @tab Strnum @tab Number @tab Regex @tab Array @tab Undefined
-@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false
+@multitable {Requested} {Undefined} {Number} {Number} {Scalar} {Regex} {Number} {Array} {Undefined}
+@headitem @tab @tab String @tab Strnum @tab Number @tab Regex @tab Bool @tab Array @tab Undefined
+@item @tab @b{String} @tab String @tab String @tab String @tab String @tab String @tab false @tab false
+@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false @tab false
+@item @tab @b{Number} @tab Number @tab Number @tab Number @tab false @tab Number @tab false @tab false
+@item @b{Type} @tab @b{Regex} @tab false @tab false @tab false @tab Regex @tab false @tab false @tab false
+@item @b{Requested} @tab @b{Bool} @tab false @tab false @tab false @tab false @tab Bool @tab false @tab false
+@item @tab @b{Array} @tab false @tab false @tab false @tab false @tab false @tab Array @tab false
+@item @tab @b{Scalar} @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab false @tab false
+@item @tab @b{Undefined} @tab String @tab Strnum @tab Number @tab Regex @tab Bool @tab Array @tab Undefined
+@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false @tab false
@end multitable
@end ifnotdocbook
@end ifnotplaintext
@ifplaintext
@verbatim
- +-------------------------------------------------------+
- | Type of Actual Value: |
- +--------+--------+--------+--------+-------+-----------+
- | String | Strnum | Number | Regex | Array | Undefined |
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
-| | String | String | String | String | String | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Strnum | false | Strnum | Strnum | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Number | Number | Number | Number | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Regex | false | false | false | Regex | false | false |
-| Type +-----------+--------+--------+--------+--------+-------+-----------+
-| Requested | Array | false | false | false | false | Array | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Undefined | String | Strnum | Number | Regex | Array | Undefined |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Value | false | false | false | false | false | false |
-| | Cookie | | | | | | |
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
+ +----------------------------------------------------------------+
+ | Type of Actual Value: |
+ +--------+--------+--------+--------+--------+-------+-----------+
+ | String | Strnum | Number | Regex | Bool | Array | Undefined |
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | String | String | String | String | String | String | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Strnum | false | Strnum | Strnum | false | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Number | Number | Number | Number | false | Number | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Regex | false | false | false | Regex | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| Type | Bool | false | false | false | false | Bool | false | false |
+| Requested +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Array | false | false | false | false | false | Array | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Scalar | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Undefined | String | Strnum | Number | Regex | Bool | Array | Undefined |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Value | false | false | false | false | false | false | false |
+| | Cookie | | | | | | | |
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
@end verbatim
@end ifplaintext
@end float
@@ -45457,8 +45789,8 @@ internationalized program to work in a particular language.
@item Logical Expression
An expression using the operators for logic, AND, OR, and NOT, written
-@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called Boolean
-expressions, after the mathematician who pioneered this kind of
+@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called @dfn{Boolean
+expressions}, after the mathematician who pioneered this kind of
mathematical logic.
@item Lvalue
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index d874549e..abe5a236 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -750,6 +750,8 @@ particular records in a file and perform operations upon them.
* Arrays Summary:: Summary of arrays.
* Built-in:: Summarizes the built-in functions.
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean
+ values.
* Numeric Functions:: Functions that work with numbers,
including @code{int()}, @code{sin()}
and @code{rand()}.
@@ -859,6 +861,7 @@ particular records in a file and perform operations upon them.
* Programs Summary:: Summary of programs.
* Programs Exercises:: Exercises.
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with @code{number|bool} type.
* Array Sorting:: Facilities for controlling array
traversal and sorting arrays.
* Controlling Array Traversal:: How to use PROCINFO["sorted_in"].
@@ -922,6 +925,7 @@ particular records in a file and perform operations upon them.
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.
* Getting Accuracy:: Getting more accuracy takes some work.
* Try To Round:: Add digits and round.
* Setting precision:: How to set the precision.
@@ -3058,11 +3062,12 @@ column means that the person is a friend.
An @samp{R} means that the person is a relative:
@example
-@c system if test ! -d eg ; then mkdir eg ; fi
-@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
-@c system if test ! -d eg/data ; then mkdir eg/data ; fi
-@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
-@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg ; then mkdir eg ; fi
+@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
+@c system if test ! -d eg/data ; then mkdir eg/data ; fi
+@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
+@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg/test-programs ; then mkdir eg/test-programs ; fi
@c file eg/data/mail-list
Amelia 555-5553 amelia.zodiacusque@@gmail.com F
Anthony 555-3412 anthony.asserturo@@hotmail.com A
@@ -4718,7 +4723,10 @@ blocksize, which is usually the filesystem's I/O blocksize.)
If this variable exists with a value of @samp{gst}, @command{gawk}
switches to using the hash function from GNU Smalltalk for
managing arrays.
-This function may be marginally faster than the standard function.
+With a value of @samp{fnv1a}, @command{gawk} uses the
+@uref{http://www.isthe.com/chongo/tech/comp/fnv/index.html,
+FNV1-A hash function}.
+These functions may be marginally faster than the standard function.
@item AWKREADFUNC
If this variable exists, @command{gawk} switches to reading source
@@ -9696,7 +9704,7 @@ infinity are formatted as
and positive infinity as
@samp{inf} or @samp{infinity}.
The special ``not a number'' value formats as @samp{-nan} or @samp{nan}
-(@pxref{Math Definitions}).
+(@pxref{Strange values}).
@item @code{%F}
Like @samp{%f}, but the infinity and ``not a number'' values are spelled
@@ -17497,6 +17505,7 @@ but are summarized here for your convenience.
@menu
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean values.
* Numeric Functions:: Functions that work with numbers, including
@code{int()}, @code{sin()} and @code{rand()}.
* String Functions:: Functions for string manipulation, such as
@@ -17566,6 +17575,25 @@ and 12. But if the order of evaluation is right to left, @code{i}
first becomes 10, then 11, and @code{atan2()} is called with the
two arguments 11 and 10.
+
+@node Boolean Functions
+@subsection Generating Boolean Values
+@cindex boolean function
+
+This function is specific to @command{gawk}. It is not
+available in compatibility mode (@pxref{Options}):
+
+@c @asis for docbook
+@table @asis
+@item @code{mkbool(@var{expression})}
+@cindexgawkfunc{mkbool}
+Return a Boolean-typed value based on the regular Boolean value
+of @var{expression}. Boolean ``true'' values have numeric value one.
+Boolean ``false'' values have numeric
+zero. This is discussed in more
+detail in @ref{Boolean Typed Values}.
+@end table
+
@node Numeric Functions
@subsection Numeric Functions
@cindex numeric @subentry functions
@@ -17630,7 +17658,7 @@ compatibility mode (@pxref{Options}).
@cindexawkfunc{log}
@cindex logarithm
Return the natural logarithm of @var{x}, if @var{x} is positive;
-otherwise, return @code{NaN} (``not a number'') on IEEE 754 systems.
+otherwise, return NaN (``not a number'') on IEEE 754 systems.
Additionally, @command{gawk} prints a warning message when @code{x}
is negative.
@@ -19866,6 +19894,9 @@ Return one of the following strings, depending upon the type of @var{x}:
@item "number"
@var{x} is a number.
+@item "number|bool"
+@var{x} is a Boolean typed value (@pxref{Boolean Typed Values}).
+
@item "string"
@var{x} is a string.
@@ -20767,7 +20798,7 @@ being aware of them.
@cindex pointers to functions
@cindex differences in @command{awk} and @command{gawk} @subentry indirect function calls
-This section describes an advanced, @command{gawk}-specific extension.
+This @value{SECTION} describes an advanced, @command{gawk}-specific extension.
Often, you may wish to defer the choice of function to call until runtime.
For example, you may have different kinds of records, each of which
@@ -28388,6 +28419,7 @@ discusses the ability to dynamically add new built-in functions to
@menu
* Nondecimal Data:: Allowing nondecimal input data.
+* Boolean Typed Values:: Values with @code{number|bool} type.
* Array Sorting:: Facilities for controlling array traversal and
sorting arrays.
* Two-way I/O:: Two-way communications with another process.
@@ -28454,6 +28486,49 @@ leads to less surprising results.
This option may disappear in a future version of @command{gawk}.
@end quotation
+@node Boolean Typed Values
+@section Boolean Typed Values
+
+Scalar values in @command{awk} are either numbers or strings.
+@command{gawk} also supports values of type @code{regexp}
+(@pxref{Strong Regexp Constants}).
+
+As described in @ref{Truth Values}, Boolean values in @command{awk}
+don't have a separate type: a value counts as ``true'' if it is nonzero
+or non-null, and as ``false'' otherwise.
+
+When interchanging data with languages that do have a real Boolean type,
+using a standard format such as JSON or XML, the lack of a true Boolean
+type in @command{awk} is problematic.
+(See, for example, the @code{json} extension provided by
+@uref{https://sourceforge.net/projects/gawkextlib, the @code{gawkextlib} project}.)
+
+It's easy to import Boolean data into @command{awk}, but then the fact
+that it was originally Boolean is lost. Exporting data is even harder;
+there's no way to indicate that a value is really Boolean.
+
+To solve this problem, @command{gawk} provides a function named @code{mkbool()}.
+It takes one argument, which is any @command{awk} expression, and it
+returns a value of Boolean type.
+
+The returned values are normal @command{awk} numeric values, with
+values of either one or zero,
+depending upon the truth
+value of the original expression passed in the call to @code{mkbool()}.
+
+The @code{typeof()} function (@pxref{Type Functions}) returns
+@code{"number|bool"} for these values.
+
+Thus Boolean-typed values @emph{are} numbers as far as @command{gawk}
+is concerned, except that extension code can treat them as Booleans
+if desired.
+
+While it would have been possible to add two new built-in variables
+of Boolean type named @code{TRUE} and @code{FALSE}, doing so would
+undoubtedly have broken many existing @command{awk} programs. Instead,
+having a ``generator'' function that creates Boolean values gives
+flexibility, without breaking as much existing code.
+
@node Array Sorting
@section Controlling Array Traversal and Array Sorting
@@ -32808,21 +32883,9 @@ A special value representing infinity. Operations involving another
number and infinity produce infinity.
@item NaN
-``Not a number.''@footnote{Thanks to Michael Brennan for this description,
-which we have paraphrased, and for the examples.} A special value that
-results from attempting a calculation that has no answer as a real number.
-In such a case, programs can either receive a floating-point exception,
-or get @code{NaN} back as the result. The IEEE 754 standard recommends
-that systems return @code{NaN}. Some examples:
-
-@table @code
-@item sqrt(-1)
-This makes sense in the range of complex numbers, but not in the
-range of real numbers, so the result is @code{NaN}.
-
-@item log(-8)
-@minus{}8 is out of the domain of @code{log()}, so the result is @code{NaN}.
-@end table
+``Not a number.'' A special value that results from attempting a
+calculation that has no answer as a real number. @xref{Strange values},
+for more information about infinity and not-a-number values.
@item Normalized
How the significand (see later in this list) is usually stored. The
@@ -32991,6 +33054,7 @@ decimal places in the final result.
* Inexact representation:: Numbers are not exactly represented.
* Comparing FP Values:: How to compare floating point values.
* Errors accumulate:: Errors get bigger as they go.
+* Strange values:: A few words about infinities and NaNs.
@end menu
@node Inexact representation
@@ -33112,6 +33176,242 @@ $ @kbd{gawk 'BEGIN @{}
@print{} 4
@end example
+@node Strange values
+@subsubsection Floating Point Values They Didn't Talk About In School
+
+Both IEEE 754 floating-point hardware, and MPFR, support two kinds of
+values that you probably didn't learn about in school. The first is
+@dfn{infinity}, a special value, that can be either negative or positive,
+and which is either smaller than any other value (negative infinity),
+or larger than any other value (positive infinity). When such values
+are generated, @command{gawk} prints them as either @samp{-inf} or
+@samp{+inf}, respectively. It accepts those strings as data input and
+converts them to the proper floating-point values internally.
+
+Infinity values of the same sign compare as equal to each other.
+Otherwise, operations (addition, subtraction, etc.) involving another
+number and infinity produce mathematically reasonable results.
+
+The second kind of value is ``not a number'', or NaN for
+short.@footnote{Thanks to Michael Brennan for this description, which we
+have paraphrased, and for the examples.} This is a special value that results
+from attempting a calculation that has no answer as a real number.
+In such a case, programs can either receive a floating-point exception,
+or get NaN back as the result. The IEEE 754 standard recommends
+that systems return NaN. Some examples:
+
+@table @code
+@item sqrt(-1)
+@iftex
+The @math{\sqrt{-1}}
+@end iftex
+@ifnottex
+This
+@end ifnottex
+makes sense in the range of complex numbers, but not in the
+range of real numbers, so the result is NaN.
+
+@item log(-8)
+@minus{}8 is out of the domain of @code{log()}, so the result is NaN.
+@end table
+
+NaN values are strange. In particular, they cannot be compared with other
+floating point values; any such comparison, except for ``is not equal
+to'', returns false. NaN values are so much unequal to other values that
+even comparing two identical NaN values with @code{!=} returns true!
+
+NaN values can also be signed, although it depends upon the implementation
+as to which sign you get for any operation that returns a NaN. For
+example, on some systems, @code{sqrt(-1)} returns a negative NaN. On
+others, it returns a positive NaN.
+
+When such values are generated, @command{gawk} prints them as either
+@samp{-nan} or @samp{+nan}, respectively. Here too, @command{gawk}
+accepts those strings as data input and converts them to the proper
+floating-point values internally.
+
+If you want to dive more deeply into this topic, you can find
+test programs in C, @command{awk} and Python in the directory
+@file{awklib/eg/test-programs} in the @command{gawk} distribution.
+These programs enable comparison among programming languages as to how
+they handle NaN and infinity values.
+
+@ignore
+@c file eg/test-programs/gen-float-table.awk
+function eq(left, right)
+@{
+ return left == right
+@}
+
+function ne(left, right)
+@{
+ return left != right
+@}
+
+function lt(left, right)
+@{
+ return left < right
+@}
+
+function le(left, right)
+@{
+ return left <= right
+@}
+
+function gt(left, right)
+@{
+ return left > right
+@}
+
+function ge(left, right)
+@{
+ return left >= right
+@}
+
+BEGIN @{
+ nan = sqrt(-1)
+ inf = -log(0)
+ split("== != < <= > >=", names)
+ names[3] = names[3] " "
+ names[5] = names[5] " "
+ split("eq ne lt le gt ge", funcs)
+
+ compare[1] = 2.0
+ compare[2] = values[1] = -sqrt(-1.0) # nan
+ compare[3] = values[2] = sqrt(-1.0) # -nan
+ compare[4] = values[3] = -log(0.0) # inf
+ compare[5] = values[4] = log(0.0) # -inf
+
+ for (i = 1; i in values; i++) @{
+ for (j = 1; j in compare; j++) @{
+ for (k = 1; k in names; k++) @{
+ the_func = funcs[k]
+ printf("%g %s %g -> %s\n",
+ values[i],
+ names[k],
+ compare[j],
+ @@the_func(values[i], compare[j]) ?
+ "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.c
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+#define def_func(name, op) \
+ bool name(double left, double right) @{ \
+ return left op right; \
+ @}
+
+def_func(eq, ==)
+def_func(ne, !=)
+def_func(lt, <)
+def_func(le, <=)
+def_func(gt, >)
+def_func(ge, >=)
+
+struct @{
+ const char *name;
+ bool (*func)(double left, double right);
+@} functions[] = @{
+ @{ "==", eq @},
+ @{ "!=", ne @},
+ @{ "< ", lt @},
+ @{ "<=", le @},
+ @{ "> ", gt @},
+ @{ ">=", ge @},
+ @{ 0, 0 @}
+@};
+
+int main()
+@{
+ double values[] = @{
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+ double compare[] = @{ 2.0,
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+
+ int i, j, k;
+
+ for (i = 0; i < 4; i++) @{
+ for (j = 0; j < 5; j++) @{
+ for (k = 0; functions[k].name != NULL; k++) @{
+ printf("%g %s %g -> %s\n", values[i],
+ functions[k].name,
+ compare[j],
+ functions[k].func(values[i], compare[j]) ? "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+
+ return 0;
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.py
+from math import *
+
+nan = float('NaN')
+inf = float('Inf')
+
+def eq(left, right):
+ return left == right
+
+def ne(left, right):
+ return left != right
+
+def lt(left, right):
+ return left < right
+
+def le(left, right):
+ return left <= right
+
+def gt(left, right):
+ return left > right
+
+def ge(left, right):
+ return left >= right
+
+func_map = {
+ "==": eq,
+ "!=": ne,
+ "< ": lt,
+ "<=": le,
+ "> ": gt,
+ ">=": ge,
+}
+
+compare = [2.0, nan, -nan, inf, -inf]
+values = [nan, -nan, inf, -inf]
+
+for i in range(len(values)):
+ for j in range(len(compare)):
+ for op in func_map:
+ print("%g %s %g -> %s" %
+ (values[i], op, compare[j], func_map[op](values[i], compare[j])))
+
+ print("")
+@c endfile
+@end ignore
+
@node Getting Accuracy
@subsection Getting the Accuracy You Need
@@ -34344,7 +34644,8 @@ multibyte encoding.
@itemx @ @ @ @ AWK_STRNUM,
@itemx @ @ @ @ AWK_ARRAY,
@itemx @ @ @ @ AWK_SCALAR,@ @ @ @ @ @ @ @ @ /* opaque access to a variable */
-@itemx @ @ @ @ AWK_VALUE_COOKIE@ @ @ @ /* for updating a previously created value */
+@itemx @ @ @ @ AWK_VALUE_COOKIE,@ @ @ /* for updating a previously created value */
+@itemx @ @ @ @ AWK_BOOL
@itemx @} awk_valtype_t;
This @code{enum} indicates the type of a value.
It is used in the following @code{struct}.
@@ -34357,6 +34658,7 @@ It is used in the following @code{struct}.
@itemx @ @ @ @ @ @ @ @ awk_array_t@ @ @ @ @ @ @ @ a;
@itemx @ @ @ @ @ @ @ @ awk_scalar_t@ @ @ @ @ @ @ scl;
@itemx @ @ @ @ @ @ @ @ awk_value_cookie_t@ vc;
+@itemx @ @ @ @ @ @ @ @ awk_bool_t@ @ @ @ @ @ @ @ @ b;
@itemx @ @ @ @ @} u;
@itemx @} awk_value_t;
An ``@command{awk} value.''
@@ -34372,6 +34674,7 @@ The @code{val_type} member indicates what kind of value the
@itemx #define array_cookie@ @ @ u.a
@itemx #define scalar_cookie@ @ u.scl
@itemx #define value_cookie@ @ @ u.vc
+@itemx #define bool_value@ @ @ @ @ u.b
Using these macros makes accessing the fields of the @code{awk_value_t} more
readable.
@@ -34699,6 +35002,11 @@ the regular expression of length @code{len}. It expects @code{string}
to be a @samp{char *} value pointing to data previously obtained from
@code{gawk_malloc()}, @code{gawk_calloc()}, or @code{gawk_realloc()}.
+@item static inline awk_value_t *
+@itemx make_bool(awk_bool_t boolval, awk_value_t *result);
+This function creates a boolean value in the @code{awk_value_t} variable
+pointed to by @code{result}.
+
@end table
@node API Ownership of MPFR and GMP Values
@@ -35499,7 +35807,8 @@ value type, as appropriate. This behavior is summarized in
<colspec colname="c6"/>
<colspec colname="c7"/>
<colspec colname="c8"/>
- <spanspec spanname="hspan" namest="c3" nameend="c8" align="center"/>
+ <colspec colname="c9"/>
+ <spanspec spanname="hspan" namest="c3" nameend="c9" align="center"/>
<thead>
<row><entry></entry><entry spanname="hspan"><para>Type of Actual Value</para></entry></row>
<row>
@@ -35509,6 +35818,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Strnum</para></entry>
<entry><para>Number</para></entry>
<entry><para>Regex</para></entry>
+ <entry><para>Bool</para></entry>
<entry><para>Array</para></entry>
<entry><para>Undefined</para></entry>
</row>
@@ -35521,6 +35831,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>String</para></entry>
<entry><para>String</para></entry>
<entry><para>String</para></entry>
+ <entry><para>String</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -35533,6 +35844,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
<row>
<entry></entry>
@@ -35541,6 +35853,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Number</para></entry>
<entry><para>Number</para></entry>
<entry><para>false</para></entry>
+ <entry><para>Number</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -35549,6 +35862,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para><emphasis role="bold">Regex</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Regex</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
@@ -35556,11 +35870,23 @@ value type, as appropriate. This behavior is summarized in
</row>
<row>
<entry><para><emphasis role="bold">Requested</emphasis></para></entry>
+ <entry><para><emphasis role="bold">Bool</emphasis></para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>Bool</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ </row>
+ <row>
+ <entry><para></para></entry>
<entry><para><emphasis role="bold">Array</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Array</para></entry>
<entry><para>false</para></entry>
</row>
@@ -35571,6 +35897,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Scalar</para></entry>
<entry><para>Scalar</para></entry>
<entry><para>Scalar</para></entry>
+ <entry><para>Scalar</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -35581,6 +35908,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>Strnum</para></entry>
<entry><para>Number</para></entry>
<entry><para>Regex</para></entry>
+ <entry><para>Bool</para></entry>
<entry><para>Array</para></entry>
<entry><para>Undefined</para></entry>
</row>
@@ -35593,6 +35921,7 @@ value type, as appropriate. This behavior is summarized in
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
</tbody>
</tgroup>
@@ -35609,43 +35938,46 @@ value type, as appropriate. This behavior is summarized in
\vglue-1.1\baselineskip
@end tex
@c @multitable @columnfractions .166 .166 .198 .15 .15 .166
-@multitable {Requested} {Undefined} {Number} {Number} {Scalar} {Regex} {Array} {Undefined}
-@headitem @tab @tab String @tab Strnum @tab Number @tab Regex @tab Array @tab Undefined
-@item @tab @b{String} @tab String @tab String @tab String @tab String @tab false @tab false
-@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false
-@item @tab @b{Number} @tab Number @tab Number @tab Number @tab false @tab false @tab false
-@item @b{Type} @tab @b{Regex} @tab false @tab false @tab false @tab Regex @tab false @tab false
-@item @b{Requested} @tab @b{Array} @tab false @tab false @tab false @tab false @tab Array @tab false
-@item @tab @b{Scalar} @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab false @tab false
-@item @tab @b{Undefined} @tab String @tab Strnum @tab Number @tab Regex @tab Array @tab Undefined
-@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false
+@multitable {Requested} {Undefined} {Number} {Number} {Scalar} {Regex} {Number} {Array} {Undefined}
+@headitem @tab @tab String @tab Strnum @tab Number @tab Regex @tab Bool @tab Array @tab Undefined
+@item @tab @b{String} @tab String @tab String @tab String @tab String @tab String @tab false @tab false
+@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false @tab false
+@item @tab @b{Number} @tab Number @tab Number @tab Number @tab false @tab Number @tab false @tab false
+@item @b{Type} @tab @b{Regex} @tab false @tab false @tab false @tab Regex @tab false @tab false @tab false
+@item @b{Requested} @tab @b{Bool} @tab false @tab false @tab false @tab false @tab Bool @tab false @tab false
+@item @tab @b{Array} @tab false @tab false @tab false @tab false @tab false @tab Array @tab false
+@item @tab @b{Scalar} @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab false @tab false
+@item @tab @b{Undefined} @tab String @tab Strnum @tab Number @tab Regex @tab Bool @tab Array @tab Undefined
+@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false @tab false
@end multitable
@end ifnotdocbook
@end ifnotplaintext
@ifplaintext
@verbatim
- +-------------------------------------------------------+
- | Type of Actual Value: |
- +--------+--------+--------+--------+-------+-----------+
- | String | Strnum | Number | Regex | Array | Undefined |
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
-| | String | String | String | String | String | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Strnum | false | Strnum | Strnum | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Number | Number | Number | Number | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Regex | false | false | false | Regex | false | false |
-| Type +-----------+--------+--------+--------+--------+-------+-----------+
-| Requested | Array | false | false | false | false | Array | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Undefined | String | Strnum | Number | Regex | Array | Undefined |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Value | false | false | false | false | false | false |
-| | Cookie | | | | | | |
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
+ +----------------------------------------------------------------+
+ | Type of Actual Value: |
+ +--------+--------+--------+--------+--------+-------+-----------+
+ | String | Strnum | Number | Regex | Bool | Array | Undefined |
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | String | String | String | String | String | String | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Strnum | false | Strnum | Strnum | false | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Number | Number | Number | Number | false | Number | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Regex | false | false | false | Regex | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| Type | Bool | false | false | false | false | Bool | false | false |
+| Requested +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Array | false | false | false | false | false | Array | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Scalar | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Undefined | String | Strnum | Number | Regex | Bool | Array | Undefined |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Value | false | false | false | false | false | false | false |
+| | Cookie | | | | | | | |
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
@end verbatim
@end ifplaintext
@end float
@@ -44300,8 +44632,8 @@ internationalized program to work in a particular language.
@item Logical Expression
An expression using the operators for logic, AND, OR, and NOT, written
-@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called Boolean
-expressions, after the mathematician who pioneered this kind of
+@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called @dfn{Boolean
+expressions}, after the mathematician who pioneered this kind of
mathematical logic.
@item Lvalue
diff --git a/doc/it/ChangeLog b/doc/it/ChangeLog
index 863eef47..f1ddd3e1 100644
--- a/doc/it/ChangeLog
+++ b/doc/it/ChangeLog
@@ -1,3 +1,103 @@
+2021-09-26 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-09-23 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-09-12 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-08-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-07-15 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-07-11 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-07-08 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gawk.1: Updated.
+
+2021-07-01 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2021-06-25 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-06-24 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-06-21 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-06-17 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-05-31 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gawk.1: Updated.
+
+2021-05-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gawk.1: Updated.
+
+2021-05-16 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-04-06 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-04-01 Antonio Giovanni Colombo <azc100@gmail.com>
+ Marco Curreli <marcocurreli@tiscali.it>
+
+ * gawktexi.in: Updated.
+ * gendocs.sh: Added.
+ * gendocs_template: Added.
+ * genera_formati.sh: Added.
+
+2021-03-21 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-03-20 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2021-02-01 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-01-25 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2021-01-22 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2020-11-20 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
2020-11-01 Antonio Giovanni Colombo <azc100@gmail.com>
* texinfo.tex: Updated.
diff --git a/doc/it/gawk.1 b/doc/it/gawk.1
index c5c76023..56bb02d5 100644..100755
--- a/doc/it/gawk.1
+++ b/doc/it/gawk.1
@@ -14,6 +14,8 @@
.\"Aggiornam. a gawk-5.1.0 di A.G. Colombo - revis. M. Curreli - Aprile 2020
.\"Aggiornam. a gawk-5.1.0 di A.G. Colombo - Giugno 2020
.\"Aggiornam. a gawk-5.1.0 di A.G. Colombo - Luglio 2020
+.\"Aggiornam. a gawk-5.1.1 di A.G. Colombo - Maggio 2021
+.\"Aggiornam. a gawk-5.1.1 di A.G. Colombo - Luglio 2021
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
@@ -30,7 +32,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Aug 31 2020" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Jul 05 2021" "Free Software Foundation" "Utility Commands"
.SH NOME
gawk \- linguaggio per il riconoscimento e il trattamento di espressioni
regolari
@@ -2955,6 +2957,9 @@ quelli delle stringhe ammissibili per
Si può anche specificare il nome di una funzione di confronto
definita dall'utente, come viene spiegato in
\fBPROCINFO["sorted_in"]\fR.
+.IR s " e " d
+possono specificare lo stesso vettore; la cosa ha senso nel
+caso si specifichi anche il terzo argomento.
.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIlista-espressioni\^\fB)\fR'u+1n"
\fBasorti(\fIs \fR[\fB, \fId\fR [\fB, \fIcome\fR] ]\fB)\fR
Restituisce il numero di elementi del
@@ -2973,6 +2978,10 @@ Lo scopo della stringa facoltativa
.I come
è lo stesso descritto in precedenza per
.BR asort() .
+Anche qui
+.IR s " e " d
+possono specificare lo stesso vettore; la cosa ha senso nel
+caso si specifichi anche il terzo argomento.
.TP
\fBgensub(\fIr\fB, \fIs\fB, \fIh \fR[\fB, \fIt\fR]\fB)\fR
Cerca nella stringa obiettivo
@@ -3496,6 +3505,17 @@ in \*(EP.
Occorre anche fornire un dominio di testo. Si usi
.B TEXTDOMAIN
se ci si vuole servire del dominio corrente.
+.SS Funzioni con valori booleani
+È possibile creare valori speciali di tipo booleani;
+vedere il manuale per sapere come funzionano e
+perché sono stati resi disponibili.
+.TP
+.BI mkbool( espressione\^ )
+A seconda del valore booleano di
+.I espressione
+restituisce un valore di true [vero] o false [falso].
+True ha come valore numerico uno.
+False ha come valore numerico zero.
.SH FUNZIONI DEFINITE DALL'UTENTE
Le funzioni in \*(AK sono definite in questo modo:
.PP
@@ -4289,7 +4309,7 @@ Lo ringraziamo.
.SH COPYING PERMISSIONS
Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2009,
-2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
+2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
diff --git a/doc/it/gawktexi.in b/doc/it/gawktexi.in
index fe7c6b29..d4f517b6 100644..100755
--- a/doc/it/gawktexi.in
+++ b/doc/it/gawktexi.in
@@ -56,14 +56,15 @@
@c applies to and all the info about who's publishing this edition
@c These apply across the board.
-@set UPDATE-MONTH Settembre 2020
+@set UPDATE-MONTH Luglio 2021
@set VERSION 5.1
-@set PATCHLEVEL 0
+@set PATCHLEVEL 1
@c added Italian hyphenation stuff
@hyphenation{ven-go-no o-met-te-re o-met-ten-do}
@set GAWKINETTITLE TCP/IP Internetworking with @command{gawk}
+@set GAWKWORKFLOWTITLE Participating in @command{gawk} Development
@ifset FOR_PRINT
@set TITLE Programmare efficacemente in awk
@end ifset
@@ -76,6 +77,7 @@
@iftex
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -93,11 +95,12 @@
@ifinfo
@set DOCUMENT File Info
@set CHAPTER nodo principale
+@set CHAPTERS nodi principali
@set APPENDIX nodo principale
-@set SECTION nodo secondario
-@set SECTIONS nodi secondari
-@set SUBSECTION nodo
-@set SUBSECTIONS nodi
+@set SECTION nodo
+@set SECTIONS nodi
+@set SUBSECTION sottonodo
+@set SUBSECTIONS sottonodi
@set DARKCORNER (a.b.)
@set COMMONEXT (e.c.)
@set PAGE videata
@@ -105,6 +108,7 @@
@ifhtml
@set DOCUMENT Documento
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -117,6 +121,7 @@
@ifdocbook
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -129,6 +134,7 @@
@ifxml
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -141,6 +147,7 @@
@ifplaintext
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -309,7 +316,7 @@ Some comments on the layout for TeX.
Tel.: +1-617-542-5942 Fax: +1-617-542-2652 Email: <email>gnu@@gnu.org</email>
URL: <ulink url="https://www.gnu.org">https://www.gnu.org/</ulink></literallayout>
-<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2020
+<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2021
Free Software Foundation, Inc.
All Rights Reserved.
</literallayout>
@@ -331,7 +338,7 @@ Italian Linux Documentation Project (ILDP)
Email: <emailildp@@pluto.it
URL: <ulink url="http://www.pluto.it/ildp">http://www.pluto.it/ildp/</ulink></literallayout>
-<literallayout class="normal">Copyright &copy; 2016&ndash;2020
+<literallayout class="normal">Copyright &copy; 2016&ndash;2021
Free Software Foundation, Inc.
All Rights Reserved.
</literallayout>
@@ -339,7 +346,7 @@ All Rights Reserved.
@ifnotdocbook
@iftex
-Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2020 @*
+Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2021 @*
Free Software Foundation, Inc.
@end iftex
@end ifnotdocbook
@@ -687,7 +694,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Separazione in base al contenuto:: Definire campi dal loro contenuto.
* File CSV:: Ancora sui file CSV.
* Controllare la creazione di campi:: Controllare come @command{gawk} sta
- dividendo i record.
+ suddividendo i record.
* Righe multiple:: Record su righe multiple
* Getline:: Richiedere input usando @code{getline}.
* Getline semplice:: Usare @code{getline} senza argomenti.
@@ -877,6 +884,8 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Vettori di vettori:: Vettori multidimensionali veri.
* Sommario dei vettori:: Sommario dei vettori.
* Funzioni predefinite:: Riepilogo delle funzioni predefinite.
+* Funzioni booleane:: Una funzione che restituisce valori
+ booleani.
* Chiamare funzioni predefinite:: Come chiamare funzioni predefinite.
* Funzioni numeriche:: Funzioni che trattano numeri, comprese
@code{int()}, @code{sin()}
@@ -933,6 +942,8 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
vettore in una stringa.
* Funzione getlocaltime:: Una funzione per ottenere data e
ora nel formato desiderato.
+* Funzione isnumeric:: Una funzione per controllare se un
+ valore @`e numerico.
* Funzione readfile:: Una funzione per leggere un file
intero in un colpo solo.
* Apici alla shell:: Una funzione per passare stringhe
@@ -968,6 +979,9 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Programma tee:: Il programma di utilit@`a @command{tee}.
* Programma uniq:: Il programma di utilit@`a @command{uniq}.
* Programma wc:: Il programma di utilit@`a @command{wc}.
+* Byte vs. Caratteri:: Moderni insiemi di caratteri.
+* Usare le estensioni:: Una breve introduzione alle estensioni.
+* Programmma @command{wc}:: Codice per @file{wc.awk}.
* Programmi vari:: Alcuni interessanti programmi in
@command{awk}
* Programma dupword:: Trovare parole duplicate in un
@@ -994,6 +1008,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Esercizi sui programmi:: Esercizi.
* Dati non decimali:: Consentire dati di input in base
diversa da 10.
+* Valori di tipo booleano:: Valori di tipo @code{number|bool}.
* Ordinamento di vettori:: Modi per controllare la visita di un
vettore e il suo ordinamento.
* Controllare visita vettori:: Come usare PROCINFO["sorted_in"].
@@ -1005,6 +1020,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
programmazione di rete.
* Profilare:: Profilare i propri programmi
@command{awk}.
+* Filosofia delle estensioni:: Cosa dovrebbe essere incluso e cosa no.
* Sommario funzionalit@`a avanzate:: Sommario funzionalit@`a avanzate.
* I18N e L10N:: Internazionalizzazione e localiz.
* Utilizzare @command{gettext}:: Come funziona GNU @code{gettext}.
@@ -1033,7 +1049,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Controllo dei breakpoint:: Controllo dei punti d'interruzione.
* Controllo esecuzione debugger:: Controllo di esecuzione.
* Vedere e modificare dati:: Vedere e modificare dati.
-* Stack di esecuzione:: Lavorare con lo @dfn{stack}.
+* Stack di esecuzione:: Lavorare con lo @dfn{Stack}.
* Informazioni sul debugger:: Ottenere informazioni sullo stato
del programma e del debugger.
* Comandi vari del debugger:: Comandi vari del debugger.
@@ -1065,13 +1081,14 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
esattamente.
* Confronti tra valori in VM:: Come confrontare valori in virgola mobile.
* Gli errori si sommano:: Gli errori diventano sempre maggiori.
+* Valori strani:: Un cenno riguardo ai valori infiniti e a NaN [Non un Numero].
* Ottenere la precisione:: Ottenere la precisione voluta.
* Tentare di arrotondare:: Tentare di aggiungere bit di precisione e
arrotondare.
* Impostare la precisione:: Impostare la precisione.
* Impostare modo di arrotondare:: Impostare la modalit@`a di
arrotondamento.
-* Controllare disponibilit@`a MPFR:: Come controllare se MPFR @`e disponibile.
+* Controllare disponibilit@`a MPFR:: Come controllare se MPFR @`e disponibile.
* Interi a precisione arbitraria:: Aritmetica dei numeri interi a precisione
arbitraria con @command{gawk}.
* Problemi virgola mobile POSIX:: Confronto tra standard e uso corrente.
@@ -1084,8 +1101,8 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Intro funzioni estensione API:: Introduzione alle funzioni dell'API.
* Tipi di dati generali:: I tipi di dati.
* Funzioni di allocazione memoria:: Funzioni per allocare memoria.
-* API e gestione valori MPFR e GMP:: Gestione valori MPFR e GMP.
* Funzioni di costruzione:: Funzioni per creare valori.
+* API e gestione valori MPFR e GMP:: Gestione valori MPFR e GMP.
* Funzioni di registrazione:: Funzioni per registrare cose con
@command{gawk}.
* Funzioni di estensione:: Registrare funzioni di estensione.
@@ -1173,11 +1190,14 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Installazione Unix:: Installare @command{gawk} su
varie versioni di Unix.
* Installazione veloce:: Compilare @command{gawk} sotto Unix.
+* Compilare con MPFR:: Compilare con MPFR.
* File da usare a inizio sessione:: Funzioni di personalizzazione shell.
* Ulteriori opzioni di configurazione:: Altre opzioni utilizzabili in fase
di compilazione.
* Filosofia della configurazione:: Come si suppone che funzioni.
-* Installazione non-Unix:: Installazioni su altri Sistemi
+* Compilare da git:: Compilare da git.
+* Generare la documentazione:: Generare la documentazione.
+* Installazione non-Unix:: Installazioni su altri Sistemi Operativi.
Operativi.
* Installazione su PC:: Installare e compilare
@command{gawk} su Microsoft Windows.
@@ -1199,12 +1219,14 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
VMS.
* Esecuzione su VMS:: Come eseguire @command{gawk} su VMS.
* GNV su VMS:: Il progetto GNV di VMS.
-* Vecchio Gawk su VMS:: Una versione non aggiornata arriva
- con alcune versioni di VMS.
* Bug:: Notificare problemi e bug.
-* Indirizzo Bug:: Dove notificare problemi.
+* Definizione di bug:: Definire cos'@`e e cosa non @`e un bug.
+* Indirizzo bug:: Dove notificare problemi.
* Usenet:: Dove non notificare problemi.
-* Manutentori:: Manutentori di version non-*nix.
+* Bug di prestazione:: Che fare se pensate che ci sia un
+ problema di prestazioni.
+* Richieste di aiuto:: Gestire domande non relative ai bug.
+* Manutentori:: Manutentori di versioni non-Unix.
* Altre versioni:: Altre implementazioni di
@command{awk} liberamente
disponibili.
@@ -1363,7 +1385,7 @@ scoprire prima i problemi che possono presentarsi. Spesso, l'efficienza di
questa versione iniziale interpretata @`e sufficiente e il prototipo
AWK diventa il prodotto finale.
-Il nuovo comando @command{pgawk} (profiling @command{gawk}) produce
+Il nuovo comando @command{pgawk} (@dfn{profiling} @command{gawk}) produce
conteggi sull'esecuzione delle istruzioni del programma.
Recentemente ho fatto un tentativo con un algoritmo che, a fronte di
@ifnotdocbook
@@ -1779,7 +1801,21 @@ Si trovano tutti nell'indice analitico, alla voce ``riquadro.''
@end ifclear
La maggior parte delle volte, gli esempi usano programmi @command{awk} completi.
-Alcune delle @value{SECTIONS} pi@`u avanzate mostrano solo la parte del programma
+@ifnotinfo
+Alcune delle
+@end ifnotinfo
+@ifinfo
+Alcuni dei
+@end ifinfo
+@value{SECTIONS}
+pi@`u
+@ifnotinfo
+avanzate
+@end ifnotinfo
+@ifinfo
+avanzati
+@end ifinfo
+mostrano solo la parte del programma
@command{awk} che illustra il concetto che si sta descrivendo.
Sebbene questo @value{DOCUMENT} sia destinato soprattutto alle persone che non
@@ -2490,7 +2526,7 @@ sulla sua documentazione senza il suo aiuto.
Brian @`e un fuoriclasse sia come programmatore che come autore di manuali
tecnici. @`E mio dovere ringraziarlo (una volta di pi@`u) per la sua costante
amicizia e per essere stato per me un modello da seguire ormai per oltre
-30 anni! Averlo come revisiore @`e per me un privilegio eccitante, ma @`e
+30 anni! Averlo come revisore @`e per me un privilegio eccitante, ma @`e
stata anche un'esperienza che mi ha fatto sentire molto piccolo@enddots{}
@cindex Robbins @subentry Miriam
@@ -2710,7 +2746,7 @@ un file separato che contenga il programma @command{awk}. Uno @dfn{script}
di shell @`e pi@`u affidabile, perch@'e non ci sono altri file che possono
venirsi a trovare fuori posto.
-Pi@`u avanti in questo capitolo,
+Pi@`u avanti in questo @value{CHAPTER},
@iftex
nella
@end iftex
@@ -3007,7 +3043,13 @@ $ @kbd{awk '@{ print "Ciao" @} # un'idea brillante'}
Mettere una barra inversa prima dell'apice singolo in @samp{un'idea} non
risolverebbe, poich@'e le barre inverse non sono speciali all'interno di apici
singoli.
-La prossima @value{SUBSECTION} descrive le regole di protezione della shell.
+@ifnotinfo
+La prossima
+@end ifnotinfo
+@ifinfo
+Il prossimo
+@end ifinfo
+@value{SUBSECTION} descrive le regole di protezione della shell.
@end quotation
@node Protezione
@@ -3259,7 +3301,7 @@ Le ``shell'' nei sistemi Microsoft Windows usano il carattere doppio apice
per protezione, e rendono difficile o impossibile inserire un carattere
doppio apice letterale in uno @dfn{script} scritto su una riga di comando.
L'esempio che segue, per il quale ringraziamo Jeroen Brink, mostra come
-proteggere i doppi apici, con questo script di una sola riga, che stampa
+proteggere i doppi apici, con questo @dfn{script} di una sola riga, che stampa
tutte le righe di un file, racchiudendole tra doppi apici:
@example
@@ -3338,11 +3380,12 @@ persona @`e un amico [Friend]. Una @samp{R} vuol dire che quella persona @`e
un parente [Relative]:
@example
-@c system if test ! -d eg ; then mkdir eg ; fi
-@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
-@c system if test ! -d eg/data ; then mkdir eg/data ; fi
-@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
-@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg ; then mkdir eg ; fi
+@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
+@c system if test ! -d eg/data ; then mkdir eg/data ; fi
+@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
+@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg/test-programs ; then mkdir eg/test-programs ; fi
@c file eg/data/mail-list
Amelia 555-5553 amelia.zodiacusque@@gmail.com F
Anthony 555-3412 anthony.asserturo@@hotmail.com A
@@ -3689,7 +3732,7 @@ anno).
Come gi@`a visto sopra, l'output di @w{@samp{ls -l}} elenca la lista
dei file contenuti in una directory, compresa la lunghezza di ogni
-file la data in cui il file @`e stato modificato per l'ultima volta.
+file e la data in cui il file @`e stato modificato per l'ultima volta.
Il primo campo contiene le autorizzazioni di lettura-scrittura,
il secondo campo contiene il numero di @dfn{link} di quel file
e il terzo campo identifica il proprietario del file.
@@ -3698,7 +3741,7 @@ Il quinto campo contiene la dimensione del file, in byte.
Il sesto, settimo e ottavo campo contengono il mese, il giorno e
l'ora, rispettivamente, in cui il file @`e stato modificato l'ultima
volta.
-Finalmente il nono campo contiene il valore @value{FN}.
+Infine, il nono campo contiene il valore @value{FN}.
@c @cindex automatic initialization
@cindex inizializzazione @subentry automatica
@@ -3718,8 +3761,14 @@ regola @code{END} viene eseguita e viene stampato il valore di @code{somma}.
In questo esempio, il valore di @code{somma} @`e 80600.
Queste tecniche pi@`u avanzate di @command{awk} sono trattate in
+@ifnotinfo
+successive
+@end ifnotinfo
+@ifinfo
+successivi
+@end ifinfo
@value{SECTIONS}
-successive (@pxref{Panoramica sulle azioni}). Prima di poter passare a una
+(@pxref{Panoramica sulle azioni}). Prima di poter passare a una
programmazione pi@`u avanzata con @command{awk}, @`e necessario sapere come
@command{awk} interpreta i file in input e visualizza quelli in output.
Modificando campi e usando l'istruzione @code{print} @`e possibile produrre
@@ -3937,7 +3986,7 @@ e buttati via. Poich@'e i programmi @command{awk} sono interpretati, si pu@`o
evitare la (normalmente laboriosa) parte di compilazione nel ciclo tipico
dello sviluppo software, ossia edita-compila-prova-correggi.
-@cindex BWK @command{awk} @seeentry{Brian Kernighan @subentry @command{awk} di}
+@cindex BWK @command{awk} @seeentry{Brian Kernighan, @command{awk} di}
@cindex Brian Kernighan @subentry @command{awk} di
In @command{awk} sono stati scritti programmi complessi, compreso un assembler
completo, pluri-piattaforma per
@@ -4429,7 +4478,7 @@ informazioni.
@cindex codice-byte interno @subentry tracciatura del
Stampa i nomi del codice-byte generato internamente, nell'ordine
in cui sono incontrati durante l'esecuzione del programma.
-Questa trace @`e stampata sullo standard error.
+Questa tracciatura @`e stampata sullo standard error.
Ogni ``codice operativo'' @`e preceduto da un segno @code{+}
nell'output.
@@ -4534,7 +4583,7 @@ Forza l'uso del carattere di separazione decimale della localizzazione
quando analizza i dati in input
(@pxref{Localizzazioni}).
-@cindex stampa elegante
+@cindex stampa-elegante
@item @option{-o}[@var{file}]
@itemx @option{--pretty-print}[@code{=}@var{file}]
@cindex @option{-o} (opzione)
@@ -5018,7 +5067,7 @@ variabile non esiste, o se ha un come valore la stringa nulla,
@command{gawk} usa un percorso di default (descritto tra poco).
La funzionalit@`a del percorso di ricerca @`e particolarmente utile per costruire
-librerie di funzioni di @command{awk}. I file di libreria possono essere messi
+librerie di funzioni di @command{awk}. Le librerie di file possono essere messe
in una directory standard inclusa nel percorso di ricerca
e richiamati sulla riga di comando con un
@value{FN} breve. Altrimenti, si dovrebbe scrivere l'intero @value{FN} per
@@ -5026,7 +5075,7 @@ ciascun file.
Usando l'opzione @option{-i}, o l'opzione @option{-f}, i programmi di
@command{awk} scritti sulla riga di comando possono usare le funzionalit@`a
-contenute nei file di libreria di @command{awk}
+contenute nelle librerie di file di @command{awk}
@iftex
(@pxrefil{Funzioni di libreria}).
@end iftex
@@ -5192,7 +5241,11 @@ del filesystem).
@item AWK_HASH
Se questa variabile @`e impostata con un valore di @samp{gst}, @command{gawk}
usa la funzione hash di GNU Smalltalk per gestire i vettori.
-Questa funzione pu@`o essere leggermente pi@`u veloce della funzione standard.
+Se invece ha per valore @samp{fnv1a}, @command{gawk} usa la funzione hash
+@uref{http://www.isthe.com/chongo/tech/comp/fnv/index.html,
+FNV1-A}.
+Queste funzioni possono essere leggermente pi@`u veloci della funzione standard.
+
@item AWKREADFUNC
Se questa variabile esiste, @command{gawk} legge i file sorgenti una riga per
volta, anzich@'e a blocchi. Questa variabile @`e presente
@@ -5386,7 +5439,7 @@ possono includere queste ``librerie'' usando il percorso completo dei
file, o impostando opportunamente la variabile d'ambiente @env{AWKPATH} e
quindi usando @code{@@include} con la sola parte del percorso completo che
designa il file. Naturalmente,
-si possono tenere i file di libreria in pi@`u di una directory;
+si possono tenere le librerie di file in pi@`u di una directory;
pi@`u @`e complesso l'ambiente di lavoro, pi@`u
directory possono essere necessarie per organizzare i file da includere.
@@ -6119,7 +6172,7 @@ confronti. Per esempio, @samp{\$}
individua il carattere @samp{$}.
@cindex espressioni regolari @subentry @`ancore nelle
-@cindex Texinfo @subentry inizi di capitolo nei file
+@cindex Texinfo @subentry inizi di @value{CHAPTER} nei file
@cindex @code{^} (circonflesso) @subentry operatore @dfn{regexp}
@cindex circonflesso (@code{^}) @subentry operatore @dfn{regexp}
@item @code{^}
@@ -6314,6 +6367,47 @@ nella @dfn{regexp}. Per esempio, @code{/+/} individua un semplice segno
pi@`u. Tuttavia, molte altre versioni di @command{awk} trattano una
tale notazione come un errore di sintassi.
+@sidebar E se la @dfn{regexp} @`e vuota?
+@cindex vuote @subentry @dfn{regexps}
+@cindex @dfn{regexp} @subentry vuote
+Viene qui descritto un uso avanzato delle @dfn{regexp}.
+Pu@`o essere saltato in una prima lettura.
+
+Si pu@`o specificare una costante @dfn{regexp} vuota (@samp{//}) in ogni
+posto in cui ci si aspetta di trova una @dfn{regexp}.
+Pu@`o servire a qualcosa farlo? A cosa corrisponde?
+
+Ha senso farlo. Corrisponde alla stringa vuota (invisibile),
+all'inizio e alla fine di una stringa di caratteri, come pure
+alla stringa vuota tra un carattere e l'altro. Lo si vede bene
+con la funzione @code{gsub()}, che si usa per fare delle sostituzioni
+globali (@pxref{Funzioni per stringhe}). L'uso normale di @code{gsub()}
+@`e del tipo:
+
+@example
+$ @kbd{awk '}
+> @kbd{BEGIN @{}
+> @kbd{ x = "ABC_CBA"}
+> @kbd{ gsub(/B/, "bb", x)}
+> @kbd{ print x}
+> @kbd{@}'}
+@print{} AbbC_CbbA
+@end example
+
+Possiamo usare @code{gsub()} per verificare dove sono situate le stringhe
+vuote che corrispondono alla @dfn{regexp} vuote:
+
+@example
+$ @kbd{awk '}
+> @kbd{BEGIN @{}
+> @kbd{ x = "ABC"}
+> @kbd{ gsub(//, "x", x)}
+> @kbd{ print x}
+> @kbd{@}'}
+@print{} xAxBxCx
+@end example
+@end sidebar
+
@node Espressioni di intervallo
@subsection Alcune note sulle espressioni di intervallo
@@ -6341,18 +6435,45 @@ qualsiasi versione di @command{awk}.@footnote{@`E meglio usare due barre inverse
se si sta usando una costante stringa con un operatore @dfn{regexp} o una
funzione.}
-Infine, quando @samp{@{} e @samp{@}} appaiono in costanti @dfn{regexp}
+Quando @samp{@{} e @samp{@}} appaiono in costanti @dfn{regexp}
in un modo non interpretabile come espressione di intervallo
(come in @code{/q@{a@}/}), allora sono prese letteralmente.
Come detto sopra, le espressioni di intervallo non erano tradizionalmente
disponibili in @command{awk}. Con la versione di Marzo 2019 di
BWK @command{awk} sono (finalmente) disponibili.
-
Ciononostante, non essendo state disponibili per parecchi decenni,
@command{gawk} continua a non renderle disponibili quando viene
eseguito in modalit@`a compatibile (@pxref{Opzioni}).
+POSIX afferma che espressioni di intervallo che contengano
+contatori di ripetizione maggiori di 255 producono risultati
+indeterminati.
+
+@cindex Eggert, Paul
+Nel manuale del comando GNU @command{grep}, Paul Eggert nota
+quanto segue:
+
+@quotation
+Le espressioni di intervallo possono essere implementate internamente
+tramite ripetizioni. Per esempio, @samp{^(a|bc)@{2,4@}$} potrebbe
+essere implementata come @samp{^(a|bc)(a|bc)((a|bc)(a|bc)?)?$}.
+Un contatore di ripetizioni elevato potrebbe esaurire la memoria del computer
+o rallentare grandemente la determinazione delle corrispondenze.
+Anche contatori bassi possono causare problemi se sono inseriti
+"a cascata"; per esempio,
+@samp{grep -E ".*@{10,@}@{10,@}@{10,@}@{10,@}@{10,@}"}
+con molta probabilit@`a basta a far "esplodere" la @dfn{stack}.
+Fortunatamente, espressioni regolari di questo tipo sono
+tipicamente artificiali, mentre ripetizioni "a cascata" non
+rispettano lo standard POSIX, e quindi non possono in ogni caso
+essere inserite in programmi portabili [tra differenti implementazioni
+di @command{grep}].
+@end quotation
+
+@noindent
+Lo stesso vale anche per @command{gawk}.
+
@node Espressioni tra parentesi quadre
@section Usare espressioni tra parentesi quadre
@cindex espressioni @subentry tra parentesi quadre
@@ -6384,7 +6505,7 @@ che occupano un unico byte (caratteri il cui valore stia
nell'intervallo 0--256). Per individuare un intervallo di
caratteri in cui i punti di inizio e fine dell'intervello
abbiano valori maggiori di 256, occorre immettere direttamente
-le codifiche multi-byte dei caratteri in questione.
+le codifiche multibyte dei caratteri in questione.
@cindex @code{\} (barra inversa) @subentry in espressioni tra parentesi quadre
@cindex barra inversa (@code{\}) @subentry in espressioni tra parentesi quadre
@@ -6523,7 +6644,7 @@ sono equivalenti). Queste sequenze sono:
@cindex espressioni @subentry tra parentesi quadre @subentry elementi di collazione
@cindex elementi @subentry di collazione
@item elementi di collazione
-Elementi di collazione multi-byte racchiusi fra
+Elementi di collazione multibyte racchiusi fra
@samp{[.} e @samp{.]}. Per esempio, se @samp{ch} @`e un elemento di collazione,
@samp{[[.ch.]]} @`e una @dfn{regexp} che individua questo elemento di
collazione, mentre @samp{[ch]} @`e una @dfn{regexp} che individua le lettere
@@ -7096,7 +7217,7 @@ getline (@pxref{Getline}).
* Dimensione costante:: Leggere campi di larghezza costante.
* Separazione in base al contenuto:: Definire campi dal loro contenuto.
* Controllare la creazione di campi:: Controllare come @command{gawk} sta
- dividendo i record.
+ suddividendo i record.
* Righe multiple:: Leggere record che sono su pi@`u righe.
* Getline:: Leggere file sotto il controllo del
programma, usando la funzione
@@ -7274,23 +7395,6 @@ in questione non viene trattato come tale, ma viene usato letteralmente.
Ci@`o viene fatto per compatibilit@`a all'indietro sia con il comando
Unix @command{awk} che con lo standard POSIX.
-Quando si usano caratteri normali come separatore di record,
-c'@`e un caso insolito che capita quando @command{gawk}
-@`e reso completamente conforme a POSIX (@pxref{Opzioni}).
-In quel caso, la seguente (estrema) @dfn{pipeline} stampa un sorprendente
-@samp{1}:
-
-@example
-$ echo | gawk --posix 'BEGIN @{ RS = "a" @} ; @{ print NF @}'
-@print{} 1
-@end example
-
-C'@`e un solo campo, consistente in un ritorno a capo. Il valore della
-variabile predefinita @code{NF} @`e il numero di campi nel record corrente.
-(Normalmente @command{gawk} tratta il ritorno a capo come uno spazio
-vuoto, stampando @samp{0} come risultato. Anche molte altre versioni di
-@command{awk} agiscono in questo modo.)
-
@cindex angolo buio @subentry file in input
Il raggiungimento della fine di un file in input fa terminare il record di
input corrente, anche se l'ultimo carattere nel file non @`e il carattere in
@@ -7387,7 +7491,7 @@ particolare se il testo di input che potrebbe avere una corrispondenza con la
parte finale @`e piuttosto lungo. @command{gawk} cerca di evitare questo
problema, ma al momento non ci sono garanzie che questo funzioni sempre.
-@quotation NOTA
+@sidebar Avvertenze per quando si usano espressioni regolari come @code{RS}
Si ricordi che in @command{awk}, i metacaratteri di ancoraggio @samp{^} e
@samp{$} trovano l'inizio e la fine di una @emph{stringa}, e non l'inizio e la
fine di una @emph{riga}. Come risultato, qualcosa come
@@ -7395,7 +7499,15 @@ fine di una @emph{riga}. Come risultato, qualcosa come
Questo perch@'e @command{gawk} vede il file in input come un'unica lunga stringa
in cui possono essere presenti dei caratteri di ritorno a capo.
@`E meglio perci@`o evitare metacaratteri di ancoraggio nel valore di @code{RS}.
-@end quotation
+
+La suddivisione in campi usando espressioni regolari funziona in maniera
+differente rispetto a quando la si usa con le funzioni @code{sub()}, @code{gsub()}, e
+@code{gensub()} (@pxref{Funzioni per stringhe}). Tali funzioni consentono
+che un'espressione regolare sia soddisfatta da una stringa nulla;
+la suddivisione in campi non lo consente. Quindi, per esempio,
+@samp{RS = "()"} @emph{non} divide un record in campi di un carattere
+ciascuno.
+@end sidebar
@cindex @command{gawk} @subentry variabile @subentry @code{RT} in
@cindex @code{RT} (variabile)
@@ -7927,7 +8039,13 @@ regole.
@cindex espressioni regolari @subentry come separatore di campo
@cindex separatore di campo @subentry espressioni regolari come
-La precedente @value{SUBSECTION}
+@ifnotinfo
+La precedente
+@end ifnotinfo
+@ifinfo
+Il precedente
+@end ifinfo
+@value{SUBSECTION}
ha illustrato l'uso di caratteri singoli o di stringhe semplici come
valore di @code{FS}.
Pi@`u in generale, il valore di @code{FS} pu@`o essere una stringa contenente
@@ -8034,6 +8152,15 @@ $ @kbd{echo 'xxAA xxBxx C' |}
@print{} -->C<--
@end example
+Inoltre,
+la suddivisione in campi usando espressioni regolari funziona in maniera
+differente rispetto a quando la si usa con le funzioni @code{sub()}, @code{gsub()}, e
+@code{gensub()} (@pxref{Funzioni per stringhe}). Tali funzioni consentono
+che un'espressione regolare sia soddisfatta da una stringa nulla;
+La suddivisione in campi non lo consente. Quindi, per esempio,
+@samp{RS = "()"} @emph{non} divide un record in campi di un carattere
+ciascuno.
+
@node Campi di un solo carattere
@subsection Fare di ogni carattere un campo separato
@@ -8535,7 +8662,7 @@ quattro, e @code{$4} ha come valore @code{"ddd"}.
@end table
-L'assegnazione di un valore a @code{FS} fa s@`{@dotless{i}} che @command{gawk} usi @code{FS}
+L'assegnamento di un valore a @code{FS} fa s@`{@dotless{i}} che @command{gawk} usi @code{FS}
per separare nuovamente i campi. Si pu@`o usare @samp{FS = FS} per ottenere
questo effetto, senza dover conoscere il valore corrente di @code{FS}.
Per vedere quale tipo di separazione sia in atto,
@@ -8592,6 +8719,10 @@ parole, @code{FS} definisce cosa un campo @emph{non @`e}, invece di cosa
Tuttavia, ci sono casi in cui effettivamente si ha bisogno di definire i campi
in base a cosa essi sono, e non in base a cosa non sono.
+@cindex dati CSV (valori separati da virgole) @subentry analizzare con @code{FPAT}
+@cindex CSV (valori separati da virgole) come dati @subentry analizzare con @code{FPAT}
+@cindex Comma Separated Values (CSV) come dati @subentry analizzare con @code{FPAT}
+@cindex valori separati da virgole (CSV) come dati @subentry analizzare con @code{FPAT}
Il caso pi@`u emblematico @`e quello dei dati cosiddetti @dfn{comma-separated
value} (CSV). Molti fogli elettronici, per esempio, possono esportare i dati
in file di testo, dove ogni record termina con un ritorno a capo e i campi
@@ -8710,7 +8841,7 @@ FPAT = "([^,]*)|(\"[^\"]+\")"
@c Per email from Ed Morton <mortoneccc@comcast.net>
@c
@c WONTFIX: 10/2020
-@c This is too much work. FPAT and CSV files are very flakey and
+@c This is too much work. FPAT and CSV files are very flaky and
@c fragile. Doing something like this is merely inviting trouble.
Come per @code{FS}, la variabile @code{IGNORECASE}
@@ -8789,8 +8920,20 @@ $ @kbd{gawk -v fpat=2 -f test-csv.awk sample.csv}
@print{} NF = 3 <p><><s>
@end example
+@cindex Collado, Manuel
+@cindex @code{CSVMODE}, libreria per @command{gawk}
+@cindex libreria @subentry @code{CSVMODE} per @command{gawk}
+@cindex dati CSV (valori separati da virgole) @subentry analizzare con libreria @code{CSVMODE}
+@cindex CSV (valori separati da virgole) come dati @subentry analizzare con libreria @code{CSVMODE}
+@cindex valori separati da virgole (CSV) come dati @subentry analizzare con libreria @code{CSVMODE}
+In generale, usare @code{FPAT} per effettuare l'analisi di dati in formato CSV
+@`e come utilizzare un lenzuolo troppo corto. Rimane sempre un angolo che non
+@`e coperto. Si raccomanda, in alternativa, di usare la libreria @code{CSVMODE}
+messa a disposizione da Manuel Collado. Vedere:
+@uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} libreria per @command{gawk}}.
+
@node Controllare la creazione di campi
-@section Controllare come @command{gawk} sta dividendo i record
+@section Controllare come @command{gawk} sta suddividendo i record
@cindex @command{gawk} @subentry separazione in campi e
Come visto sopra, @command{gawk} fornisce tre metodi indipendenti per
@@ -10198,7 +10341,7 @@ ci aggiunge una stringa detta @dfn{separatore record in output} (o
Per cambiare il tipo di separazione in output di campi e record, si impostano
valori differenti alle variabili @code{OFS} e @code{ORS}. Il posto pi@`u
indicato per farlo @`e nella regola @code{BEGIN}
-(@pxref{BEGIN/END}), in modo che l'assegnazione abbia effetto prima
+(@pxref{BEGIN/END}), in modo che l'assegnamento abbia effetto prima
dell'elaborazione di ogni record in input. Questi valori si possono
anche impostare dalla riga di comando, prima della lista dei file in input,
oppure usando l'opzione della riga di comando @option{-v}
@@ -10449,9 +10592,16 @@ printf "%4.3e\n", 1950
stampa @samp{1.950e+03}, con un totale di quattro cifre significative, tre
delle quali
seguono il punto che separa la parte intera da quella decimale
-[in Italia si usa la virgola al posto del punto]
+[in Italia si usa la virgola al posto del punto e viceversa]
(L'espressione @samp{4.3} rappresenta due modificatori,
-introdotti nella prossima @value{SUBSECTION}).
+introdotti
+@ifnotinfo
+nella prossima
+@end ifnotinfo
+@ifinfo
+nel prossimo
+@end ifinfo
+@value{SUBSECTION}).
@samp{%E} usa @samp{E} invece di @samp{e} nell'output.
@item @code{%f}
@@ -10466,16 +10616,23 @@ printf "%4.3f", 1950
stampa @samp{1950.000}, con un minimo di quattro cifre significative, tre
delle quali vengono dopo il punto decimale.
(L'espressione @samp{4.3} rappresenta due modificatori,
-introdotti nella prossima @value{SUBSECTION}).
+introdotti
+@ifnotinfo
+nella prossima
+@end ifnotinfo
+@ifinfo
+nel prossimo
+@end ifinfo
+@value{SUBSECTION}).
In sistemi che implementano il formato in virgola mobile, come specificato
dallo standard IEEE 754, il valore infinito negativo @`e rappresentato come
@samp{-inf} o @samp{-infinity},
e l'infinito positivo come
@samp{inf} o @samp{infinity}.
-Il valore speciale ``not a number'' [non @`e un numero] viene scritto come
+Il valore speciale ``not a number'' ["non @`e un numero"] viene scritto come
@samp{-nan} o @samp{nan}
-(@pxref{Definizioni matematiche}).
+(@pxref{Valori strani}).
@item @code{%F}
Come @samp{%f}, ma i valori di infinito e di ``not a number'' sono scritti
@@ -10532,7 +10689,7 @@ stampare valori non validi, o comportarsi in modo completamente differente.
@quotation NOTA
Lo standard IEEE 754 per l'aritmetica in virgola mobile consente di
avere valori speciali per rappresentare ``infinito'' (sia positivo che
-negativo) e valori che sono ``non numerici'' (NaN - [Not a Number]).
+negativo) e valori che sono ``non numerici'' (NaN - [Non un Numero]).
L'input e l'output di tali valori avviene sotto forma di stringhe di
testo. Ci@`o pone dei problemi nel linguaggio @command{awk}, che
@@ -11767,7 +11924,14 @@ combinazioni tra questi usando diversi operatori.
@section Costanti, variabili e conversioni
Le espressioni sono costruite a partire da valori e dalle operazioni eseguite
-su di essi. Questa @value{SECTION} descrive gli oggetti elementari
+su di essi.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION} descrive gli oggetti elementari
che forniscono i valori usati nelle espressioni.
@menu
@@ -12277,6 +12441,19 @@ delle funzioni predefinite sopra elencate o passata come parametro
a una funzione definita dall'utente.
@end itemize
+Si pu@`o usare l'opzione @option{-v} (@pxref{Opzioni}) per assegnare
+sulla riga di comando una costante @dfn{regexp} fortemente tipizzata
+a una variabile, cos@`{@dotless{i}}:
+
+@example
+gawk -v cerca='@@/qualcosa(interessante)+/' @dots{}
+@end example
+
+@noindent
+Si possono anche fare tali assegnamenti con regolari argomenti
+sulla riga di comando
+(@pxref{Altri argomenti}).
+
Si pu@`o usare la funzione predefinita @code{typeof()}
(@pxref{Funzioni per i tipi})
per determinare se un parametro passato a una funzione
@@ -12295,6 +12472,23 @@ Quando sono usate per effettuare conversioni numeriche, le variabili
Quando sono usate per effettuare conversioni a stringhe, vengono convertite
al valore di stringa del testo della @dfn{regexp} originale.
+C'@`e un interessante, ulteriore, caso particolare. Quando le variabili
+fortemente tipizzate sono usate come terzo argomento nelle chiamate a
+@code{sub()} o @code{gsub()}, continuano a restare dello stesso tipo.
+Quindi, in un caso come quello di quest'esempio:
+
+@example
+re = @/non allarmatevi!/
+sub(/non/, "", re)
+print typeof(re), re
+@end example
+
+@noindent
+la variabile @code{re} resta sempre dello stesso tipo [@dfn{regexp}],
+ma cercher@`a una corrispondenza alla stringa @samp{allarmatevi!}.
+Questa @`e una maniera (molto indiretta) di create variabili di
+tipo @dfn{regext} in fase di esecuzione del programma.
+
@node Variabili
@subsection Variabili
@@ -12452,7 +12646,14 @@ Sono ricordate qui solo per completezza.
Le conversioni di numeri in stringhe e di stringhe in numeri sono generalmente
semplici. Ci possono essere delle sottigliezze che bisogna tenere presenti;
-questa @value{SECTION} tratta di quest'importante sfaccettatura di @command{awk}.
+@value{SECTION}
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+tratta di quest'importante sfaccettatura di @command{awk}.
@menu
* Stringhe e numeri:: Come @command{awk} converte tra
@@ -13160,16 +13361,18 @@ Per avere la massima portabilit@`a, non usare l'operatore @samp{**=}.
@sidebar Ambiguit@`a sintattiche tra @samp{/=} e le espressioni regolari
@cindex angolo buio @subentry costanti @dfn{regexp} @subentry operatore @code{/=} e
-@cindex @code{/} (barra) @subentry operatore @code{/=} @subentry vs. costante @dfn{regexp} @code{/=@dots{}/}
-@cindex barra (@code{/}) @subentry operatore @code{/=} @subentry vs. costante @dfn{regexp} @code{/=@dots{}/}
+@cindex @code{/} (barra) @subentry operatore @code{/=} @subentry vs.@: costante @dfn{regexp} @code{/=@dots{}/}
+@cindex barra (@code{/}) @subentry operatore @code{/=} @subentry vs.@: costante @dfn{regexp} @code{/=@dots{}/}
@cindex @dfn{regexp} @subentry costanti @subentry @code{/=@dots{}/}, operatore @code{/=} e
@c derived from email from "Nelson H. F. Beebe" <beebe@math.utah.edu>
@c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT)
-@cindex angolo buio @subentry operatore @code{/=} vs. costante @dfn{regexp} @code{/=@dots{}/}
-@cindex ambiguit@`a sintattica: operatore @code{/=} vs. costante @dfn{regexp} @code{/=@dots{}/}
-@cindex sintattica @subentry ambiguit@`a: operatore @code{/=} vs. costante @dfn{regexp} @code{/=@dots{}/}
+@cindex angolo buio @subentry operatore @code{/=} vs.@: costante @dfn{regexp} @code{/=@dots{}/}
+@cindex ambiguit@`a sintattica: operatore @code{/=} vs.@: costante @dfn{regexp} @code{/=@dots{}/}
+@cindex sintattica @subentry ambiguit@`a: operatore @code{/=} vs.@: costante @dfn{regexp} @code{/=@dots{}/}
+@cindex @code{/=} (uguale) @subentry operatore vs.@: @code{/=@dots{}/} costante @dfn{regexp}
+@cindex uguale (@code{/=}) @subentry operatore vs.@: @code{/=@dots{}/} costante @dfn{regexp}
C'@`e un'ambiguit@`a sintattica tra l'operatore di assegnamento @code{/=}
e le costanti @dfn{regexp} il cui primo carattere sia @samp{=}.
@value{DARKCORNER}
@@ -13331,8 +13534,15 @@ Si dovrebbero evitare cose come queste nei programmi.
In certi contesti, i valori delle espressioni servono anche come
``valori di verit@`a''; cio@`e, determinano quale sar@`a la direzione che il
-programma prender@`a durante la sua esecuzione. Questa
-@value{SECTION} descrive come @command{awk} definisce ``vero'' e ``falso''
+programma prender@`a durante la sua esecuzione.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+descrive come @command{awk} definisce ``vero'' e ``falso''
e come questi valori sono confrontati.
@menu
@@ -14996,12 +15206,13 @@ Ci@`o non @`e pi@`u obbligatorio, ma @`e una buona idea continuare a seguire que
modello per migliorare l'organizzazione e la leggibilit@`a del programma.
Regole multiple @code{BEGIN} ed @code{END} sono utili per scrivere funzioni
-di libreria, poich@'e ogni file di libreria pu@`o avere la sua propria regola
-@code{BEGIN} e/o @code{END} per fare la propria inizializzazione e/o pulizia.
+di libreria, poich@'e ogni file di una libreria pu@`o avere la sua propria
+regola @code{BEGIN} e/o @code{END} per fare la propria inizializzazione e/o
+pulizia.
L'ordine in cui le funzioni di libreria sono menzionate nella riga dei comandi
determina l'ordine in cui le rispettive regole @code{BEGIN} ed @code{END} sono
eseguite. Per questo motivi, occorre prestare attenzione nello scrivere tali
-regole nei file di libreria, in modo che non sia importante
+regole nelle librerie di file, in modo che non sia importante
l'ordine in cui tali regole vengono eseguite.
@xref{Opzioni} per maggiori informazioni sull'uso di funzioni di libreria.
@iftex
@@ -15127,11 +15338,11 @@ I codici delle regole @code{BEGINFILE} sono eseguiti subito prima che
@`e impostata al nome del file corrente e @code{FNR} @`e impostata a zero.
Prima della @value{PVERSION} 5.1.1 di @command{gawk}, per un difetto di
-implementazione, @code{$0} e i campi del record mantenevano, nelle regole
+implementazione, @code{$0} e i campi del record mantenevano nelle regole
@code{BEGINFILE} il valore che avevano in precedenza.
A partire dalla @value{PVERSION} 5.1.1, sia @code{$0} che i campi del
record sono impostati alla stringa nulla, poich@'e nessun record @`e
-ancora stato letto dal file in procinto di essere elaborato.
+ancora stato letto dal file che sta per essere di essere elaborato.
La regola @code{BEGINFILE} d@`a la possibilit@`a di eseguire due compiti
che sarebbe difficile o impossibile effettuare altrimenti:
@@ -15194,7 +15405,7 @@ modalit@`a compatibile (@pxref{Opzioni}), non sono regole speciali.
@node Vuoto
@subsection Il criterio di ricerca vuoto
-@cindex vuoto @subentry criterio di ricerca
+@cindex vuoti @subentry criteri di ricerca
@cindex criteri di ricerca @subentry vuoti
Un criterio di ricerca vuoto (cio@`e omesso) corrisponde a
@emph{ogni} record in input. Per esempio, il programma:
@@ -16060,16 +16271,17 @@ risultato.
In @command{gawk}, l'esecuzione di @code{nextfile} produce ulteriori effetti:
le eventuali regole @code{ENDFILE}
sono eseguite se @command{gawk} non
-si trova correntemente all'interno di una regola @code{END} o
-@code{BEGINFILE}; @code{ARGIND} @`e
+si trova correntemente all'interno di una regola @code{END},
+@code{ARGIND} @`e
incrementato e le eventuali regole @code{BEGINFILE} sono eseguite.
(@code{ARGIND} non @`e stato ancora trattato.
@xref{Variabili predefinite}.)
-In @command{gawk}, @code{nextfile} @`e utile all'interno di una regola
+C'@`e un ulteriore caso speciale di utilizzo in @command{gawk}.
+@code{nextfile} @`e utile all'interno di una regola
@code{BEGINFILE} per evitare di elaborare un file che altrimenti causerebbe
un errore fatale in @command{gawk}.
-In questo caso, le regole @code{ENDFILE} non vengono eseguite.
+In questo caso speciale, le regole @code{ENDFILE} non vengono eseguite.
@xref{BEGINFILE/ENDFILE}.
Sebbene possa sembrare che @samp{close(FILENAME)} ottenga lo stesso
@@ -16203,7 +16415,14 @@ maniera desiderata. Altre variabili sono impostate automaticamente da
informazioni sul modo di procedere interno di @command{awk}.
@cindex @command{gawk} @subentry variabili predefinite e
-Questa @value{SECTION} documenta tutte le variabili predefinite di
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+documenta tutte le variabili predefinite di
@command{gawk}; molte di queste variabili sono anche documentate nei
@value{CHAPTER} che descrivono le loro aree di influenza.
@@ -16694,7 +16913,14 @@ Il numero di campi nel corrente record in input.
quando un nuovo campo viene creato,
o quando si modifica @code{$0} (@pxref{Campi}).
-A differenza di molte altre variabili descritte in questa @value{SUBSECTION},
+A differenza di molte altre variabili descritte in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SUBSECTION},
l'assegnamento di un valore a @code{NF} pu@`o potenzialmente influenzare
il funzionamento interno di @command{awk}. In particolare, assegnamenti
a @code{NF} si possono usare per aggiungere o togliere campi dal
@@ -17384,7 +17610,14 @@ di @command{gawk} di consentire veri vettori di vettori.
@node Fondamenti sui vettori
@section Informazioni di base sui vettori
-Questa @value{SECTION} espone le nozioni fondamentali: elaborare gli elementi
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+espone le nozioni fondamentali: elaborare gli elementi
di un vettore uno alla volta, e visitare sequenzialmente tutti gli elementi
di un vettore.
@@ -18895,13 +19128,29 @@ programma quale funzione chiamare.
@section Funzioni predefinite
Le funzioni @dfn{predefinite} sono sempre disponibili per essere chiamate
-da un programma @command{awk}. Questa @value{SECTION} definisce tutte le
+da un programma @command{awk}.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+definisce tutte le
funzioni predefinite di @command{awk}; di alcune di queste si fa menzione
-in altre @value{SECTIONS},
+@ifnotinfo
+in altre
+@end ifnotinfo
+@ifinfo
+in altri
+@end ifinfo
+@value{SECTIONS},
ma sono comunque riassunte anche qui per comodit@`a.
@menu
* Chiamare funzioni predefinite:: Come chiamare funzioni predefinite.
+* Funzioni booleane:: Una funzione che restituisce valori
+ booleani.
* Funzioni numeriche:: Funzioni che trattano numeri, comprese
@code{int()}, @code{sin()} e @code{rand()}.
* Funzioni per stringhe:: Funzioni di manipolazione di stringhe,
@@ -18981,6 +19230,26 @@ con i due argomenti 6 e 12. Ma se l'ordine di valutazione @`e da destra a
sinistra, @code{i} assume dapprima il valore 10, e poi il valore 11, e la
funzione @code{atan2()} @`e chiamata con i due argomenti 11 e 10.
+@node Funzioni booleane
+@subsection Generare valori booleani
+@cindex booleane @subentry funzioni
+@cindex funzioni @subentry booleane
+
+Questa funzione @`e specifica di @command{gawk}. Non @`e disponibile
+modalit@`a compatibile (@pxref{Opzioni}):
+
+@c @asis for docbook
+@table @asis
+@item @code{mkbool(@var{espressione})}
+@cindexgawkfunc{mkbool}
+Restituisce un valore di tipo booleano, a partire dal valore booleano
+calcolato di @var{espressione}.
+Il valore booleano ``true'' [vero] ha il valore numerico uno.
+Il valore booleano ``false'' [false] ha il valore numerico zero.
+Questo @`e trattato in maggior dettaglio in
+@ref{Valori di tipo booleano}.
+@end table
+
@node Funzioni numeriche
@subsection Funzioni numeriche
@cindex funzioni @subentry numeriche
@@ -19051,8 +19320,8 @@ modalit@`a compatibile (@pxref{Opzioni}).
@cindexawkfunc{log}
@cindex logaritmo
Restituisce il logaritmo naturale di @var{x}, se @var{x} @`e positivo;
-altrimenti, restituisce @code{NaN} (``not a number'') sui sistemi che
-implementano lo standard IEEE 754.
+altrimenti, restituisce NaN (``not a number'',[Non un Numero])
+sui sistemi che implementano lo standard IEEE 754.
Inoltre, @command{gawk} stampa un messaggio di avvertimento qualora @code{x}
sia negativo.
@@ -19176,7 +19445,15 @@ a seconda delle implementazioni @command{awk}.
@subsection Funzioni di manipolazione di stringhe
@cindex funzioni @subentry di manipolazione di stringhe
-Le funzioni in questa @value{SECTION} leggono o modificano il testo di
+Le funzioni in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION}
+leggono o modificano il testo di
una o pi@`u stringhe.
@command{gawk} implementa la localizzazione
@@ -19304,6 +19581,10 @@ se si specifica un secondo vettore da usare per contenere il risultato
dell'ordinamento.
@end quotation
+@`E consentito specificare come argomento lo stesso vettore sia come
+@var{sorgente} che come @var{destinazione}, ma ha senso farlo solo
+se si specifica anche il terzo argomento.
+
@item @code{gensub(@var{regexp}, @var{rimpiazzo}, @var{come}} [@code{, @var{obiettivo}}]@code{) #}
@cindexgawkfunc{gensub}
@cindex cercare e rimpiazzare in stringhe
@@ -19320,6 +19601,9 @@ Se non si specifica il nome dell'@var{obiettivo}, si
opera su @code{$0}. La funzione restituisce come risultato la stringa
modificata, e la stringa originale di partenza @emph{non} viene modificata.
+Il valore restituito @`e @emph{sempre} una stringa, anche se il
+valore dell'@var{obiettivo} era un numero o una @dfn{regexp}.
+
@code{gensub()} @`e una funzione generale di sostituzione. Mira a fornire
pi@`u funzionalit@`a rispetto alle funzioni standard @code{sub()} e
@code{gsub()}.
@@ -19372,6 +19656,8 @@ un messaggio di avvertimento.
Se @var{regexp} non viene trovata in @var{obiettivo}, il valore
restituito da @code{gensub()}
@`e il valore originale e non modificato di @var{obiettivo}.
+Si noti che, come detto sopra, il valore restituito @`e una stringa,
+anche se l'@var{obiettivo} non lo era.
@item @code{gsub(@var{regexp}, @var{rimpiazzo}} [@code{, @var{obiettivo}}]@code{)}
@cindexawkfunc{gsub}
@@ -21497,6 +21783,9 @@ Restituisce una delle stringhe seguenti, a seconda del tipo di @var{x}:
@item "number"
@var{x} @`e un numero.
+@item "number|bool"
+@var{x} @`e un valore di tipo booleano (@pxref{Valori di tipo booleano}).
+
@item "string"
@var{x} @`e una stringa.
@@ -21778,8 +22067,15 @@ Tutte le funzioni predefinite restituiscono un valore al loro chiamante.
Anche le funzioni definite dall'utente possono farlo, usando
l'istruzione @code{return},
che @`e descritta in dettaglio nella @ref{Istruzione return}.
-Molti dei successivi esempi in questa @value{SECTION} usano
-l'istruzione @code{return}.
+Molti dei successivi esempi in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION}
+usano l'istruzione @code{return}.
@cindex estensioni comuni @subentry parola chiave @code{func}
@c @cindex @command{awk} language, POSIX version
@@ -22454,7 +22750,13 @@ esserne a conoscenza.
@cindex puntatori a funzioni
@cindex differenze tra @command{awk} e @command{gawk} @subentry chiamata indiretta di funzione
-Questa sezione descrive un'estensione avanzata, specifica di @command{gawk}.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION} descrive un'estensione avanzata, specifica di @command{gawk}.
Spesso pu@`o essere utile ritardare la scelta della funzione da chiamare
fino al momento in cui il programma viene eseguito.
@@ -22525,7 +22827,7 @@ usando la chiamata indiretta di funzioni:
@example
@c file eg/prog/indirectcall.awk
-# chiamataindiretta.awk --- esempio di chiamata indiretta di funzioni
+# indirectcall.awk --- esempio di chiamata indiretta di funzioni
@c endfile
@ignore
@c file eg/prog/indirectcall.awk
@@ -23187,7 +23489,15 @@ potrebbero aver usato gli elementi di vettore
@code{@w{_pw_awklib}} e
@code{@w{_pw_contatore}}.
-Le convenzioni illustrate in questa @value{SECTION} sono esattamente
+Le convenzioni illustrate in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION}
+sono esattamente
quello che indica il termine: convenzioni. Non si @`e obbligati a scrivere
i propri programmi in questo modo: @`e solo auspicabile che lo si faccia.
@@ -23200,7 +23510,14 @@ in @ref{Spazi-dei-nomi}.
@node Funzioni di tipo generale
@section Programmazione di tipo generale
-Questa @value{SECTION} illustra diverse funzioni che sono di uso generale nella
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+illustra diverse funzioni che sono di uso generale nella
programmazione.
@menu
@@ -23221,6 +23538,8 @@ programmazione.
un colpo solo.
* Apici alla shell:: Una funzione per passare stringhe
con apici alla shell.
+* Funzione isnumeric:: Una funzione per controllare se un valore
+ @`e numerico.
@end menu
@node Funzione strtonum
@@ -24060,6 +24379,50 @@ function shell_quote(s, # parametro
@c endfile
@end example
+@node Funzione isnumeric
+@subsection Controllare se un valore @`e numerico
+
+Una domanda spesso posta in programmazioni @`e come accertarsi se un dato
+valore @`e di tipo numerico. Il problema pu@`o essere risolto usando la
+funzione di esempio @code{isnumeric()}, che utilizza l'artificio di
+trasformare l'input ricevuto dell'utente nel valore di una stringa,
+utilizzando la funzione @code{split()}:
+
+@cindex @code{isnumeric()} @subentry funzione definita dall'utente
+@cindex funzione definita dall'utente @subentry @subentry @code{isnumeric()}
+@example
+@c file eg/lib/isnumeric.awk
+# isnumeric --- controlla se un valore @`e numerico
+
+function isnumeric(x, f)
+@{
+ switch (typeof(x)) @{
+ case "strnum":
+ case "number":
+ return 1
+ case "string":
+ return (split(x, f, " ") == 1) && (typeof(f[1]) == "strnum")
+ default:
+ return 0
+ @}
+@}
+@c endfile
+@end example
+
+Si noti che gli eventuali spazi bianchi prima o dopo la stringa sono
+ignorati nel decidere se un valore sia numerico oppure no; se la cosa
+@`e importante in una data situazione, occorre aggiungere un apposito
+controllo ulteriore.
+
+Tradizionalmente, per controllare se un valore @`e numerico, si raccomandava
+di usare il test @samp{x+0 == x}. La funzione @code{isnumeric} @`e migliore
+sotto due aspetti: non attribuisce un valore numerico a variabili a cui
+non sia stato ancora assegnato un valore; e riconosce valori di stringa
+con contenuto numerico quando @code{CONVFMT} non genera una stringa
+uguale a quella originale.
+Tuttavia, per farlo, utilizza la funzione @code{typeof()}
+(@pxref{Funzioni per i tipi}), che @`e disponibile solo in @command{gawk}.
+
@node Gestione File Dati
@section Gestione di @value{DF}
@@ -24067,8 +24430,14 @@ function shell_quote(s, # parametro
@cindex gestione di file
@cindex libreria di funzioni @command{awk} @subentry gestire file di dati
@cindex funzioni @subentry libreria di @subentry gestire file di dati
-Questa @value{SECTION} presenta funzioni utili per gestire
-@value{DF} da riga di comando.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+presenta funzioni utili per gestire @value{DF} da riga di comando.
@menu
* Funzione filetrans:: Una funzione per gestire il passaggio da un
@@ -24975,8 +25344,8 @@ $ @kbd{awk -f getopt.awk -v _getopt_test=1 -- -a \}
@print{} c = <otherd>, Optarg = <>
@print{} c = <otherc>, Optarg = <>
@print{} argomenti che non sono opzioni:
-@print{} ARGV[8] = <arg1>
-@print{} ARGV[9] = <arg2>
+@print{} ARGV[8] = <arg1>
+@print{} ARGV[9] = <arg2>
@end example
In tutte le esecuzioni, il primo @option{--} fa terminare gli argomenti dati
@@ -25109,11 +25478,7 @@ main(int argc, char **argv)
@c endfile
@ignore
@c file eg/lib/pwcat.c
-#ifdef ZOS_USS
- printf("%s:%ld:%ld:%s:%s\n",
- p->pw_name, (long) p->pw_uid,
- (long) p->pw_gid, p->pw_dir, p->pw_shell);
-#else
+#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD
@c endfile
@end ignore
@c file eg/lib/pwcat.c
@@ -25123,6 +25488,10 @@ main(int argc, char **argv)
@c endfile
@ignore
@c file eg/lib/pwcat.c
+#else
+ printf("%s:*:%ld:%ld:%s:%s\n",
+ p->pw_name, (long) p->pw_uid,
+ (long) p->pw_gid, p->pw_dir, p->pw_shell);
#endif
@c endfile
@end ignore
@@ -26138,7 +26507,14 @@ cut.awk -- -c1-8 i_miei_file > risultati
@cindex programmi POSIX @subentry implementazione in @command{awk}
@cindex POSIX @subentry programmi @subentry implementazione in @command{awk}
-Questa @value{SECTION} presenta un certo numero di programmi di utilit@`a
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+presenta un certo numero di programmi di utilit@`a
POSIX implementati in @command{awk}. Riscrivere questi programmi in
@command{awk} @`e spesso divertente,
perch@'e gli algoritmi possono essere espressi molto chiaramente, e il codice
@@ -26199,13 +26575,13 @@ possono essere separati da virgole, e intervalli di caratteri possono essere
separated da trattini. La lista
@samp{1-8,15,22-35} specifica i caratteri da 1 a 8, 15, e da 22 a 35.
-@item -f @var{lista}
-Usare @var{lista} come lista di campi da ritagliare.
-
@item -d @var{delimitatore}
Usare @var{delimitatore} come carattere che separa i campi invece del
carattere TAB.
+@item -f @var{lista}
+Usare @var{lista} come lista di campi da ritagliare.
+
@item -s
Evita la stampa di righe che non contengono il delimitatore di campo.
@end table
@@ -26216,6 +26592,12 @@ di libreria @code{getopt()}
e la funzione di libreria @code{join()}
(@pxref{Funzione join}).
+La versione POSIX corrente del comando @command{cut} prevede opzioni
+per ritagliare dei campi che possono essere sia byte che caratteri
+[possibilmente multibyte]. Questa versione non tenta di implementare
+tali opzioni, poich@'e @command{awk} lavora esclusivamente in termini
+di caratteri.
+
Il programma inizia con un commento che descrive le opzioni, le funzioni
di libreria necessarie, e una funzione @code{sintassi()} che stampa un
messaggio ed esce. @code{sintassi()} @`e chiamato se si specificano degli
@@ -26237,9 +26619,9 @@ argomenti non validi:
@c file eg/prog/cut.awk
# Opzioni:
+# -c lista Ritagliare caratteri
# -f lista Ritagliare campi
# -d c Carattere di delimitazione di campo
-# -c lista Ritagliare caratteri
#
# -s Sopprimere righe che non contengono il delimitatore
#
@@ -26315,7 +26697,7 @@ un semplice spazio (@code{@w{" "}}) come valore per @code{FS} @`e
sbagliato: @command{awk} separerebbe i campi con serie di spazi,
TAB, e/o ritorni a capo, mentre devono essere separati solo da uno spazio.
Per far questo, salviamo il carattere di spazio originale nella variabile
-@code{fs} per un uso futuro; dopo aver impostato @code{FS} a @code{"[ ]"} non
+@code{fs} per un uso futuro; dopo aver impostato @code{FS} a @code{@w{"[ ]"}} non
@`e possibile usarlo direttamente per vedere se il carattere delimitatore di
campo @`e nella stringa.
@@ -26595,11 +26977,11 @@ da implementare con @command{gawk}; basta usare la variabile predefinita
# -e l'argomento @`e un'espressione regolare
# -i ignora maiuscolo/minuscolo
# -l stampa solo nomi file
-# -n aggiungi numeri linea in output
+# -n aggiungi numeri riga in output
# -q quieto - usa solo il codice di ritorno
# -s silenzioso - non stampa messaggi di errore
-# -v inverte test, successo se espression non trovata
-# -x l'intera linea deve corrispondere
+# -v inverte test, successo se espressione non viene trovata
+# -x l'intera riga deve corrispondere
#
# Richiede la funzione getopt()
# Usa IGNORECASE, BEGINFILE ed ENDFILE
@@ -26633,14 +27015,17 @@ BEGIN @{
@noindent
Si noti il commento relativo alla chiamata del programma:
-Poich@'e parecchie opzioni possono essere sepcificate anche per
-@command{gawk}, occorre immettere @option{--} per far s@`@{dotless{i}} che
+Poich@'e parecchie opzioni possono essere specificate anche per
+@command{gawk}, occorre immettere @option{--} per far s@`{@dotless{i}} che
@command{gawk} non prosegua nell'analisi delle opzioni.
Nel seguito c'@`e il codice che gestisce il comportamento specifico di
-@command{egrep}. Se non @`e fornito esplicitamente alcun criterio di ricerca
-tramite l'opzione @option{-e}, si usa il primo argomento sulla riga di
-comando che non sia un'opzione.
+@command{egrep}. @command{egrep} utilizza il primo argomento sulla
+riga di comando che non sia un'opzione se non @`e fornito esplicitamente
+alcun criterio di ricerca tramite l'opzione @option{-e}.
+Se il criterio di ricerca @`e la stringa nulla, ci@`o significa che non
+@`e stato fornito alcun criterio, quindi @`e necessario stampare un
+messaggio di errore e terminare il programma.
Gli argomenti della riga di comando di @command{awk} fino ad
@code{ARGV[Optind]} vengono cancellati,
in modo che @command{awk} non tenti di elaborarli come file. Se
@@ -26694,12 +27079,12 @@ BEGINFILE @{
La regola @code{ENDFILE} viene eseguita alla fine dell'elaborazione
di ogni file. Genera dell'output solo quando l'utente richiede un
-contatore del numero di righe che sono state trovate corrispondere.
+contatore del numero di righe corrispondenti che sono state trovate.
La variabile @code{non_stampare} @`e vera qualora si chieda di
impostare solo il codice di ritorno.
La variabile @code{conta_e_basta} @`e vera qualora si chieda solo
-il numero delle righe che sono state trovare corrispondere.
+il numero delle righe corrispondenti che sono state trovate.
@command{egrep} quindi stampa il contatore delle corrispondenze
trovate solo se sia la stampa che il conteggio righe sono richieste.
Il formato dell'output dev'essere adattato, a seconda del numero di
@@ -26734,9 +27119,9 @@ verificando i valori delle variabili @code{RSTART} e @code{RLENGTH}.
Se questi indicano che la corrispondenza non coincide con l'intera
riga, la variabile @code{corrisponde} @`e impostata a zero (falsa).
-Se l'utente chiede invece le righe che @emph{non} corrispondono,
-il senso di @code{corrisponde} @`e invertito, usando l'operatore @samp{!}.
-@code{contatore_file} @`e incrementato con il valore di
+Se l'utente chiede invece le righe che non corrispondono, si inverte
+il senso di @code{corrisponde}, usando l'operatore @samp{!}.
+Poi, @code{contatore_file} @`e incrementato con il valore di
@code{corrisponde}, che vale uno o zero, a seconda che la corrispondenza sia
stata trovata oppure no. Se la riga non corrisponde, l'istruzione
@code{next} passa ad esaminare il record successivo.
@@ -26855,14 +27240,14 @@ Usa la funzione di libreria @code{getopt()}
(@pxref{Funzione getopt}),
le funzioni di libreria del database che descrive gli utenti
(@pxref{Funzioni Passwd}),
-Usa le funzioni di libreria che riguardano il database degli utenti
+le funzioni di libreria che riguardano il database degli utenti
(@pxref{Funzioni Passwd})
e le funzioni di libreria che riguardano il database dei gruppi
(@pxref{Funzioni Group}).
Il programma @`e abbastanza semplice. Tutto il lavoro @`e svolto nella regola
@code{BEGIN}.
-Inizia com dei commenti di spiegazioni, una lista di opzioni e infine
+Inizia con dei commenti di spiegazione, una lista di opzioni e infine
una funzione @code{sintassi()} function:
@cindex @code{id.awk} (programma)
@@ -26939,7 +27324,7 @@ BEGIN @{
@end example
Il passo successivo @`e quello di controllare che non siano state
-specificate opzioni mutualmente esclusive.
+specificate opzioni mutuamente esclusive.
Le opzioni @option{-G} e @option{-r} sono di questo tipo.
Inoltre, non @`e possibile specificare pi@`u di un nome utente
sulla riga di comando:
@@ -26958,7 +27343,7 @@ dal vettore @code{PROCINFO} dell'utente corrente, oppure
dal database degli utenti e delle password, per un
utente il cui nome sia stato specificato nella riga di
comando.
-In quest'ultimo caos, viene impostato il flag @code{real_ids_only},
+In quest'ultimo caso, viene impostato il flag @code{real_ids_only},
poich@'e non @`e possibile stampare informazioni riguardo agli
ID di utente e di gruppo effettivi:
@@ -27075,9 +27460,9 @@ Una logica simile viene seguita per l'opzione @option{-u}
@end example
A questo punto non abbiamo ancora finito, e quindi stampiamo
-l'output normale, di default, a riguardo dell'utente corrente
-o dell'utente che era stato specificato sulla riga di comando.
-Iniziamo a stmpare l'user ID reale:
+l'output normale, di default, relative all'utente corrente
+o all'utente che era stato specificato sulla riga di comando.
+Iniziamo a stampare l'user ID reale:
@example
@c file eg/prog/id.awk
@@ -27256,7 +27641,7 @@ ogni file dovrebbe essere lungo (al massimo) @var{N} byte.
Se si specifica la lettera @samp{k}, il numero @var{N} viene
moltiplicato per 1.024, ossia diviene il numero di kilobyte.
Se si specifica la lettera @samp{m}, il numero @var{N} viene
-moltiplicato per 1.048.576 (@math{1.024 @value{PER} 1.024})
+moltiplicato per 1.048.576 (@math{1.024 @value{VOLTE} 1.024})
ossia diviene il numero di megabyte.
(Quest'opzione @`e mutuamente esclusiva con l'opzione @option{-l}).
@@ -27285,7 +27670,9 @@ Ecco un'implementazione di @command{split} in @command{awk}. Viene utilizzata
la funzione @code{getopt()} presentata in @ref{Funzione getopt}.
Il programma inizia con un commento descrittivo e poi con la
-funzione @code{sintassi()} che ne descrive le opzioni:
+funzione @code{sintassi()} che ne descrive le opzioni. La variabile
+@code{comune} permettere di avere delle righe brevi nella funzione,
+in modo che sia stampata in maniera elegante nella pagina:
@cindex @code{split.awk} (programma)
@cindex programma @subentry @code{split.awk}
@@ -27306,10 +27693,12 @@ funzione @code{sintassi()} che ne descrive le opzioni:
@c endfile
@end ignore
@c file eg/prog/split.awk
-function sintassi()
+
+function sintassi( comune)
@{
- print("Uso: split [-l contatore] [-a lunghezza-suffisso] [file [nome-output-file]]") > "/dev/stderr"
- print(" split [-b N[k|m]] [-a lunghezza-suffisso] [file [nome-output-file]]") > "/dev/stderr"
+ comune = "[-a lunghezza-suffisso] [file [nome-output-file]]"
+ printf("Uso: split [-l contatore] %s\n", comune) > "/dev/stderr"
+ printf(" split [-b N[k|m]] %s\n", comune) > "/dev/stderr"
exit 1
@}
@c endfile
@@ -27402,7 +27791,7 @@ passare da @samp{abz} ad @samp{aca}.
@item
Si deve poter determinare se abbiamo utilizzato tutti i prefissi,
-in modo che, nel caso ci siano ulteriori dati (da suddividere) si
+in modo che, nel caso ci siano ulteriori dati (da suddividere), si
possa stampare un messaggio di errore e terminare il programma.
Il trucco @`e di gestire una tale situazione @emph{dopo} aver usato
l'ultimo suffisso disponibile, e non quando viene generato l'ultimo
@@ -27801,7 +28190,8 @@ spiegazione delle opzioni e del loro significato, sotto forma di commenti:
function sintassi()
@{
- print("Uso: uniq [-udc [-f campi]] [-s caratteri] [ in [ out ]]") > "/dev/stderr"
+ print("Uso: uniq [-udc [-f campi] [-s caratteri]] " \
+ "[ in [ out ]]") > "/dev/stderr"
exit 1
@}
@@ -28063,14 +28453,14 @@ Klingon e il linguaggio degli elfi di J.R.R.@: Tolkien).
Per risparmiare spazio nei file, i @dfn{code points} Unicode sono
@dfn{codificati}, e la rappresentazione di ogni carattere pu@`o richiedere
da uno a quattro byte nel file. UTF-8 @`e verosimilmente la pi@`u diffusa
-fra queste codifiche multi-byte (@dfn{multibyte encodings}).
+fra queste codifiche multibyte (@dfn{multibyte encodings}).
Lo standard POSIX richiede che @command{awk} gestisca dei caratteri,
non dei byte. Per questo motivo, in @command{gawk}, le funzioni
@code{length()}, @code{substr()}, @code{split()}, @code{match()} e
le altre funzioni di manipolazione di stringhe
(@pxref{Funzioni per stringhe}) funzionano tutte elaborando dei caratteri,
-come definiti dall'insieme di caratteri locale [a una determinata lingua]
+come definiti dall'insieme di caratteri localizzati [a una determinata lingua]
e non elaborando dei byte. (Incidentalmente, non tutte le implementazioni
di @command{awk} si comportano cos@`{@dotless{i}}).
@@ -28090,8 +28480,8 @@ possono anche essere dei codici scritti nei linguaggi C o C++.
Per quanto riguarda
@file{wc.awk}, @`e sufficiente sapere che l'estensione viene caricata
con la direttiva @code{@@load}, e la funzione ulteriore che dovr@`a essere
-usata si chiama @code{mbs_length()}. Questa funzione restiuisce il numero
-di byte in una stringa, e non il numero di caratteri.
+usata si chiama @code{mbs_length()}. Questa funzione restituisce il numero
+di byte in una stringa, non il numero di caratteri.
L'estensione @code{"mbs"} fa parte del progetto @code{gawkextlib}.
@xref{gawkextlib} for ulteriori informazioni.
@@ -28110,23 +28500,23 @@ standard input. Se ci sono pi@`u file, stampa anche il contatore totale di
tutti i file. Le opzioni e il loro significato sono i seguenti:
@table @code
-@item -l
-Conta solo le righe.
-
-@item -w
-Conta solo le parole.
-Una ``parola'' @`e una sequenza contigua di caratteri non bianchi, separata da
-spazi e/o TAB. Fortunatamente, questo @`e il modo normale in cui @command{awk}
-separa i campi nei suoi record in input.
-
@item -c
Conta solo i byte.
Un tempo, la lettera @samp{c} di questa opzione stava per ``caratteri.''
Ma, come spiegato pi@`u sopra, byte e carattere non sono pi@`u sinonimi
tra loro.
+@item -l
+Conta solo le righe.
+
@item -m
Conta solo caratteri.
+
+@item -w
+Conta solo le parole.
+Una ``parola'' @`e una sequenza contigua di caratteri non bianchi, separata da
+spazi e/o TAB. Fortunatamente, questo @`e il modo normale in cui @command{awk}
+separa i campi nei suoi record in input.
@end table
L'implementazione di @command{wc} in @command{awk} @`e particolarmente
@@ -28295,7 +28685,14 @@ END @{
@node Programmi vari
@section Un paniere di programmi @command{awk}
-Questa @value{SECTION} @`e un ``paniere'' che contiene vari programmi.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+@`e un ``paniere'' che contiene vari programmi.
Si spera che siano interessanti e divertenti.
@menu
@@ -28518,7 +28915,14 @@ BEGIN @{
@c endfile
@end example
-La successiva @value{SECTION} di codice scompone l'ora specificata in ore e
+@ifnotinfo
+La successiva
+@end ifnotinfo
+@ifinfo
+Il successivo
+@end ifinfo
+@value{SECTION}
+di codice scompone l'ora specificata in ore e
minuti, la converte (se @`e il caso) al formato 24-ore, e poi calcola il
relativo numero di secondi dalla mezzanotte. Poi trasforma l'ora corrente in
un contatore dei secondi dalla
@@ -29138,7 +29542,7 @@ la riga), quando la regola @`e verificata [ossia se il record non
@cindex estrarre programma da file sorgente Texinfo
@cindex file @subentry Texinfo @subentry estrarre programma da
@ifnotinfo
-Sia questo capitolo che il precedente
+Sia questo @value{CHAPTER} che il precedente
(@ref{Funzioni di libreria})
presentano un numero elevato di programmi @command{awk}.
@end ifnotinfo
@@ -29258,6 +29662,7 @@ a significare che tutto @`e andato bene:
# Arnold Robbins, arnold@@skeeve.com, Public Domain
# May 1993
# Revised September 2000
+# Antonio Colombo, October 2020, test for Italian accented letters
@c endfile
@end ignore
@c file eg/prog/extract.awk
@@ -29365,7 +29770,7 @@ La riga @`e poi stampata nel file di output:
gsub("@@`o","ò",riga)
gsub("@@`u","ù",riga)
# riga contiene ancora caratteri @@?
- if (index(riga, "@@") == 0) {
+ if (index(riga, "@@") == 0) @{
print riga > file_corrente
continue
@}
@@ -29565,7 +29970,14 @@ In
@end ifnottex
@ref{Includere file}, abbiamo visto come @command{gawk} preveda la
possibilit@`a di includere file. Tuttavia, questa @`e un'estensione @command{gawk}.
-Questa @value{SECTION} evidenzia l'utilit@`a di rendere l'inclusione di
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+evidenzia l'utilit@`a di rendere l'inclusione di
file disponibile per @command{awk} standard, e mostra come farlo utilizzando
una combinazione di programmazione di shell e di @command{awk}.
@@ -29732,7 +30144,6 @@ Il programma @`e il seguente:
# Arnold Robbins, arnold@@skeeve.com, Public Domain
# July 1993
# December 2010, minor edits
-# Antonio Colombo, October 2020, test for Italian accented letters
@c endfile
@end ignore
@c file eg/prog/igawk.sh
@@ -30612,12 +31023,14 @@ tratta della capacit@`a di aggiungere dinamicamente nuove funzioni predefinite a
@menu
* Dati non decimali:: Consentire dati di input non decimali.
+* Valori di tipo booleano:: Valori di tipo @code{number|bool} type.
* Ordinamento di vettori:: Modi per controllare la visita di un vettore
e il suo ordinamento.
* I/O bidirezionale:: Comunicazione bidirezionale con un altro
processo.
* Reti TCP/IP:: Usare @command{gawk} per programmazione di rete.
* Profilare:: Profilare i propri programmi @command{awk}.
+* Filosofia delle estensioni:: Cosa dovrebbe essere incluso e cosa no.
* Sommario funzionalit@`a avanzate:: Sommario delle funzionalit@`a avanzate.
@end menu
@@ -30681,6 +31094,55 @@ porta a risultati meno inattesi.
Quest'opzione potrebbe sparire dalle versioni future di @command{gawk}.
@end quotation
+@node Valori di tipo booleano
+@section Valori di tipo booleano
+
+I valori scalari in @command{awk} sono numeri o stringhe di caratteri.
+@command{gawk} supporta anche valori di tipo @dfn{regexp}
+(@pxref{Costanti @dfn{regexp} forti}).
+
+Come descritto in @ref{Valori di verit@`a}, ai valori booleani in
+@command{awk} non viene assegnato un tipo loro proprio:
+un valore @`e ``true'' [vero] se @`e diverso da zero e dalla stringa nulla
+e ``false'' [falso] in tutti gli altri casi.
+
+Se se devono scambiare dati con linguaggi che possiedono un tipo di
+variabile booleana vera e propria, usando un formato standard come
+JSON o XML, la mancanza di un vero tipo di variabile booleana
+in @command{awk} pu@`o essere un problema.
+(Vedere, p.es., l'estensione @code{json} fornita da
+@uref{https://sourceforge.net/projects/gawkextlib, il progetto @code{gawkextlib}}.)
+
+@`E facile importare dati di tipo booleano in @command{awk}, ma una volta
+importati l'informazione che si trattava di dati di tipo booleano viene
+persa. Esportare dati di questo tipo @`e ancora pi@`u difficile;
+non c'@`e modo per indicare che un valore @`e veramente booleano.
+
+Per risolvere questo problema, @command{gawk} mette a disposizione una
+funzione di nome @code{mkbool()}.
+La funzione ha un argomento, che pu@`o essere una qualsiasi espressione
+@command{awk} e restituisce un valore di tipo booleano.
+
+I valori cos@`{@dotless{i}} restituiti sono normali valori numerici di @command{awk},
+che possono assumere i valori uno o zero, a seconda del valore di
+verit@`a dell'espressione originale fornita nella chiamata a
+@code{mkbool()}.
+
+La funzione @code{typeof()} (@pxref{Funzioni per i tipi}) restituisce
+la stringa @code{"number|bool"} per queste variabili.
+
+Tuttavia i valori di tipo booleano @emph{sono} numeri, per @command{gawk}
+tranne che per il fatto che il codice delle estensioni a @command{gawk}
+li pu@`o trattare, volendo, come valori di tipo booleano.
+
+Anche se sarebbe stato possibile aggiungere due nuove variabili
+predefinite di tipo booleano, chiamandole @code{TRUE} [vero] e
+@code{FALSE} [falso], il farlo avrebbe certamente generato errori
+in molti programmi @command{awk} esistenti.
+Invece, l'introduzione di una funzione ``generatrice'' che crea valori
+di tipo booleano, fornisce flessibilit@`a, senza generare troppi
+errori nel codice esistente.
+
@node Ordinamento di vettori
@section Controllare la visita di un vettore e il suo ordinamento
@@ -31098,6 +31560,12 @@ del vettore originale, ed entrambi i vettori accedono all'unica copia di
valori che esiste in memoria.
@end quotation
+@`E consentito usare lo stesso vettore sia come primo che come secondo
+argomento di @code{asort()} e @code{asorti()}. Il farlo ha senso solo
+se si specifica anche il terzo argomento, poich@'e @command{awk} non
+consente di specificare un terzo argomento senza aver specificato sia
+il primo che il secondo.
+
@c Document It And Call It A Feature. Sigh.
@cindex @command{gawk} @subentry variabile @subentry @code{IGNORECASE} in
@cindex vettori @subentry ordinamento @subentry variabile @code{IGNORECASE} e
@@ -31435,7 +31903,7 @@ main(void)
printf("%d\n", x + y);
return 0;
@}
-$ @kbd{cc -O add.c -o add} @ii{Compilazione del programma}
+$ @kbd{cc -O add.c -o add} @ii{Compilazione del programma}
@end example
Si potrebbe poi scrivere un programma @command{gawk} fin troppo semplice,
@@ -31828,7 +32296,7 @@ alfabetico.
La versione profilata del proprio programma potrebbe non apparire esattamente
come quella scritta durante la stesura del programma. Questo perch@'e
-@command{gawk} crea la versione profilata facendo una ``stampa elegante'' della
+@command{gawk} crea la versione profilata facendo una ``stampa-elegante'' della
sua rappresentazione interna del programma. Un vantaggio di ci@`o @`e che
@command{gawk} pu@`o produrre una rappresentazione standard.
Inoltre, cose come:
@@ -31923,9 +32391,9 @@ tastiera. Il segnale @code{INT} @`e generato dalle combinazioni di tasti
@kbd{Ctrl-c} o @kbd{Ctrl-BREAK}, mentre il segnale
@code{QUIT} @`e generato dalla combinazione di tasti @kbd{Ctrl-\}.
-@cindex stampa elegante
+@cindex stampa-elegante
Infine, @command{gawk} accetta anche un'altra opzione, @option{--pretty-print}.
-Quando viene chiamato in questo modo, @command{gawk} fa una ``stampa elegante''
+Quando viene chiamato in questo modo, @command{gawk} fa una ``stampa-elegante''
del programma nel file @file{awkprof.out}, senza conteggi sull'esecuzione.
@quotation NOTA
@@ -31933,10 +32401,10 @@ Una volta, l'opzione @option{--pretty-print} eseguiva anche il programma.
Ora non pi@`u.
@end quotation
-@cindex profilazione @subentry differenza rispetto alla stampa elegante
-@cindex stampa elegante @subentry differenza rispetto alla profilazione
+@cindex profilazione @subentry differenza rispetto alla ``stampa-elegante''
+@cindex stampa-elegante @subentry differenza rispetto alla profilazione
C'@`e una differenza significativa tra l'output creato durante la profilazione,
-e quello creato durante la stampa elegante. L'output della stampa elegante
+e quello creato durante la ``stampa-elegante''. L'output della ``stampa-elegante''
preserva i commenti originali che erano nel programma, anche se la loro
posizione pu@`o non corrispondere esattamente alle posizioni originali che
avevano nel codice sorgente. Tuttavia, nessun commento dovrebbe andare
@@ -31948,23 +32416,83 @@ in maniera perfetta.
Comunque, per una precisa scelta progettuale, l'output della profilazione
@emph{omette} i commenti del programma originale. Questo permette di
concentrarsi sui dati del conteggio di esecuzione ed evita la tentazione di
-usare il profilatore per creare una stampa elegante.
+usare il profilatore per creare una ``stampa-elegante''.
Oltre a ci@`o, l'output stampato in modo elegante non ha l'indentazione iniziale
-che ha l'output della profilazione. Questo rende agevole la stampa elegante
+che ha l'output della profilazione. Questo rende agevole la ``stampa-elegante''
del proprio codice una volta completato lo sviluppo, usando poi il risultato
come versione finale del programma.
Poich@'e la rappresentazione interna del programma @`e formattata per
essere aderente al programma @command{awk} in questione, la profilazione
-e la stampa elegante (opzione @option{--pretty-print}) disabilitano
+e la ``stampa-elegante'' (opzione @option{--pretty-print}) disabilitano
automaticamente le optimizzazioni di default di @command{gawk}.
-La profilazione e la stampa elegante mantengono anche il formato originale
+La profilazione e la ``stampa-elegante'' mantengono anche il formato originale
delle costanti numeriche; se sono stati usati dei valori ottali o esadecimali
nel codice sorgente, questi compariranno nell'output nello stesso
formato con cui sono stati inseriti.
+@node Filosofia delle estensioni
+@section Funzionalit@`a incluse @dfn{versus} estensioni
+
+Come descritto sin qui e nei successivi @value{CHAPTERS},
+@command{gawk} ha numerose estensioni ulteriori,
+rispetto a quelle presenti nel comando @command{awk} standard.
+Queste sono state sviluppate col passare del tempo.
+Pi@`u recentemente, l'attenzione si @`e spostata sull'uso
+del meccanismo delle estensioni (@pxref{Estensioni dinamiche})
+per aggiungere ulteriori funzionalit@`a.
+@ifnotinfo
+Questa @value{SECTION}
+@end ifnotinfo
+@ifinfo
+Questo @value{SECTION}
+@end ifinfo
+tratta della ``filosofia ispiratrice'' riguardo a ci@`o che dovrebbe
+essere aggiunto all'interprete come funzionalit@`a interna,
+rispetto a quello che dovrebbe essere reso disponibile tramite
+estensioni.
+
+Ci sono parecchi obiettivi:
+
+@enumerate 1
+@item
+Conservare il comando @command{awk}; non dovrebbe divenire irriconoscibile
+anche se i programmi scritti per esso verranno eseguito usando solo
+@command{gawk}.
+
+@item
+Non aumentare le dimensioni del nucleo del programma, a meno che ci@`o
+sia assolutamente indispensabile.
+
+@item
+Aggiungere nuove funzionalit@`a o tramite @dfn{script}
+(opzione @option{-f}, direttiva @code{@@include})
+o in un'estensione caricabile scritta in C o C++
+(opzione @option{-l}, direttiva @code{@@load}).
+
+@item
+Estendere il nucleo dell'interpretatore solo se qualche funzionalit@`a:
+
+@c sublist
+@enumerate A
+@item
+@`E veramente desiderabile.
+@item
+Non si pu@`o ottenere tramite dei file di libreria o estensioni caricabili.
+@item
+Pu@`o essere aggiunta al nucleo senza troppe difficolt@`a.
+@end enumerate
+@end enumerate
+
+Combinare dei moduli con dei file @command{awk} @`e una tecnica efficace.
+Lo si pu@`o vedere in alcuni degli esempi di estensione.
+
+Il caricamento di estensioni e librerie di file non dovrebbe essere
+fatto automaticamente, perch@'e questo richiede un consumo di risorse
+che molti utenti non desiderano, o di cui non hanno bisogno.
+
@node Sommario funzionalit@`a avanzate
@section Sommario
@@ -32012,12 +32540,30 @@ profilazione @command{gawk} scrive il profilo, includendo lo
@dfn{stack} della chiamata alla funzione e prosegue nell'elaborazione.
@item
-Si pu@`o anche fare solo una ``stampa elegante'' del programma.
+Si pu@`o anche fare solo una ``stampa-elegante'' del programma.
+@item
+Nuove funzionalit@`a dovrebbero essere sviluppate usando, se possibile,
+il meccanismo delle estensioni; si dovrebbero aggiungere al nucleo
+dell'interpretatore solo come ultima risorsa.
@end itemize
+
@node Internazionalizzazione
@chapter Internazionalizzazione con @command{gawk}
+@cindex Robbins @subentry Malka
+@cindex Moon, Sailor
+@cindex Sailor Moon @seeentry{Moon, Sailor}
+@quotation
+@i{Moon@dots{} Meraviglioso@dots{} MEDITAZIONE!}
+@author Pretty Guardian Sailor Moon Eternal, Il Film
+@end quotation
+
+@quotation
+@i{Probabilmente suonava meglio in Giapponese.}
+@author Malka Robbins
+@end quotation
+
Tanto tempo fa i produttori di computer
scrivevano software che comunicava solo in inglese.
Col passare del tempo, i venditori di hardware e di software si sono
@@ -32076,7 +32622,7 @@ relative al modo di leggere e di stampare dati di tipo numerico o valutario.
@cindex internazionalizzazione @subentry di programmi @command{awk}
@cindex @command{gettext} @subentry libreria
-@cindex libreria @command{gettext}
+@cindex libreria @subentry @command{gettext}
@command{gawk} usa il comando GNU @command{gettext} per rendere disponibili
le proprie funzionalit@`a di internazionalizzazione.
L'attenzione del comando GNU @command{gettext} @`e rivolta principalmente
@@ -32219,7 +32765,7 @@ printf("%s", _("Don't Panic!\n"));
@cindex internazionalizzazione @subentry localizzazione @subentry categorie di localizzazione
@cindex @command{gettext} @subentry libreria @subentry categorie di localizzazione
-@cindex libreria @command{gettext} @subentry categorie di localizzazione
+@cindex libreria @subentry @command{gettext} @subentry categorie di localizzazione
@cindex categoria di localizzazione
@cindex localizzazione @subentry categorie di
@noindent
@@ -32717,7 +33263,7 @@ Tuttavia, @`e in realt@`a quasi portabile, e richiede modifiche minime:
@cindex @code{TEXTDOMAIN} (variabile) @subentry portabilit@`a e
@cindex variabile @subentry @code{TEXTDOMAIN} @subentry portabilit@`a e
@item
-Le assegnazioni di valori a @code{TEXTDOMAIN} non avranno effetto alcuno,
+Gli assegnamenti di valori a @code{TEXTDOMAIN} non avranno effetto alcuno,
perch@'e @code{TEXTDOMAIN} non @`e una variabile speciale in altre
implementazioni di @command{awk}.
@@ -33045,7 +33591,14 @@ per eseguire il debug dei propri programmi.
@node Debugging
@section Introduzione al debugger di @command{gawk}
-Questa @value{SECTION}, dopo un'introduzione sul debug in generale, inizia
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION},
+dopo un'introduzione sul debug in generale, inizia
la trattazione del debug in @command{gawk}.
@menu
@@ -33164,7 +33717,7 @@ cambiato il @emph{valore di un dato}. Questo @`e utile, poich@'e a volte succed
che una variabile riceva un valore errato, ed @`e difficile rintracciare il punto
dove ci@`o accade solo leggendo il codice sorgente.
Usando un punto d'osservazione, si pu@`o fermare il programma in qualunque punto
-vi sia un'assegnazione di variabile, e di solito si individua il codice che
+vi sia un'assegnamento di variabile, e di solito si individua il codice che
genera l'errore abbastanza velocemente.
@end table
@@ -33579,7 +34132,7 @@ argomenti.
* Controllo dei breakpoint:: Controllo dei punti d'interruzione.
* Controllo esecuzione debugger:: Controllo di esecuzione.
* Vedere e modificare dati:: Vedere e modificare dati.
-* Stack di esecuzione:: Lavorare con lo @dfn{stack}.
+* Stack di esecuzione:: Lavorare con lo @dfn{Stack}.
* Informazioni sul debugger:: Ottenere informazioni sullo stato del
programma e del debugger.
* Comandi vari del debugger:: Comandi vari del debugger.
@@ -34016,8 +34569,8 @@ argomenti) dalla lista dei punti d'osservazione.
@end table
-@node @dfn{Stack} di esecuzione
-@subsection Lavorare con lo @dfn{stack}
+@node Stack di esecuzione
+@subsection Lavorare con lo @dfn{Stack}
Ogni volta che si esegue un programma che contiene chiamate di funzione,
@command{gawk} mantiene una pila contenente la lista delle chiamate di funzione
@@ -34638,7 +35191,7 @@ Questo @value{CHAPTER} descrive una funzionalit@`a disponibile solo in
@command{gawk}.
@quotation ATTENZIONE
-La funzionalit@`a descritta in questo capitolo @`e nuova. @`E certamente
+La funzionalit@`a descritta in questo @value{CHAPTER} @`e nuova. @`E certamente
possibile, e perfino probabile, che ci siano degli angoli bui
(se non dei bug), ancora presenti nell'implementazione.
Chi ne trovasse, @`e pregato di notificarlo (@xref{Bug}).
@@ -35079,10 +35632,10 @@ Questo
interagisce con altre importanti funzionalit@`a di @command{gawk}.
@cindex spazio-dei-nomi @subentry interazione con la profilazione
-@cindex spazio-dei-nomi @subentry interazione con la stampa elegante
+@cindex spazio-dei-nomi @subentry interazione con la ``stampa-elegante''
@cindex profilazione @subentry interazione con spazio-dei-nomi
-@cindex stampa elegante @subentry interazione con spazio-dei-nomi
-La profilazione e la stampa elegante (@pxref{Profilare}) sono state
+@cindex stampa-elegante @subentry interazione con spazio-dei-nomi
+La profilazione e la ``stampa-elegante'' (@pxref{Profilare}) sono state
migliorate per trattare gli spazi-dei-nomi e le regole per assegnare nomi in
uno spazio-dei-nomi @ref{Regole per i nomi}.
In particolare, l'output tiene insieme le funzioni che appartengono
@@ -35143,7 +35696,7 @@ disponibile la potenza e la flessibilit@`a necessarie.
@item
Altre parti di @command{gawk} sono state estese come necessario per
integrare gli spazi-dei-nomi nel loro funzionamento.
-Questo vale soprattutto per la profilazione / stampa elegante
+Questo vale soprattutto per la profilazione / ``stampa-elegante''
(@pxref{Profilare}) e per le funzionalit@`a relative alle
estensioni (@pxref{Estensioni dinamiche}).
@@ -35178,7 +35731,7 @@ sono esattamente in accordo.
@quotation NOTA
La maggior parte degli utenti di @command{gawk} pu@`o saltare senza patemi
d'animo
-questo capitolo. Tuttavia, se si vogliono eseguire calcoli scientifici con
+questo @value{CHAPTER}. Tuttavia, se si vogliono eseguire calcoli scientifici con
@command{gawk}, questo @`e il luogo adatto per imparare a farlo.
@end quotation
@@ -35366,23 +35919,10 @@ Come i numeri vanno arrotondati, per eccesso o per difetto, quando necessario.
Maggiori dettagli verranno forniti in seguito.
@item NaN
-``Not a number'' (Non un Numero).@footnote{Grazie a Michael
-Brennan per questa descrizione, che abbiamo parafrasato, e per gli esempi.} Un
-valore speciale che risulta da un calcolo che non ha risposta come numero
-reale. In tal caso, i programmi possono o ricevere un'eccezione di virgola
-mobile, o restituire @code{NaN} come risultato. Lo standard IEEE 754
-consiglia che i sistemi restituiscano @code{NaN}. Alcuni esempi:
-
-@table @code
-@item sqrt(-1)
-La radice quadrata di @minus{}1 ha senso nell'insieme dei numeri complessi,
-ma non nell'insieme dei numeri reali,
-per cui il risultato @`e @code{NaN}.
-
-@item log(-8)
-Il logaritmo di @minus{}8 @`e fuori dal dominio di @code{log()},
-per cui il risultato @`e @code{NaN}.
-@end table
+``Not a number'' (``non @`e un numero''). Un valore speciale
+che risulta da un calcolo che non ha come risposta un numero
+reale. @xref{Valori strani}, per maggiori informazioni riguardo
+ai valori infiniti e ai valori ``non-un-numero''.
@item Normalizzato (formato)
Come la mantissa (vedi oltre in questa lista) @`e usualmente memorizzata. Il
@@ -35509,7 +36049,14 @@ per maggiori informazioni.
@author Teen Talk Barbie, luglio 1992
@end quotation
-Questa @value{SECTION} fornisce un quadro dettagliato dei problemi che
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+fornisce un quadro dettagliato dei problemi che
si presentano quando si eseguono molti calcoli in virgola
mobile.@footnote{C'@`e un saggio molto bello
@uref{http://www.validlab.com/goldberg/paper.pdf, sul calcolo in
@@ -35534,8 +36081,8 @@ ottenere ulteriori informazioni, e non basarsi solo su quanto qui detto.
* Ottenere la precisione:: Ottenere pi@`u precisione richiede qualche
sforzo.
* Tentare di arrotondare:: Aggiungere cifre di precisione e arrotondare.
-* Impostare la precisione:: Come impostare la precisione.
-* Impostare modo di arrotondare:: Impostare le modalit@`a di arrotondamento.
+* Impostare la precisione:: Impostare la precisione.
+* Impostare modo di arrotondare:: Impostare la modalit@`a di arrotondamento.
@end menu
@node Inesattezza nei calcoli
@@ -35556,6 +36103,7 @@ il numero di cifre decimali esatte nel risultato finale.
* Rappresentazioni inesatte:: I numeri non sono rappresentati esattamente.
* Confronti tra valori in VM:: Come confrontare valori in virgola mobile.
* Gli errori si sommano:: Gli errori diventano sempre maggiori.
+* Valori strani:: Valori in virgola mobile non spiegati a scuola.
@end menu
@node Rappresentazioni inesatte
@@ -35682,6 +36230,257 @@ $ @kbd{gawk 'BEGIN @{}
@print{} 4
@end example
+@node Valori strani
+@subsubsection Valori in virgola mobile non spiegati a scuola
+
+Sia l'hardware che implementa lo standard per i numeri in virgola
+mobili IEEE 754, che la libreria matematica MPFR, prevedono due
+tipi di valori di cui probabilmente non vi hanno parlato a scuola.
+Il primo @`e il valore @dfn{infinity} [infinito], un valore speciale
+che pu@`o avere un segno sia negativo che positivo, e che @`e pi@`u
+piccolo di ogni altro valore (infinito negativo), o maggiore di ogni
+altro valore (infinito positivo). Quando vengono generati tali valori
+@command{gawk} li stampa come @samp{-inf} o @samp{+inf}, rispettivamente.
+@command{gawk} accetta queste stringhe come dati in input, e li converte
+internamente all'appropriato valore in virgola mobile.
+
+Valori di infinito che abbiano lo stesso segno risultano uguali
+quando sono confrontati fra loro.
+Per il resto, altre operazioni (addizione, sottrazione, etc.)
+che hanno come operando un infinito e un altro numero producono
+risultati matematicamente ragionevoli.
+
+Il secondo tipo di valore @`e ``not a number'' [Non un Numero]
+scritto in forma abbreviata come NaN.@footnote{Grazie a Michael Brennan
+per questa descrizione, che abbiamo parafrasato, e per gli esempi.}
+
+Questo @`e un valore speciale che risulta da un calcolo che non ha come
+risposta un numero reale. In tal caso, i programmi possono o ricevere
+un’eccezione di virgola mobile, o restituire NaN [Non un Numero] come risultato.
+Lo standard IEEE 754 consiglia che i sistemi restituiscano NaN [Non un Numero].
+Alcuni esempi:
+
+@table @code
+@item sqrt(-1)
+@iftex
+La funzione @math{\sqrt{-1}}
+@end iftex
+@ifnottex
+Questa funzione
+@end ifnottex
+ha senso nell'insieme dei numeri complessi,
+ma non nell'insieme dei numeri reali,
+per cui il risultato @`e @code{NaN}.
+
+@item log(-8)
+Il logaritmo di @minus{}8 @`e fuori dal dominio di @code{log()},
+per cui il risultato @`e @code{NaN}.
+@end table
+
+I valori Nan sono strani. In particolare, non possono essere confrontati
+con altri numeri in virgola mobile; ogni confronto di questo tipo, eccetto
+quello ``non uguale a'', restituisce il valore ``falso''.
+I valori NaN [Non un Numero] sono talmente differenti da altri valori che perfino il
+confronto di due valori NaN identici fra loro con @code{!=} restituisce
+il valore ``vero''!
+
+I valori NaN [Non un Numero] possono anche avere un segno (positivo o negativo),
+anche se dipende dall'implementazione quale segno viene restituito
+da qualsiasi operazione il cui risultato sia un valore NaN.
+Per esempio, su alcuni sistemi la funzione @code{sqrt(-1)}
+restituisce un NaN negativo. Su altri sistemi il NaN restituito
+@`e invece positivo.
+
+Quando tali valori vengono generati, @command{gawk} li stampa
+come @samp{-nan} o @samp{+nan}, rispettivamente. Anche per
+questi valori, @command{gawk} accetta queste stringhe come
+dati in input e le converte internamente ai valori loro
+assegnati come numeri in virgola mobile.
+
+Se si desidera approfondire ulteriormente questo argomento, si possono
+trovare programmi di test scritti in C, @command{awk} e Python
+nella directory @file{awklib/eg/test-programs} disponibile
+nella distribuzione di @command{gawk}.
+Tali programmi permettono un confronto tra i linguaggi di
+programmazione, riguardo al modo con cui vengono trattati
+i valori di Infinity [Infinito] e quelli NaN [Non un Numero].
+
+@ignore
+@c file eg/test-programs/gen-float-table.awk
+function eq(left, right)
+@{
+ return left == right
+@}
+
+function ne(left, right)
+@{
+ return left != right
+@}
+
+function lt(left, right)
+@{
+ return left < right
+@}
+
+function le(left, right)
+@{
+ return left <= right
+@}
+
+function gt(left, right)
+@{
+ return left > right
+@}
+
+function ge(left, right)
+@{
+ return left >= right
+@}
+
+BEGIN @{
+ nan = sqrt(-1)
+ inf = -log(0)
+ split("== != < <= > >=", names)
+ names[3] = names[3] " "
+ names[5] = names[5] " "
+ split("eq ne lt le gt ge", funcs)
+
+ compare[1] = 2.0
+ compare[2] = values[1] = -sqrt(-1.0) # nan
+ compare[3] = values[2] = sqrt(-1.0) # -nan
+ compare[4] = values[3] = -log(0.0) # inf
+ compare[5] = values[4] = log(0.0) # -inf
+
+ for (i = 1; i in values; i++) @{
+ for (j = 1; j in compare; j++) @{
+ for (k = 1; k in names; k++) @{
+ the_func = funcs[k]
+ printf("%g %s %g -> %s\n",
+ values[i],
+ names[k],
+ compare[j],
+ @@the_func(values[i], compare[j]) ?
+ "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.c
+#include <stdio.h>
+#include <math.h>
+#include <stdbool.h>
+
+#define def_func(name, op) \
+ bool name(double left, double right) @{ \
+ return left op right; \
+ @}
+
+def_func(eq, ==)
+def_func(ne, !=)
+def_func(lt, <)
+def_func(le, <=)
+def_func(gt, >)
+def_func(ge, >=)
+
+struct @{
+ const char *name;
+ bool (*func)(double left, double right);
+@} functions[] = @{
+ @{ "==", eq @},
+ @{ "!=", ne @},
+ @{ "< ", lt @},
+ @{ "<=", le @},
+ @{ "> ", gt @},
+ @{ ">=", ge @},
+ @{ 0, 0 @}
+@};
+
+int main()
+@{
+ double values[] = @{
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+ double compare[] = @{ 2.0,
+ -sqrt(-1), // nan
+ sqrt(-1), // -nan
+ -log(0.0), // inf
+ log(0.0) // -inf
+ @};
+
+ int i, j, k;
+
+ for (i = 0; i < 4; i++) @{
+ for (j = 0; j < 5; j++) @{
+ for (k = 0; functions[k].name != NULL; k++) @{
+ printf("%g %s %g -> %s\n", values[i],
+ functions[k].name,
+ compare[j],
+ functions[k].func(values[i], compare[j]) ? "True" : "False");
+ @}
+ printf("\n");
+ @}
+ @}
+
+ return 0;
+@}
+@c endfile
+@end ignore
+
+@ignore
+@c file eg/test-programs/gen-float-table.py
+from math import *
+
+nan = float('NaN')
+inf = float('Inf')
+
+def eq(left, right):
+ return left == right
+
+def ne(left, right):
+ return left != right
+
+def lt(left, right):
+ return left < right
+
+def le(left, right):
+ return left <= right
+
+def gt(left, right):
+ return left > right
+
+def ge(left, right):
+ return left >= right
+
+func_map = {
+ "==": eq,
+ "!=": ne,
+ "< ": lt,
+ "<=": le,
+ "> ": gt,
+ ">=": ge,
+}
+
+compare = [2.0, nan, -nan, inf, -inf]
+values = [nan, -nan, inf, -inf]
+
+for i in range(len(values)):
+ for j in range(len(compare)):
+ for op in func_map:
+ print("%g %s %g -> %s" %
+ (values[i], op, compare[j], func_map[op](values[i], compare[j])))
+
+ print("")
+@c endfile
+@end ignore
+
@node Ottenere la precisione
@subsection Ottenere la precisione voluta
@@ -36299,7 +37098,7 @@ esadecimale (p.es., @code{0xDEADBEEF}). (Da notare: valore dei dati letti,
@item
Supporto per i valori in virgola mobile speciali IEEE 754 ``not a number''
-(NaN), pi@`u infinito (``inf'') e meno infinito (``@minus{}inf'').
+(NaN) [Non un Numero], pi@`u infinito (``inf'') e meno infinito (``@minus{}inf'').
In particolare, il formato per questi valori @`e quello specificato dallo
standard C ISO 1999, che non distingue maiuscole/minuscole e pu@`o consentire
caratteri aggiuntivi dipendenti dall'implementazione dopo il @samp{nan}, e
@@ -36337,7 +37136,8 @@ Sebbene il manutentore di @command{gawk} continui a credere che introdurre
queste funzionalit@`a sia sconsigliabile, ci@`o nonostante, sui sistemi che
supportano i valori in virgola mobile IEEE, sembra giusto fornire
@emph{qualche}
-possibilit@`a di usare i valori NaN e infinito. La soluzione implementata
+possibilit@`a di usare i valori NaN [Non un Numero] e Infinity [Infinito].
+La soluzione implementata
in @command{gawk} @`e questa:
@itemize @value{BULLET}
@@ -36386,7 +37186,8 @@ speciali. Cos@`{@dotless{i}}, @samp{+nan} e @samp{+NaN} sono la stessa cosa.
@cindex POSIX @subentry modalit@`a
Oltre a gestire l'input, @command{gawk} deve anche stampare valori
-``corretti'' in output, quando un valore sia NaN o infinito.
+``corretti'' in output, quando un valore sia NaN [Non un Numero]
+o Infinity [Infinito].
A partire dalla @value{PVERSION} 4.2.2, per tali valori
@command{gawk} stampa una delle quattro stringhe sopra descritte:
@samp{+inf}, @samp{-inf}, @samp{+nan}, or @samp{-nan}.
@@ -37029,8 +37830,8 @@ multibyte corrente.
@itemx @ @ @ @ AWK_STRNUM,
@itemx @ @ @ @ AWK_ARRAY,
@itemx @ @ @ @ AWK_SCALAR,@ @ @ @ @ @ @ @ @ /* accesso opaco a una variabile */
-@itemx @ @ @ @ AWK_VALUE_COOKIE@ @ @ @ /* per aggiornare un valore
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ gi@`a creato */
+@itemx @ @ @ @ AWK_VALUE_COOKIE@ @ @ @ /* per aggiornare valore gi@`a creato */
+@itemx @ @ @ @ AWK_BOOL
@itemx @} awk_valtype_t;
L'elenco @code{enum} indica di che tipo @`e un certo valore.
@`E usato nella seguente struttura @code{struct}.
@@ -37043,6 +37844,7 @@ L'elenco @code{enum} indica di che tipo @`e un certo valore.
@itemx @ @ @ @ @ @ @ @ awk_array_t@ @ @ @ @ @ @ @ a;
@itemx @ @ @ @ @ @ @ @ awk_scalar_t@ @ @ @ @ @ @ scl;
@itemx @ @ @ @ @ @ @ @ awk_value_cookie_t@ vc;
+@itemx @ @ @ @ @ @ @ @ awk_bool_t@ @ @ @ @ @ @ @ @ b;
@itemx @ @ @ @ @} u;
@itemx @} awk_value_t;
Un ``valore di @command{awk}''.
@@ -37058,7 +37860,8 @@ e ogni campo @`e del tipo appropriato.
@itemx #define array_cookie@ @ @ u.a
@itemx #define scalar_cookie@ @ u.scl
@itemx #define value_cookie@ @ @ u.vc
-L'uso di queste macro rende pi@`u facile da seguire l'accesso ai campi di
+@itemx #define bool_value@ @ @ @ @ u.b
+L'uso di queste macro rende pi@`u agevole eseguire l'accesso ai campi di
@code{awk_value_t}.
@item enum AWK_NUMBER_TYPE @{
@@ -37369,8 +38172,8 @@ restituiti sono di tipo @code{mpfr_ptr} e @code{mpz_ptr} rispettivamente,
e si dovrebbero assegnare in maniera appropriata questi codici di ritorno
prima di assegnare i risultati a variabili del tipo corretto.
-La memoria allocata da queste funzioni dovrebbe essere liberata a fine
-utilizzo, richiamando @code{gawk_free()}.
+La memoria allocata da queste funzioni dovrebbe essere liberata dopo il
+loro uso, richiamando @code{gawk_free()}.
@node Funzioni di costruzione
@subsection Funzioni per creare valori
@@ -37420,14 +38223,14 @@ Questa funzione crea semplicemente un valore numerico nella variabile
@code{awk_value_t}, puntata da @code{risultato}.
@item static inline awk_value_t *
-@itemx make_number_mpz(void *mpz, awk_value_t *result);
-Questa funzione crea un valore di numero GMP in @code{result}.
+@itemx make_number_mpz(void *mpz, awk_value_t *risultato);
+Questa funzione crea un valore di numero GMP in @code{risultato}.
@code{mpz} deve provenire da una chiamata a @code{get_mpz_ptr()}
(e quindi essere veramente del corrispondente tipo @code{mpz_ptr}).
@item static inline awk_value_t *
-@itemx make_number_mpfr(void *mpfr, awk_value_t *result);
-Questa funzione crea un valore di numero MPFR in @code{result}.
+@itemx make_number_mpfr(void *mpfr, awk_value_t *risultato);
+Questa funzione crea un valore di numero MPFR in @code{risultato}.
@code{mpz} deve provenire da una chiamata a @code{get_mpfr_ptr()}.
@item static inline awk_value_t *
@@ -37456,6 +38259,11 @@ Si aspetta che @code{stringa} sia un valore di tipo @samp{char *} che punta a
dati ottenuti in precedenza tramite una chiamata a
@code{gawk_malloc()}, @code{gawk_calloc()} o @code{gawk_realloc()}.
+@item static inline awk_value_t *
+@itemx make_bool(awk_bool_t boolval, awk_value_t *risultato);
+Questa funzione crea un valore booleano nella variabile @code{awk_value_t}
+puntata da @code{risultato}.
+
@end table
@node API e gestione valori MPFR e GMP
@@ -37506,7 +38314,14 @@ return result;
@cindex registrazione di estensione
@cindex estensioni @subentry registrazione di
-Questa @value{SECTION} descrive le funzioni dell'API per
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+descrive le funzioni dell'API per
registrare parti di un'estensione con @command{gawk}.
@menu
@@ -38023,7 +38838,7 @@ I campi sono:
@table @code
@item awk_bool_t use_chars;
Impostare ad @code{awk_true} se le lunghezze di campo sono specificate in
-unit@`a di caratteri potenzialmente multi-byte, oppure impostarlo a
+unit@`a di caratteri potenzialmente multibyte, oppure impostarlo a
@code{awk_false} se le lunghezze sono espresse in numero di byte.
L'efficienza del programma sar@`a maggiore utilizzando la dimensione in byte.
@@ -38327,7 +39142,8 @@ comportamento @`e riassunto nella
<colspec colname="c6"/>
<colspec colname="c7"/>
<colspec colname="c8"/>
- <spanspec spanname="hspan" namest="c3" nameend="c8" align="center"/>
+ <colspec colname="c9"/>
+ <spanspec spanname="hspan" namest="c3" nameend="c9" align="center"/>
<thead>
<row><entry></entry><entry spanname="hspan"><para>Tipo di valore reale</para></entry></row>
<row>
@@ -38337,6 +39153,7 @@ comportamento @`e riassunto nella
<entry><para>Strnum</para></entry>
<entry><para>Numero</para></entry>
<entry><para>Regexp</para></entry>
+ <entry><para>Bool</para></entry>
<entry><para>Vettore</para></entry>
<entry><para>Indefinito</para></entry>
</row>
@@ -38349,6 +39166,7 @@ comportamento @`e riassunto nella
<entry><para>Stringa</para></entry>
<entry><para>Stringa</para></entry>
<entry><para>Stringa</para></entry>
+ <entry><para>Stringa</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -38361,6 +39179,7 @@ comportamento @`e riassunto nella
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
<row>
<entry></entry>
@@ -38369,6 +39188,7 @@ comportamento @`e riassunto nella
<entry><para>Numero</para></entry>
<entry><para>Numero</para></entry>
<entry><para>false</para></entry>
+ <entry><para>Numero</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -38377,6 +39197,7 @@ comportamento @`e riassunto nella
<entry><para><emphasis role="bold">Regexp</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Regexp</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
@@ -38384,11 +39205,23 @@ comportamento @`e riassunto nella
</row>
<row>
<entry><para><emphasis role="bold">Richiesto</emphasis></para></entry>
+ <entry><para><emphasis role="bold">Booleano</emphasis></para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>Booleano</para></entry>
+ <entry><para>false</para></entry>
+ <entry><para>false</para></entry>
+ </row>
+ <row>
+ <entry><para></para></entry>
<entry><para><emphasis role="bold">Vettore</emphasis></para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
<entry><para>Vettore</para></entry>
<entry><para>false</para></entry>
</row>
@@ -38399,6 +39232,7 @@ comportamento @`e riassunto nella
<entry><para>Scalare</para></entry>
<entry><para>Scalare</para></entry>
<entry><para>Scalare</para></entry>
+ <entry><para>Scalare</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
</row>
@@ -38409,6 +39243,7 @@ comportamento @`e riassunto nella
<entry><para>Strnum</para></entry>
<entry><para>Numero</para></entry>
<entry><para>Regexp</para></entry>
+ <entry><para>Booleano</para></entry>
<entry><para>Vettore</para></entry>
<entry><para>Indefinito</para></entry>
</row>
@@ -38421,6 +39256,7 @@ comportamento @`e riassunto nella
<entry><para>false</para></entry>
<entry><para>false</para></entry>
<entry><para>false</para></entry>
+ <entry><para>false</para></entry>
</row>
</tbody>
</tgroup>
@@ -38438,31 +39274,33 @@ comportamento @`e riassunto nella
@end tex
@c @multitable @columnfractions .166 .166 .198 .15 .15 .166
@ifclear SMALLPRINT
-@multitable {Richiesto} {Indefinito} {Numero} {Numero} {Scalar} {Regexp} {Vettore} {Indefinito}
-@headitem @tab @tab Stringa @tab Strnum @tab Numero @tab Regexp @tab Vettore @tab Indefinito
-@item @tab @b{Stringa} @tab Stringa @tab Stringa @tab Stringa @tab Stringa @tab false @tab false
-@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false
-@item @tab @b{Numero} @tab Numero @tab Numero @tab Numero @tab false @tab false @tab false
-@item @b{Tipo} @tab @b{Regexp} @tab false @tab false @tab false @tab Regexp @tab false @tab false
-@item @b{Richiesto} @tab @b{Vettore} @tab false @tab false @tab false @tab false @tab Vettore @tab false
-@item @tab @b{Scalar} @tab Scalar @tab Scalar @tab Scalar @tab Scalar @tab false @tab false
-@item @tab @b{Indefinito} @tab Stringa @tab Strnum @tab Numero @tab Regexp @tab Vettore @tab Indefinito
-@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false
+@multitable {Richiesto} {Indefinito} {Numero} {Numero} {Scalare} {Regexp} {Numero} {Vettore} {Indefinito}
+@headitem @tab @tab Stringa @tab Strnum @tab Numero @tab Regexp @tab Booleano @tab Vettore @tab Indefinito
+@item @tab @b{Stringa} @tab Stringa @tab Stringa @tab Stringa @tab Stringa @tab Stringa @tab false @tab false
+@item @tab @b{Strnum} @tab false @tab Strnum @tab Strnum @tab false @tab false @tab false @tab false
+@item @tab @b{Numero} @tab Numero @tab Numero @tab Numero @tab false @tab Numero @tab false @tab false
+@item @b{Tipo} @tab @b{Regexp} @tab false @tab false @tab false @tab Regexp @tab Booleano @tab false @tab false
+@item @b{Richiesto} @tab @b{Booleano} @tab false @tab false @tab false @tab false @tab Booleano @tab false @tab false
+@item @tab @b{Vettore} @tab false @tab false @tab false @tab false @tab false @tab Vettore @tab false
+@item @tab @b{Scalare} @tab Scalare @tab Scalare @tab Scalare @tab Scalare @tab Scalare @tab false @tab false
+@item @tab @b{Indefinito} @tab Stringa @tab Strnum @tab Numero @tab Regexp @tab Booleano @tab Vettore @tab Indefinito
+@item @tab @b{@dfn{Value cookie}} @tab false @tab false @tab false @tab false @tab false @tab false
@end multitable
@end ifclear
@ifset SMALLPRINT
@smallformat
-@multitable {Richiesto} {Value cookie} {Num.} {Num.} {Scal.} {Regexp} {Vett.} {Indef.}
-@headitem @tab @tab String @tab Strn. @tab Num. @tab Regexp @tab Vett. @tab Indef.
-@item @tab @b{Stringa} @tab String @tab String @tab String @tab String @tab false @tab false
-@item @tab @b{Strnum} @tab false @tab Strn. @tab Strn. @tab false @tab false @tab false
-@item @tab @b{Numero} @tab Num. @tab Num. @tab Num. @tab false @tab false @tab false
-@item @b{Tipo} @tab @b{Regexp} @tab false @tab false @tab false @tab Regexp @tab false @tab false
-@item @b{Richiesto} @tab @b{Vettore} @tab false @tab false @tab false @tab false @tab Vett. @tab false
-@item @tab @b{Scalar} @tab Scal. @tab Scal. @tab Scal. @tab Scal. @tab false @tab false
-@item @tab @b{Indefinito} @tab String @tab Strn. @tab Num. @tab Regexp @tab Vett. @tab Indef.
-@item @tab @b{Value cookie} @tab false @tab false @tab false @tab false @tab false @tab false
+@multitable {Rich.} {Indef.} {Num.} {Num.} {Scal.} {Regex.} {Num.} {Vett.} {Indef.}
+@headitem @tab @tab Str. @tab Strn. @tab Num. @tab Regex. @tab Bool. @tab Vett. @tab Indef.
+@item @tab @b{Str.} @tab Str. @tab Str. @tab Str. @tab Str. @tab Str. @tab false @tab false
+@item @tab @b{Strn.} @tab false @tab Strn. @tab Strn. @tab false @tab false @tab false @tab false
+@item @tab @b{Num.} @tab Num. @tab Num. @tab Num. @tab false @tab Num. @tab false @tab false
+@item @b{Tipo} @tab @b{Regex.} @tab false @tab false @tab false @tab Regex. @tab Bool. @tab false @tab false
+@item @b{Rich.} @tab @b{Bool.} @tab false @tab false @tab false @tab false @tab Bool. @tab false @tab false
+@item @tab @b{Vett.} @tab false @tab false @tab false @tab false @tab false @tab Vett. @tab false
+@item @tab @b{Scal.} @tab Scal. @tab Scal. @tab Scal. @tab Scal. @tab Scal. @tab false @tab false
+@item @tab @b{Indef.} @tab Str. @tab Strn. @tab Num. @tab Regex. @tab Bool. @tab Vett. @tab Indef.
+@item @tab @b{@dfn{Val. coo.}} @tab false @tab false @tab false @tab false @tab false @tab false
@end multitable
@end smallformat
@end ifset
@@ -38470,28 +39308,30 @@ comportamento @`e riassunto nella
@end ifnotplaintext
@ifplaintext
@verbatim
- +-------------------------------------------------------+
- | Tipo di valore reale: |
- +--------+--------+--------+--------+-------+-----------+
- | Stringa| Strnum | Numero | Regexp |Vettore| Indefinito|
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
-| | Stringa | Stringa| Stringa| Stringa| Stringa| false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Strnum | false | Strnum | Strnum | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Numero | Numero | Numero | Numero | false | false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Regexp | false | false | false | Regexp | false | false |
-| Tipo +-----------+--------+--------+--------+--------+-------+-----------+
-|Richiesto: | Vettore | false | false | false | false |Vettore| false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Scalare | Scalare| Scalare| Scalare| Scalare| false | false |
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Indefinito| Stringa| Strnum | Numero | Regexp |Vettore| Indefinito|
-| +-----------+--------+--------+--------+--------+-------+-----------+
-| | Value- | false | false | false | false | false | false |
-| | Cookie | | | | | | |
-+-----------+-----------+--------+--------+--------+--------+-------+-----------+
+ +----------------------------------------------------------------+
+ | Tipo di valore reale: |
+ +--------+--------+--------+--------+--------+-------+-----------+
+ | Stringa| Strnum | Numero | Regexp |Booleano|Vettore| Indefinito|
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Stringa | Stringa| Stringa| Stringa| Stringa| false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Strnum | false | Strnum | Strnum | false | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Numero | Numero | Numero | Numero | false | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Regexp | false | false | false | Regexp | false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| Tipo | Booleano | false | false | false | false |Booleano| false | false |
+| Richiesto +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Vettore | false | false | false | false |Vettore |Vettore| false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Scalare | Scalare| Scalare| Scalare| Scalare| false | false | false |
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Indefinito| Stringa| Strnum | Numero | Regexp |Vettore |Vettore| Indefinito|
+| +-----------+--------+--------+--------+--------+--------+-------+-----------+
+| | Value- | false | false | false | false | false | false | false |
+| | Cookie | | | | | | | |
++-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
@end verbatim
@end ifplaintext
@end float
@@ -38504,7 +39344,7 @@ passati all'estensione. Esse sono:
@table @code
@item awk_bool_t get_argument(size_t count,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Riempie la struttura @code{awk_value_t} puntata da @code{risultato}
con l'argomento numero @code{count}. Restituisce @dfn{true} se il tipo
@@ -38553,7 +39393,7 @@ Le funzioni sono le seguenti:
@table @code
@item awk_bool_t sym_lookup(const char *nome,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Riempie la struttura @code{awk_value_t} puntata da @code{risultato}
con il valore della variabile il cui nome @`e nella stringa @code{nome},
@@ -38567,7 +39407,7 @@ della variabile
@item awk_bool_t sym_lookup_ns(const char *nome,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ const char *name_space,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Simile a @code{sym_lookup()}, ma il parametro @code{name_space} consente di
specificare a quale spazio-di-nomi appartiene @code{nome}.
@@ -38614,7 +39454,7 @@ Le funzioni seguenti servono per gestire gli @dfn{scalar cookie}:
@table @code
@item awk_bool_t sym_lookup_scalar(awk_scalar_t cookie,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Ottiene il valore corrente di uno @dfn{scalar cookie}.
Una volta ottenuto lo @dfn{scalar cookie} usando @code{sym_lookup()}, si
@@ -38701,7 +39541,14 @@ inizializza_estensione()
@}
@end example
-Dopo aver fatto questo, si usino le routine descritte in questa @value{SECTION}
+Dopo aver fatto questo, si usino le routine descritte in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION}
per ottenere e modificare
il valore usando il @dfn{value cookie}. Quindi, @code{do_magic()} diviene ora
qualcosa del tipo:
@@ -38735,7 +39582,15 @@ restituiti dalle funzioni dell'API.
@node Valori nascosti
@subsubsection Creare e usare valori nascosti
-Le routine in questa @value{SECTION} permettono di creare e rilasciare
+Le routine in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION}
+permettono di creare e rilasciare
valori nascosti. Come gli @dfn{scalar cookie}, in teoria i valori nascosti
non sono necessari. Si possono creare numeri e stringhe usando
le funzioni descritte
@@ -38968,7 +39823,7 @@ Restituisce @dfn{false} se si verifica un errore.
@item awk_bool_t get_array_element(awk_array_t a_cookie,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ const awk_value_t *const index,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Per il vettore rappresentato da @code{a_cookie}, restituisce in @code{*risultato}
il valore dell'elemento il cui indice @`e @code{index}.
@@ -40621,11 +41476,18 @@ $ @kbd{AWKLIBPATH=$PWD gawk -f testff.awk}
@section Le estensioni di esempio incluse nella distribuzione @command{gawk}
@cindex estensioni @subentry distribuite con @command{gawk}
-Questa @value{SECTION} fornisce una breve panoramica degli esempi di
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+fornisce una breve panoramica degli esempi di
estensione inclusi nella distribuzione di @command{gawk}. Alcune di esse
sono destinate per l'uso in produzione (p.es., le estensioni
-@code{filefuncs}, @code{readdir}, e
-@code{inplace}). Altre sono state scritte principalmente per mostrare come
+@code{filefuncs}, @code{readdir}, e @code{inplace}).
+Altre sono state scritte principalmente per mostrare come
si usa l'estensione API.
@menu
@@ -41809,7 +42671,15 @@ documentazione online}.
Il liguaggio @command{awk} si @`e evoluto considerevolmente tra Unix versione
7 (1978) e la nuova implementazione disponibile a partire da Unix System V
-Release 3.1 (1987). Questa @value{SECTION} riassume le differenze e indica
+Release 3.1 (1987).
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+riassume le differenze e indica
dove @`e possibile trovare ulteriori dettagli:
@itemize @value{BULLET}
@@ -42555,7 +43425,7 @@ con @option{--}.
@item
L'opzione @option{--source} per combinare codice sorgente immesso nella riga
-di comando e codice sorgente proveniente da file di libreria.
+di comando e codice sorgente proveniente da librerie di file.
@end itemize
@end itemize
@@ -42719,7 +43589,8 @@ per l'internationalizzazione
@item
La funzione @code{extension()} e la possibilit@`a di aggiungere
-nuove funzioni predefinite dinamicamente
+nuove funzioni predefinite dinamicamente. Questa funzione @`e stata rimossa.
+@`E rimpiazzata dal nuovo meccanismo delle estensioni dinamiche
@iftex
(@pxrefil{Estensioni dinamiche}).
@end iftex
@@ -42831,7 +43702,7 @@ i campi, invece che individuare il separatore tra i campi
@item
Se esiste l'elemento di vettore @code{PROCINFO["sorted_in"]}, il ciclo
-@samp{for(indice in pippo)} ordina
+@samp{for (indice in pippo)} ordina
gli indici, prima di iniziare il ciclo. Il valore di questo elemento
permette di controllare l'ordinamento degli indici prima di iniziare il
ciclo che li visita tutti
@@ -43057,7 +43928,7 @@ L'opzione @option{-D} attiva il debugger.
@item
Le opzioni @option{-i} e @option{--include}
-caricano dei file di libreria @command{awk}.
+caricano delle librerie di file @command{awk}.
@item
Le opzioni @option{-l} e @option{--load} caricano estensioni dinamiche
@@ -43105,7 +43976,7 @@ La funzione @code{getline} ridiretta @`e stata resa possibile all'interno di
@item
Il comando @code{where} @`e stato aggiunto al debugger
-(@pxref{@dfn{Stack} di esecuzione}).
+(@pxref{Stack di esecuzione}).
@item
Il supporto per Ultrix @`e stato rimosso.
@@ -43258,6 +44129,37 @@ L'indice analitico di questo manuale @`e stato completamente rimaneggiato.
@item
@`E stato aggiunto il supporto per MSYS2.
+
+@item
+@code{asort()} ed @code{asorti()} sono stati modificati
+per consentire come primo argomento @code{FUNCTAB} e @code{SYMTAB},
+quando venga specificato un vettore di destinazione come secondo parametro
+(@pxref{Funzioni per stringhe}).
+
+@item
+Le opzioni @option{-I}/@option{--trace} sono state aggiunte per
+stampare una traccia dei @dfn{byte code} mentre vengono eseguiti
+(@pxref{Opzioni}).
+
+@item
+@code{$0} e i campi sono ora azzerati prima di eseguire una
+regola @code{BEGINFILE} rule (@pxref{BEGINFILE/ENDFILE}).
+
+@item
+Parecchi fra i programmi di esempio sono stati aggiornati per
+riflettere i loro equivalenti POSIX pi@`u recenti.
+
+@item
+Gli avvisi ``no effect'' da lint, emessi se si specifica
+l'opzione @option{--lint}, sono stati modificati
+e ora sono pi@`u ragionevoli.
+(@pxref{Opzioni}).
+
+@item
+La gestione dei valori Infinity [Infinito] e NaN [Non un Numero]
+@`e stata migliorata.
+@xref{Definizioni matematiche} e vedere anche
+@ref{Problemi virgola mobile POSIX}.
@end itemize
@c XXX ADD MORE STUFF HERE
@@ -43434,7 +44336,14 @@ In ogni caso @command{gawk} aderisce allo standard POSIX.
@author Anonimo
@end quotation
-Questa @value{SECTION} elenca le persone che hanno maggiormente contribuito
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+elenca le persone che hanno maggiormente contribuito
allo sviluppo di @command{gawk} e/o alla stesura di questo @value{DOCUMENT},
in ordine approssimativamente cronologico:
@@ -43807,7 +44716,14 @@ della versione specifica di una particolare piattaforma.
@cindex codice sorgente @subentry @command{gawk}
@cindex sorgente @subentry codice @subentry @command{gawk}
-Questa @value{SECTION} spiega come ottenere la distribuzione
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+spiega come ottenere la distribuzione
di @command{gawk}, come scompattarla, e cosa @`e contenuto nei vari file
e nelle sottodirectory risultanti.
@@ -43855,7 +44771,7 @@ dal deposito Git ufficiale; per maggiori informazioni, si veda
@node Scompattazione
@appendixsubsec Scompattare la distribuzione
-@command{gawk} @`e distribuito sotto forma di parecchi file @code{tar}
+@command{gawk} @`e distribuito sotto forma di parecchi file @command{tar}
compressi con differenti programmi di compressione: @command{gzip},
@command{bzip2}
e @command{xz}. Per amor di semplicit@`a, il resto di queste istruzioni
@@ -43864,7 +44780,7 @@ presuppone che si stia usando quella compressa col programma GNU Gzip
Una volta che si ha a disposizione la distribuzione (p.es.,
@file{gawk-@value{VERSION}.@value{PATCHLEVEL}.tar.gz}),
-va usato @code{gzip} per scompattare il file e quindi @code{tar} per estrarne i
+va usato @command{gzip} per scompattare il file e quindi @command{tar} per estrarne i
file. Si pu@`o usare la seguente @dfn{pipe} per produrre la distribuzione
@command{gawk}:
@@ -43945,16 +44861,21 @@ Un file che fornisce una panoramica sul processo di configurazione e installazio
@item ChangeLog
Una lista dettagliata delle modifiche apportate al codice sorgente,
ai problemi risolti e ai miglioramenti introdotti.
+Un file con questo nome file @`e presente anche in ogni sottodirectory.
@item ChangeLog.0
-Una lista meno recente di modifiche al codice sorgente.
+@itemx ChangeLog.1
+Liste meno recenti di modifiche al codice sorgente.
+Dei file con questi nomi sono presenti anche in ogni sottodirectory.
@item NEWS
-Una lista di modifiche a @command{gawk} a partire dall'ultimo rilascio
-o @dfn{patch}.
+Una lista di modifiche a @command{gawk} a partire dall'ultimo rilascio o @dfn{patch}.
+Possono esserci file con questo nome anche in qualche sottodirectory.
@item NEWS.0
-Una lista meno recente di modifiche a @command{gawk}.
+@itemx NEWS.1
+Liste meno recente di modifiche a @command{gawk}.
+Possono esserci file con questo nome anche in qualche sottodirectory.
@item COPYING
La @dfn{GNU General Public License}.
@@ -43974,7 +44895,7 @@ programmazione nel campo dell'intelligenza artificiale (AI).
@item doc/bc_notes
Una breve descrizione della struttura interna a livello di byte di
-@command{gawk} [``byte code''].
+@command{gawk} [``@dfn{byte code}''].
@item doc/README.card
@itemx doc/ad.block
@@ -44032,6 +44953,23 @@ con @command{makeinfo} per produrre un file Info o HTML.
Il file Info generato per
@cite{@value{GAWKINETTITLE}}.
+@item doc/gawkworkflow.texi
+Il file sorgente Texinfo per
+@ifinfo
+@inforef{Top, , Introduzione generale, gawkworkflow, @value{GAWKWORKFLOWTITLE}}.
+@end ifinfo
+@ifnotinfo
+@cite{@value{GAWKWORKFLOWTITLE}}.
+@end ifnotinfo
+Dovrebbe venire elaborato con @TeX{}
+(tramite @command{texi2dvi} o @command{texi2pdf})
+per produrre un documento stampato o
+con @command{makeinfo} per produrre un file Info o HTML.
+
+@item doc/gawkorkflow.info
+Il file Info generato per
+@cite{@value{GAWKWORKFLOWTITLE}}.
+
@item doc/igawk.1
Il sorgente @command{troff} per una pagina di manuale relativa al
programma @command{igawk} descritto
@@ -44162,11 +45100,17 @@ dover configurare @command{gawk} per quel dato sistema.
* Ulteriori opzioni di configurazione:: Altre opzioni utilizzabili in fase di
compilazione.
* Filosofia della configurazione:: Come si suppone che tutto funzioni.
+* Compilare da git:: Compilare da git.
+* Generare la documentazione:: Generare la documentazione.
@end menu
@node Installazione veloce
@appendixsubsec Compilare @command{gawk} per sistemi di tipo Unix
+@menu
+* Compilare con MPFR:: Compilare con MPFR.
+@end menu
+
Questi normali passi di installazione dovrebbero essere sufficienti in
tutti i moderni sistemi in commercio derivati da Unix, ossia
GNU/Linux, sistemi basati su BSD, e l'ambiente Cygwin sotto MS-Windows.
@@ -44249,6 +45193,31 @@ diventa in questo caso @samp{sudo make install}. @`E probabile che sia
necessario fornire una password, ed essere stati messi nella lista degli
utenti che possono utilizzare il comando @command{sudo}.
+@node Compilare con MPFR
+@appendixsubsubsec Compilare con MPFR
+
+@cindex MPFR @subentry compilare @command{gawk} con libreria
+@cindex compilare @command{gawk} @subentry con libreria MPFR
+@cindex libreria @subentry MPFR @subentry compilare con
+L'uso della libreria MPFR
+[@dfn{Multiple Precision Floating-Point Reliable library}]
+in @command{gawk} @`e una funzionalit@`a opzionale:
+se le librerie MPFR e GMP sono gi@`a installate nel sistema
+quando si configura e compila @command{gawk},
+@command{gawk} sar@`a in grado di usarle in maniera automatica.
+
+Tali librerie si possono installare, a partire dal codice
+sorgente, scaricandole dal sito GNU di distribuzione, che @`e
+@code{ftp.gnu.org}.
+
+La maggioranza dei sistemi operativi recenti mette a disposizione
+dei pacchetti di installazione che consentono di evitare di installare
+le librerie a partire dal codice sorgente.
+Tali pacchetti scaricano e installano i file binari e quelli di
+intestazione di MPFR e GMP. Resta a carico di chi compila l'ottenere
+questi pacchetti con modalit@`a che dipendono dai metodi di aggiornamento
+di ogni particolare sistema.
+
@node File da usare a inizio sessione
@appendixsubsec File di inizializzazione della shell
@@ -44383,14 +45352,21 @@ delle opzioni disponibili in @command{configure}.
@cindex @command{gawk} @subentry configurazione di
@cindex configurazione di @command{gawk}
-Questa @value{SECTION} interessa solo a chi abbia un minimo di familiarit@`a con
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+interessa solo a chi abbia un minimo di familiarit@`a con
il linguaggio C e con i sistemi operativi di tipo Unix.
Il codice sorgente di @command{gawk}, in generale, cerca di aderire, nei limiti
del possibile, a degli standard formali. Ci@`o significa che @command{gawk} usa
routine di libreria che sono specificate nello standard ISO C e nello standard
POSIX per le interfacce dei sistemi operativi. Il codice sorgente di
-@command{gawk} richiede l'uso di un compilatore ISO C (standard 1990).
+@command{gawk} richiede l'uso di un compilatore ISO C (standard 1999).
Molti sistemi Unix non aderiscono completamente n@'e allo standard ISO n@'e a
quello POSIX. La sottodirectory @file{missing_d} nella distribuzione di
@@ -44427,10 +45403,81 @@ informazioni su come segnalare problemi nella configurazione di
@command{gawk}). Lo stesso meccanismo si pu@`o usare per inviare aggiornamenti
al file @file{configure.ac} e/o a @file{custom.h}.
+@node Compilare da git
+@appendixsubsec Compilare da @command{git}
+
+La compilazione di @command{gawk} utilizzando direttamente il sito in
+cui viene mantenuto (utilizzando @command{git}) il codice sorgente @`e
+possibile, ma non @`e raccomandato per ogni tipo di utente, poich@'e
+il codice pu@`o non essere altrettanto stabile quanto le versioni
+rilasciate. Se veramente si vuole farlo, questi sono i passi da
+seguire:
+
+@example
+git clone https://git.savannah.gnu.org/r/gawk.git
+cd gawk
+./bootstrap.sh && ./configure && make && make check
+@end example
+
+@node Generare la documentazione
+@appendixsubsec Generare la documentazione
+
+@cindex documentazione @subentry generare @subentry file Info
+La documentazione nel formato Info @`e inclusa nei file
+@command{tar} della documentazione e nel @dfn{repository}
+Git. Non dovrebbe essere necessario generarla nuovamente.
+In ogni caso, se servisse, @`e possibile farlo utilizzando semplicemente
+il comando @command{make}, ammesso che si abbia a disposizione una versione
+di @command{makeinfo} abbastanza recente.
+
+@cindex documentazione @subentry generare @subentry file PDF
+Volendo generare la versione PDF del manuale, occorre avere a disposizione
+@TeX{}, ed eventualmente ulteriori pacchetti che contengono i caratteri
+e gli strumenti software necessari, come @command{ps2pdf}.
+@`E anche necessario avere a disposizione GNU Troff (@command{groff})
+per formattare la scheda di riferimento e la pagina di manuale
+[consultabile con @command{man}] (@pxref{Contenuti della distribuzione}).
+Come installare tutti questi pacchetti software non fa parte di
+ci@`o che viene trattato in questo @value{DOCUMENT}.
+
+Supponendo che si abbia a disposizione il necessario, i comandi
+seguenti producono le versioni PDF della documentazione:
+
+@example
+cd doc
+make pdf
+@end example
+
+@noindent
+Questo comando genera le versioni PDF di tutti e tre i documenti Texinfo
+inclusi nella distribuzione, come pure la pagina di manuale e la scheda
+di riferimento.
+
+@cindex documentazione @subentry generare @subentry file HTML
+Analogamente, se la versione disponibile di @command{makeinfo}
+@`e abbastanza recente, si pu@`o generare la versione HTML dei
+manuali con:
+
+@example
+cd doc
+make html
+@end example
+
+@noindent
+Questo comando genera le versioni HTML di tutti e tre i documenti Texinfo
+inclusi nella distribuzione.
+
@node Installazione non-Unix
@appendixsec Installazione su altri Sistemi Operativi
-Questa @value{SECTION} descrive come installare @command{gawk} su
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+descrive come installare @command{gawk} su
vari sistemi non-Unix.
@menu
@@ -44445,10 +45492,25 @@ vari sistemi non-Unix.
@cindex PC @subentry @command{gawk} su sistemi operativi
@cindex sistemi operativi @subentry per PC @subentry @command{gawk} su
@cindex installare @command{gawk} @subentry su sistemi operativi per PC
-Questa @value{SECTION} tratta dell'installazione e uso di @command{gawk}
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+tratta dell'installazione e uso di @command{gawk}
su macchine con architettura Intel che eseguono qualsiasi versione di
MS-Windows.
-In questa @value{SECTION}, il termine ``Windows32''
+In
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{SECTION},
+il termine ``Windows32''
si riferisce a una qualsiasi versione di Microsoft Windows
95/98/ME/NT/2000/XP/Vista/7/8/10.
@@ -44631,7 +45693,8 @@ esempio l'impostazione di @code{RS} pu@`o essere spostata in una regola
@cindex compilare @command{gawk} @subentry per Cygwin
@cindex Cygwin @subentry compilare @command{gawk} per
-@command{gawk} pu@`o essere compilato e usato ``cos@`{@dotless{i}} com'@`e'' sotto MS-Windows se
+@command{gawk} pu@`o essere compilato e usato
+``cos@`{@dotless{i}} com'@`e'' sotto MS-Windows se
si opera all'interno dell'ambiente @uref{http://www.cygwin.com, Cygwin}.
Questo ambiente consente un'eccellente simulazione di GNU/Linux, con l'uso di
Bash, GCC, GNU Make, e altri programmi GNU. La compilazione e l'installazione
@@ -44686,9 +45749,16 @@ In ambiente MSYS2, la compilazione usando i comandi classici
@cindex @command{gawk} @subentry versione VMS di
@cindex installare @command{gawk} @subentry su VMS
@cindex VMS @subentry installare @command{gawk} su
-Questa @value{SUBSECTION} descrive come compilare e installare @command{gawk}
-sotto VMS. Il termine classico ``VMS'' @`e usato qui anche per designare
-OpenVMS.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SUBSECTION}
+descrive come compilare e installare @command{gawk}
+sotto OpenVMS.
+Il termine classico ``VMS'' @`e usato qui per designare OpenVMS.
@menu
* Compilazione su VMS:: Come compilare @command{gawk} su VMS.
@@ -44697,8 +45767,6 @@ OpenVMS.
* Dettagli installazione su VMS:: Come installare @command{gawk} su VMS.
* Esecuzione su VMS:: Come eseguire @command{gawk} su VMS.
* GNV su VMS:: Il progetto VMS GNV.
-* Vecchio Gawk su VMS:: Una versione non aggiornata arriva
- con alcune versioni di VMS.
@end menu
@node Compilazione su VMS
@@ -44847,8 +45915,8 @@ $ @kbd{set command gnv$gnu:[vms_bin]gawk_verb.cld}
@end example
Oppure il sistemista VMS pu@`o usare @file{GNV$GNU:[vms_bin]gawk_verb.cld} per
-aggiungere @command{gawk} e @command{awk} alla tabella @samp{DCLTABLES}
-valida per tutto il sistema.
+aggiungere i comandi @command{gawk} e @command{awk} alla tabella
+@samp{DCLTABLES} valida per tutto il sistema.
La sintassi DCL @`e documentata nel file @file{gawk.hlp}.
@@ -44954,8 +46022,6 @@ VMS restituisce data e ora in formato GMT, a meno che non siano stati impostati
i nomi logici @code{SYS$TIMEZONE_RULE} o @code{TZ}. Precedenti versioni di
VMS, come VAX/VMS 7.3, non impostano questi nomi logici.
-@c @cindex directory search
-@c @cindex path, search
@cindex percorso di ricerca @subentry per file sorgente
Il percorso di ricerca di default, nella ricerca dei file di programma per
@command{awk} specificati dall'opzione @option{-f}, @`e
@@ -45011,7 +46077,6 @@ $ define/user sys$input sys$command:
$ sort sys$input: sys$output:
@end example
-
@node GNV su VMS
@appendixsubsubsec Il progetto VMS GNV
@@ -45028,61 +46093,6 @@ adatto a essere usato con GNV.
Il file @file{vms/gawk_build_steps.txt} nella distribuzione documenta
la procedura per compilare un pacchetto PCSI compatible con GNV.
-@ignore
-@c The VMS POSIX product, also known as POSIX for OpenVMS, is long defunct
-@c and building gawk for it has not been tested in many years, but these
-@c old instructions might still work if anyone is still using it.
-
-@node VMS POSIX
-@appendixsubsubsec Compilare e usare @command{gawk} su VMS POSIX
-
-Le istruzioni appena viste vanno ignorate, sebbene @file{vms/gawk.hlp}
-dovrebbe ancora essere reso disponibile in una libreria di aiuto.
-L'albero del codice sorgente dovrebbe essere scompattato in un sottosistema
-contenitore di file, e non nel normale @dfn{filesystem} VMS.
-Occorre accertarsi che i due @dfn{script}, @file{configure} e
-@file{vms/posix-cc.sh}, siano eseguibile; si usi @samp{chmod +x} per farlo,
-se necessario. Poi vanno eseguiti i seguenti due comandi:
-
-@example
-psx> @kbd{CC=vms/posix-cc.sh configure}
-psx> @kbd{make CC=c89 gawk}
-@end example
-
-@noindent
-Il primo comando costruisce i file @file{config.h} e @file{Makefile},
-a partire da dei modelli, usando uno @dfn{script} per fare s@`{@dotless{i}} che il
-compilatore C soddisfi le aspettative di @command{configure}. Il secondo
-comando compila e collega @command{gawk} chiamando direttamente il
-compilatore C; gli eventuali messaggi di @command{make} che dicono di non
-riuscire a ridefinire @code{CC} vanno ignorati. @command{configure}
-impiega molto tempo a completarsi, ma in compenso continua a fornire
-messaggi che permettono di seguirne l'avanzamento.
-
-Questo @`e stato testato con VAX/VMS V6.2, VMS POSIX V2.0, e DEC C V5.2.
-
-Una volta installato, @command{gawk} funziona come ogni altro programma
-di utilit@`a della shell. A differenza della normale versione VMS di
-@command{gawk}, neesuna manipolazione speciale della riga di comando @`e
-necessaria nell'ambiente VMS POSIX.
-@end ignore
-
-@node Vecchio Gawk su VMS
-@appendixsubsubsec Vecchia versione di @command{gawk} su sistemi VMS
-
-
-@c Thanks to "gerard labadie" <gerard.labadie@gmail.com>
-
-Alcune versioni di VMS includono una vecchia versione di @command{gawk}.
-Per utilizzarla, occorre definire un simbolo, come segue:
-
-@example
-$ @kbd{gawk :== $sys$common:[syshlp.examples.tcpip.snmp]gawk.exe}
-@end example
-
-La versione appare essere la @value{PVERSION} 2.15.6, che @`e molto vecchia.
-Si raccomanda di compilare e usare la versione corrente.
-
@node Bug
@appendixsec Segnalazione di problemi e bug
@cindex archeologi
@@ -45100,44 +46110,170 @@ non c'@`e un impegno preciso a intervenire, ma c'@`e una buona possibilit@`a che
si sforzi di risolverlo.
@menu
-* Indirizzo Bug:: Dove inviare le segnalazioni.
+* Definizione di bug:: Definire cos'@`e e cosa non @`e un bug.
+* Indirizzo bug:: Dove notificare problemi.
* Usenet:: Dove non inviare le segnalazioni.
-* Manutentori:: Manutentori di version non-*nix.
+* Bug di prestazione:: Che fare in caso di problemi di prestazione.
+* Richieste di aiuto:: Gestire domande non relative ai bug.
+* Manutentori:: Manutentori di versioni non-Unix.
@end menu
-@node Indirizzo Bug
-@appendixsubsec Segnalare Bug
+@node Definizione di bug
+@appendixsubsec Definire cos'@`e e cosa non @`e un bug.
+
+Prima di spiegare come segnalare bug, definiamo cosa @`e un bug e
+cosa non lo @`e.
+
+Un bug @`e:
+
+@itemize @bullet
+@item
+Quando @command{gawk} si comporta diversamente da come previsto dallo
+standard POSIX standard, e la differenza non @`e descritta in questo
+@value{DOCUMENT} con il motivo per cui lo fa.
+
+@item
+Quando @command{gawk} si comporta diversamente da come descritto
+in questo @value{DOCUMENT}.
+
+@item
+Quando @command{gawk} si comporta diversamente da altre implementazioni di
+@command{awk} in qualche caso particolare, e tale comportamento non dipende
+da qualche ulteriore funzionalit@`a disponibile solo in @command{gawk}.
+
+@item
+Qualcosa di evidentemente sbagliato, come un @dfn{dump}, [ossia una
+fine programma inattesa con segnalazione di errore].
+
+@item
+Quando questo @value{DOCUMENT} @`e poco chiaro o ambiguo riguardo
+al modo di operare di una particolare funzionalit@`a.
+@end itemize
+
+La lista che segue elenca casi che @emph{non sono} bug e che non dovrebbero
+essere segnalati ala mailing list dei bug. Domande al riguardo possono
+essere rivolte alla mailing list di ``help''
+(@pxref{Richieste di aiuto}), ma non dovreste meravigliarvi di ricevere
+una risposta del tipo ``@command{gawk} funziona cos@`{@dotless{i}}, e continuer@`a
+a funzionare cos@`{@dotless{i}}.''
+
+@itemize @bullet
+@item
+Funzionalit@`a mancanti, quale che sia la definizione di @dfn{feature}.
+Per esempio, ulteriori funzioni aritmetiche predefinite, o modi
+ulteriori di dividere campi o record, o qualsiasi altra cosa.
+
+Il numero di funzioni che @command{gawk} @emph{non ha} @`e, per definizione,
+infinito. Non @`e possibile accontentare tutti.
+
+@item
+Comportamenti definiti dallo standard POSIX e/o dettati da compatibilit@`a
+storiche con il comando Unix @command{awk}. Anche se tali comportamenti
+possono risultare sgraditi, non saranno cambiati: se li si cambiasse
+milioni di programmi @command{awk} esistenti smetterebbero di funzionare.
+
+@item
+Comportamenti differenti da quel che succede usando altri linguaggi.
+@command{awk} e @command{gawk} hanno un modo di operare loro proprio,
+e non sono obbligati a seguire quello altrui.
+Ci@`o @`e particolarmente vero quando la modifica di comportamento
+richiesta farebbe perdere la compatibilit@`a all'indietro.
+
+@item
+Problemi di documentazioni nella forma ``il manuale non spiega come
+fare XYZ.'' Il manuale non @`e un libro con tutte le ricette per risolvere
+ogni piccolo problema che ci si trovi ad affrontare.
+
+@item
+Domande di tipo generale riguardo alla programmazione @command{awk}
+o sul motivo per cui @command{gawk} si comporta in un certo modo.
+Per tali domande si usi la mailing list ``help'':
+vedere @ref{Richieste di aiuto}.
+@end itemize
+
+Per ulteriori informazioni, vedere (in inglese)
+@uref{http://www.skeeve.com/fork-my-code.html,
+@cite{Fork My Code, Please!---An Open Letter To Those of You Who Are Unhappy}},
+di Arnold Robbins e Chet Ramey.
+
+@node Indirizzo bug
+@appendixsubsec Segnalare bug
Prima di segnalare un bug, occorre assicurarsi che sia davvero un bug.
-Per prima cosa, si deve verificare se si sta usando l'ultima versione di
-@command{gawk}.
+
+Questi @`e la procedura da seguire per sottomettere una segnalazione
+di bug. Rispettandola si semplificher@`a la vostra vita e quella dei
+manutentori di @command{gawk}.
+
+@enumerate 1
+@item
+Assicuratevi che quel che volete segnalare sia appropriato.
+@xref{Definizione di bug}. Se non lo @`e, state perdendo tempo e lo
+fate perdere a noi.
+
+@item
+Verificate di stare usando l'ultima versione di @command{gawk}.
Molti bug (di solito difficili da scoprire) sono corretti in ogni nuova
versione, e se la versione in uso @`e piuttosto datata, il problema pu@`o
essere stato risolto nel frattempo.
-In secondo luogo, si dovrebbe controllare se, con l'impostare la variabile
+@item
+Per piacere, controllate se, l'impostazione della variabile
@env{LC_ALL} come @code{LC_ALL=C} produce il funzionamento atteso da parte
del programma. Se @`e questo il caso, il problema dipende dalla
localizzazione, e pu@`o non essere veramente un bug.
-In terzo luogo, va riletta attentamente la documentazione,
+@item
+Rileggete attentamente la documentazione,
per controllare se dice che @`e possibile
fare quel che si sta tentando di fare. Se non @`e chiaro se sia possibile
fare quella particolare cosa o no, occorre segnalarlo; in questo caso si tratta
di un bug nella documentazione!
-Infine, prima
-di segnalare un bug o di tentare di risolverlo personalmente, si tenti
-di isolarlo preparando un programma @command{awk} il pi@`u piccolo possibile, con
-un @value{DF} in input che possa riprodurre il problema. Dopo averlo fatto, si
-spedisca il programma e il @value{DF}, insieme a informazioni sul tipo di
-sistema Unix in uso, il compilatore usato per compilare @command{gawk}, e i
-risultati esatti che @command{gawk} ha prodotto. Inoltre andrebbe specificato
-cosa ci si aspettava che il programma facesse; questo @`e di aiuto per decidere
-se il problema @`e un problema di documentazione.
-
-@`E importante includere il numero di versione di @command{gawk} in uso.
+@item
+Prima di segnalare un bug o di tentare di risolverlo personalmente, si tenti
+di isolarlo preparando un programma @command{awk} il pi@`u piccolo possibile,
+con un @value{DF} in input che possa riprodurre il problema.
+
+Dopo averlo fatto, si spedisca:
+
+@itemize @bullet
+@item
+il programma e il @value{DF}.
+
+@item
+Qualche informazioni sul tipo di sistema Unix in uso.
+
+@item
+Il compilatore usato per compilare @command{gawk},
+
+@item
+I risultati esatti che @command{gawk} ha prodotto. Inoltre andrebbe
+specificato cosa ci si aspettava che il programma facesse; questo @`e
+di aiuto per decidere se il problema @`e un problema di documentazione.
+
+@item
+Il numero di versione di @command{gawk} in uso.
Questa informazione si pu@`o ottenere con il comando @samp{gawk --version}.
+@end itemize
+
+@item
+@emph{Non} inviare immagini di videate. In alternativa, usate COPIA/INCOLLA
+per inviare testo, o per spedire file.
+
+@item
+Spedite file come allegati, invece che nel corpo del messaggio.
+Ci@`o evita la possibile corruzione del file da programmi di gestione
+della posta attraverso cui il messaggio transita in Internet.
+
+@item
+Accertatevi di spedire tutta la posta in formato @emph{testo},
+e non (o non soltanto) in formato HTML.
+
+@item
+@emph{Tutto il messaggio dev'essere in inglese. Questa @`e la sola
+lingua che tutti i manutentori comprendono.}
+@end enumerate
@cindex @code{bug-gawk@@gnu.org} indirizzo per la segnalazione dei bug
@cindex email @subentry indirizzo per segnalare bug @subentry @code{bug-gawk@@gnu.org}
@@ -45145,7 +46281,8 @@ Questa informazione si pu@`o ottenere con il comando @samp{gawk --version}.
@cindex bug @subentry segnalare @subentry indirizzo email, @code{bug-gawk@@gnu.org}
@cindex segnalare bug @subentry indirizzo email @subentry @code{bug-gawk@@gnu.org}
Una volta pronta la descrizione precisa del problema, si spedisca un messaggio
-di posta elettronica a @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org}.
+di posta elettronica a
+@EMAIL{bug-gawk@@gnu.org,bug (trattino) gawk (chiocciola) gnu (punto) org}.
I manutentori di @command{gawk} sono i destinatari, e riceveranno la
segnalazione di errore. Sebbene sia possibile spedire messaggi direttamente ai
@@ -45159,7 +46296,8 @@ conoscono.} Inoltre, occorre accertarsi di spedire tutti i messaggi in formato
Molte distribuzioni di GNU/Linux e i vari sistemi operativi basati su
BSD hanno un loro proprio canale per segnalare i bug. Se si segnala un
bug usando il canale della distribuzione, una copia del messaggio andrebbe
-inviata anche a @EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org}.
+inviata anche a
+@EMAIL{bug-gawk@@gnu.org,bug (trattino) gawk (chiocciola) gnu (punto) org}.
Questo per due ragioni. La prima @`e che, sebbene alcune distribuzioni inoltrino
i messaggi sui problemi ``verso l'alto'' alla mailing list GNU, molte non lo
@@ -45170,11 +46308,6 @@ cosa all'interno del progetto GNU consente di avere a disposizione tutte le
informazioni rilevanti senza dover dipendere da altre organizzazioni.
@end quotation
-Suggerimenti non correlati a bug sono pure sempre benvenuti. Se si hanno
-domande riguardo a qualcosa di non chiaro nella documentazione o a proposito
-di funzionalit@`a oscure, si scriva alla mailing list dei bug; si prover@`a
-a essere di aiuto nei limiti del possibile.
-
Si tenga presente: Si chiede di seguire le
@uref{https://gnu.org/philosophy/kind-communication.html,
@dfn{GNU Kind Communication Guidelines}
@@ -45228,8 +46361,175 @@ and run to another section of the playground. Then, if you like mixing
metaphors, you can throw rocks from there."
@end ignore
+@node Bug di prestazione
+@appendixsubsec Che fare in caso di problemi di prestazione
+
+@cindex prestazione @subentry controllare problemi di
+@cindex segnalare bug @subentry solo dopo controlli
+@cindex compilare @command{gawk} per la profilazione
+@cindex profilare programmi @command{awk}
+@cindex profilazione @subentry in @command{gawk}
+Se si ritiene che @command{gawk} sia troppo lento nell'eseguire un
+particolare compito, si dovrebbe effettuare qualche indagine prima
+di segnalare un bug. Questi sono i passi da seguire:
+
+@enumerate 1
+@item
+Eseguire @command{gawk} specificando l'opzione @option{--profile}
+(@pxref{Opzioni}) per vedere cosa fa il programma in questione.
+Pu@`o darsi che sia stato scritto in maniera inefficiente.
+Per esempio, il programma potrebbe fare, per ogni record di un file,
+ci@`o che potrebbe essere fatto una volta sola per ogni file.
+(Per questo, si pu@`o usare una regola @code{BEGINFILE};
+@pxref{BEGINFILE/ENDFILE}.)
+Oppure si pu@`o fare qualcosa per ogni file che pu@`o essere
+fatto una volta solo per ogni esecuzione del programma.
+(Per questo si pu@`o usare una regola @code{BEGIN}; @pxref{BEGIN/END}.)
+
+@item
+Se la profilazione a livello di @command{awk} non @`e sufficiente
+a risolvere il problema, sar@`a necessario compilare lo stesso
+@command{gawk} per effettuare una profilazione a livello del
+linguaggio C.
+
+Per fare ci@`o, occorre partire dall'ultima versione rilasciata
+di @command{gawk}. Dopo aver scompattato il codice sorgente
+in una nuova directory, lo si configuri per fare questo:
+
+@example
+$ @kbd{tar -xpzvf gawk-X.Y.Z.tar.gz}
+@print{} @dots{} @ii{Output omesso}
+$ @kbd{cd gawk-X.Y.Z}
+$ @kbd{./configure}
+@print{} @dots{} @ii{Output omesso}
+@end example
+
+@item
+Dopo questo, vanno modificati i file @file{Makefile} e
+@file{support/Makefile}.
+Ogni ricorrenza di @option{-O2} o @option{-O} va cambiata
+in @option{-pg}.
+Ci@`o fa s@`{@dotless{i}} che @command{gawk} sar@`a poi compilato per la
+profilazione.
+
+@item
+Compilare il programma eseguendo il comando @command{make}:
+
+@example
+@group
+$ @kbd{make}
+@print{} @dots{} @ii{Output omesso}
+@end group
+@end example
+
+@item
+Eseguire, usando @command{gawk} cos@`{@dotless{i}} compilato un @emph{vero}
+programma, usando @emph{veri} dati. Usare un programma scritto solo per
+verificare il funzionamento di una particolare funzionalit@`a di
+@command{gawk} non serve a nulla; i veri programmi @command{awk} generalmente
+usano la maggior parte del tempo di esecuzione per fare I/O, non per fare
+calcoli. Per dimostrare che qualcosa @`e lento, si @emph{deve} farlo usando
+dati reali e un programma reale.
+
+Il file di dati da usare dev'essere abbastanza grosso da permettere alla
+profilazione statistica di misurare dove @command{gawk} impiega il
+tempo di esecuzione. La sua dimensione dovrebbe essere almeno 100 megabyte.
+
+@example
+$ @kbd{./gawk -f programma-reale.awk dati-reali > /dev/null}
+@end example
+
+@item
+Alla fine del test, dovreste trovare nella directory corrente un file
+di nome @file{gmon.out}. A quel punto va eseguito il comando
+@samp{gprof gawk gmon.out > gprof.out}.
+
+@item
+Inviare una segnalazione di bug spiegando cosa si pensa funzioni
+lentamente. Includere nella stessa il file @file{gprof.out}.
+
+Sarebbe preferibile poter disporre anche del programma e dei
+dati, oppure dell'indicazione di come reperire i dati se il
+relativo file @`e molto grande.
+
+@item
+Se non sono stati resi disponibile il programma e i dati, occorre essere
+preparati ad applicare delle @dfn{patch}, e a rifare la profilazione,
+per verificare se le @dfn{patch} hanno risolto il problema.
+
+@end enumerate
+
+Se non si @`e in grado di, o non si vuole, eseguire i passi sopra elencati,
+ci si deve rassegnare a vivere con il @command{gawk} disponibile.
+
+@node Richieste di aiuto
+@appendixsubsec Dove spedire richieste non relative a bug
+
+Se avete domande relative alla programmazione @command{awk}, o sul perch@'e
+@command{gawk} si comporta in un certo modo, o per qualsiasi altra domanda
+relativa ad @command{awk} o a @command{gawk},
+siete pregati di @emph{non} inviarle all'indirizzo che si usa per
+segnalare bug.
+
+A far data dal 21 luglio 2021, esiste una mailing list a parte
+creata proprio per tali casi:
+@EMAIL{help-gawk@@gnu.org, help (trattino) gawk (chiocciola) gnu (punto) org}.
+Tutto ci@`o che non @`e una segnalazione di bug andrebbe spedito
+a tale lista.
+
+@quotation NOTA
+Se non si rispettano queste regole, e si spediscono domande non realtive
+a bug alla mailing list dei bug, si verr@`a soltanto invitati a usare la
+mailing list dedicata alle richieste di aiuto.
+Dopo la seconda richiesta di queto tipo, sarete esclusi senza preavviso
+(@emph{blacklisted}) dalla lista di segnalazione dei bug.
+@end quotation
+
+Per piacere, tenete presente: Come per la mailing list dedicata
+alla segnalazione di bug, siete invitati a seguire le
+@uref{https://gnu.org/philosophy/kind-communication.html,
+-- Linee guida GNU per una comunicazione gentile}
+nella vostra corrispondenza (e anche in generale).
+
+@cindex Proulx, Bob
+Se volete far parte della lista di help, per essere di
+aiuto ad altri, o per imparare da altri, ecco le
+istruzioni per registrarsi, fornite da Bob Proulx:
+
+@table @emph
+@item Sottoscrizione via email
+
+Spedire un messaggio email a
+@EMAIL{help-gawk-request@@gnu.org, help (trattino) gawk (trattino) request (chiocciola) gnu (punto) org}
+con ``subscribe'' nel corpo del messaggio.
+L'argomento del messaggio non importa e non @`e usato.
+
+@item Sottoscrizione tramite formulario web
+
+Per usare l'interfacci web, visitare
+@uref{https://lists.gnu.org/mailman/listinfo/help-gawk,
+la pagina con le informazioni sulla lista}.
+Usare il formulario per la sottoscrizione, inserire il vostro
+indirizzo email e spedite usando il pulsante @code{Subscribe}.
+
+@item Rispondere al messaggio di conferma
+
+In entrambi i casi occorre rispondere al messaggio di conferma
+che viene spedito al vostro indirizzo email.
+@end table
+
+Bob fa anche presente che @`e possibile usare l'email sia
+per la sottoscrizione alla lista che per uscire dalla lista.
+Per esempio:
+
+@example
+$ @kbd{echo help | mailx -s request help-gawk-request@@gnu.org}
+$ @kbd{echo subscribe | mailx -s request help-gawk-request@@gnu.org}
+$ @kbd{echo unsubscribe | mailx -s request help-gawk-request@@gnu.org}
+@end example
+
@node Manutentori
-@appendixsubsec Notificare problemi per versioni non-Unix
+@appendixsubsec Manutentori di versioni non-Unix
Se si riscontrano bug in una delle versioni non-Unix di @command{gawk}, una
copia del messaggio inviato alla mailing list dei bug andrebbe spedita alla
@@ -45254,24 +46554,24 @@ Le persone che si occupano delle varie versioni di @command{gawk} sono:
@ifclear SMALLPRINT
@multitable {MS-Windows con MinGW} {123456789012345678901234567890123456789001234567890}
@end ifclear
-@item Unix e sistemi POSIX @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold at skeeve dot com}
+@item Unix e sistemi POSIX @tab Arnold Robbins, @EMAIL{arnold@@skeeve.com,arnold (chiocciola) skeeve (punto) com}
-@item MS-DOS with DJGPP @tab Juan Manuel Guerrero, @EMAIL{juan.guerrero@@gmx.de, juan dot guerrero at gmx dot de}
+@item MS-DOS with DJGPP @tab Juan Manuel Guerrero, @EMAIL{juan.guerrero@@gmx.de, juan (punto) guerrero (chiocciola) gmx (punto) de}
-@item MS-Windows con MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz at gnu dot org}
+@item MS-Windows con MinGW @tab Eli Zaretskii, @EMAIL{eliz@@gnu.org,eliz (chiocciola) gnu (punto) org}
@c Leave this in the document on purpose.
@c OS/2 is not mentioned anywhere else though.
-@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas dot buening at nexgo dot de}
+@item OS/2 @tab Andreas Buening, @EMAIL{andreas.buening@@nexgo.de,andreas (punto) buening (chiocciola) nexgo (punto) de}
-@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw at qsl.net}
+@item VMS @tab John Malmberg, @EMAIL{wb8tyw@@qsl.net,wb8tyw (chiocciola) qsl (punto) net}
-@item z/OS (OS/390) @tab Daniel Richard G.@: @EMAIL{skunk@@iSKUNK.ORG,skunk at iSKUNK.ORG}
+@item z/OS (OS/390) @tab Daniel Richard G.@: @EMAIL{skunk@@iSKUNK.ORG,skunk (chiocciola) iSKUNK (punto) ORG}
@end multitable
Se il problema riscontrato @`e riproducibile anche sotto Unix,
si dovrebbe spedire una copia del messaggio anche alla mailing list
-@EMAIL{bug-gawk@@gnu.org,bug-gawk at gnu dot org}.
+@EMAIL{bug-gawk@@gnu.org,bug (trattino) gawk (chiocciola) gnu (punto) org}.
La versione generata usando gli strumenti DJGPP non @`e pi@`u supportata;
il codice relativo rester@`a nella distribuzione ancora per qualche tempo,
@@ -45312,7 +46612,14 @@ Date: Wed, 4 Sep 1996 08:11:48 -0700 (PDT)
Ci sono alcune altre implementazioni di @command{awk} disponibili
gratuitamente.
-Questa @value{SECTION} descrive in breve dove @`e possibile trovarle:
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+descrive in breve dove @`e possibile trovarle:
@table @asis
@cindex Kernighan, Brian
@@ -45400,8 +46707,8 @@ e prepara il codice eseguibile usando una libreria di funzioni che
implementano le funzionalit@`a di base di @command{awk}.
Comprende anche un certo numero di estensioni.
-Il traduttore di @command{awk} @`e rilasciato sotto la licenza GPL, e la
-relativa libreria sotto la licenza LGPL.
+Sia il traduttore di @command{awk} che la relativa libreria sono
+rilasciate sotto la licenza GPL.
Per ottenere @command{awka}, si visiti
il sito @url{https://sourceforge.net/projects/awka}.
@@ -45411,6 +46718,10 @@ il sito @url{https://sourceforge.net/projects/awka}.
Il progetto sembra essere stato congelato; non ci sono state modifiche nel
codice sorgente dal 2001 circa.
+@item Resuscitare Awka
+Questo progetto, disponibile nel sito @uref{https://github.com/noyesno/awka},
+si propone di fissare bug in @command{awka} e di aggiungere nuove funzionalit@`a.
+
@cindex Beebe, Nelson H.F.@:
@cindex @command{pawk} (versione con profilazione di Brian Kernighan @command{awk})
@cindex codice sorgente @subentry @command{pawk}
@@ -45464,6 +46775,17 @@ il progetto
mette a disposizione questa implementazione. Si possono vedere i singoli file in
@uref{https://github.com/joyent/illumos-joyent/blob/master/usr/src/cmd/awk_xpg4}.
+@cindex @command{frawk}
+@cindex sorgente @subentry codice @subentry @command{frawk}
+@cindex codice sorgente @subentry @command{frawk}
+@item @command{frawk}
+Questo @`e un linguaggio per scrivere programmi corti.
+``In prima approssimazione, @`e un'implementazione del linguaggio AWK;
+molti comuni programmi @command{awk} producono un output equivalente
+quando passati a @command{frawk}.'' Comunque, ha anche numerose e
+importanti funzionalit@`a ulteriori. Il codice sorgente @`e disponibile
+sul sito @uref{https://github.com/ezrosent/frawk}.
+
@cindex @command{goawk}
@cindex Go @subentry implementazione di @command{awk}
@cindex sorgente @subentry @command{goawk}
@@ -45490,7 +46812,13 @@ essere un interprete completo, anche se, poich@'e usa funzionalit@`a di Java
per l'I/O e per la ricerca di @dfn{regexp}, il linguaggio che supporta
@`e differente da @command{awk} POSIX.
Ulteriori informazioni sono disponibili sulla
-@uref{https://jawk.sourceforge.net, pagina principale del progetto}.
+@uref{http://jawk.sourceforge.net, pagina principale del progetto}.
+
+@item Hoijui's @command{jawk}
+Questo progetto, disponibili sul sito
+@uref{https://github.com/hoijui/Jawk},
+@`e un altro interpretatore di @command{awk} scritto in Java.
+Usa i moderni strumenti di sviluppo software di Java.
@item Libmawk
@cindex @command{libmawk} (interpretatore)
@@ -45504,7 +46832,6 @@ Questo @`e un interprete @command{awk} incorporabile, derivato da
@cindex interpretatore @command{awk} incorporabile @subentry codice sorgente
@cindex Neacsu, Mircea
@item @command{awk} incorporabile di Mircea Neacsu
-@item incorporabile, @command{awk}, di Mircea Neacsu
Mircea Neacsu ha creato un interpretatore @command{awk}
incorporabile, basato su BWK @command{awk}. @`E disponibile
nel sito @uref{https://github.com/neacsum/awk}.
@@ -45549,6 +46876,9 @@ Wikipedia} su @command{awk} per informazioni su ulteriori versioni.
@end table
+Un'interessante raccolta di funzioni di libreria @`e disponibile sul sito
+@uref{https://github.com/e36freak/awk-libs}.
+
@node Sommario dell'installazione
@appendixsec Sommario
@@ -45577,16 +46907,30 @@ correntemente supportati sono MS-Windows, usando
MSYS, MSYS2, DJGPP, MinGW e Cygwin,
@c OS/2,
e sia Vax/VMS che OpenVMS. Le istruzioni per ognuno di questi sistemi sono
-incluse in questa @value{APPENDIX}.
+incluse in
+@ifnotinfo
+questa
+@end ifnotinfo
+@ifinfo
+questo
+@end ifinfo
+@value{APPENDIX}.
@item
Le segnalazioni di errori (bug) dovrebbero essere spedite tramite email a
-@email{bug-gawk@@gnu.org}. Le segnalazioni di errore dovrebbero essere scritte
+@EMAIL{bug-gawk@@gnu.org, bug (trattino) gawk (chiocciola) gnu (punto) org}.
+Le segnalazioni di errore dovrebbero essere scritte
in inglese e dovrebbero specificare la versione di @command{gawk} in uso, come
@`e stata compilata, un breve programma e un @value{DF} che permettono di
riprodurre il problema.
@item
+Messaggi che non riguardano bug vanno spediti a
+@EMAIL{help-gawk@@gnu.org, help (trattino) gawk (chiocciola) gnu (punto) org}.
+Chi spedisce pi@`u messaggi che non riguardano bug alla mailing list
+dei bug verr@`a escluso dalla stessa (@dfn{blacklisted}).
+
+@item
Ci sono alcune altre implementazioni di @command{awk} disponibili
gratuitamente. Molte rispettano lo standard POSIX; altre un po' meno.
@@ -45742,7 +47086,7 @@ attribuendo il copyright delle modifiche all'FSF.
Entrambe queste azioni sono semplici da fare, e @emph{molte} persone gi@`a
l'hanno fatto. Se ci sono domande da fare, mettersi in contatto con me
(@pxref{Bug}),
-oppure @EMAIL{assign@@gnu.org,assign chiocciola gnu punto org}.
+oppure @EMAIL{assign@@gnu.org,assign (chiocciola) gnu (punto) org}.
@item
Utilizzare l'ultima versione.
@@ -45928,7 +47272,8 @@ di pubblico dominio, tramite la firma di un documento apposito, oppure
attribuendo il copyright delle modifiche all'FSF.
Entrambe queste azioni sono semplici da fare, e @emph{molte} persone gi@`a
l'hanno fatto. Se ci sono domande da fare, scrivere a me
-oppure all'indirizzo @email{gnu@@gnu.org}.
+oppure all'indirizzo
+@EMAIL{gnu@@gnu.org, gnu (chiocciola) gnu (punto) org}.
@item
Nel realizzare un @dfn{port}, tener presente che il codice
@@ -46319,7 +47664,14 @@ sistemi operativi possono avere limiti differenti.
@node Progetto delle estensioni
@appendixsec Note di progetto dell'estensione API
-Questa @value{SECTION} documenta l'architettura dell'estensione API,
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+documenta l'architettura dell'estensione API,
inclusa una trattazione sommaria della progettazione e dei problemi che
andavano risolti.
@@ -47291,9 +48643,9 @@ il record in input con un'espressione regolare.
@item Espressione logica
Un'espressione che usa gli operatori logici AND, OR e NOT,
-scritti come @samp{&&}, @samp{||}, e @samp{!} in @command{awk}.
-Spesso chiamate espressioni booleane, dal nome del matematico che per primo
-ha sistematizzato questo tipo di logica matematica.
+scritti come @samp{&&}, @samp{||} e @samp{!} in @command{awk}.
+Spesso chiamate @dfn{espressioni booleane}, dal nome del matematico che
+per primo ha sistematizzato questo tipo di logica matematica.
@item Espressione regolare
un'espressione regolare (abbreviabile come ``@dfn{regexp}'') @`e un modello che
@@ -47764,7 +49116,7 @@ e @ref{Ridirezione}).
@item @dfn{Rvalue}
[right-value, ossia valore a destra] Un valore che pu@`o apparire alla destra
-di un operatore di assegnazione.
+di un operatore di assegnamento.
In @command{awk}, essenzialmente ogni espressione ha un valore.
Ognuno di questi valori @`e un @dfn{rvalue}.
diff --git a/doc/it/gendocs.sh b/doc/it/gendocs.sh
new file mode 100755
index 00000000..1872de9d
--- /dev/null
+++ b/doc/it/gendocs.sh
@@ -0,0 +1,510 @@
+#!/bin/sh -e
+# gendocs.sh -- generate a GNU manual in many formats. This script is
+# mentioned in maintain.texi. See the help message below for usage details.
+
+scriptversion=2021-01-01.00
+
+# Copyright 2003-2021 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+# Original author: Mohit Agarwal.
+# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
+#
+# The latest version of this script, and the companion template, is
+# available from the Gnulib repository:
+#
+# https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
+# https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
+
+# TODO:
+# - image importing was only implemented for HTML generated by
+# makeinfo. But it should be simple enough to adjust.
+# - images are not imported in the source tarball. All the needed
+# formats (PDF, PNG, etc.) should be included.
+
+prog=`basename "$0"`
+srcdir=`pwd`
+
+scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
+templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
+
+: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
+: ${MAKEINFO="makeinfo"}
+: ${TEXI2DVI="texi2dvi"}
+: ${DOCBOOK2HTML="docbook2html"}
+: ${DOCBOOK2PDF="docbook2pdf"}
+: ${DOCBOOK2TXT="docbook2txt"}
+: ${GENDOCS_TEMPLATE_DIR="."}
+: ${PERL='perl'}
+: ${TEXI2HTML="texi2html"}
+unset CDPATH
+unset use_texi2html
+
+MANUAL_TITLE=
+PACKAGE=
+EMAIL=webmasters@gnu.org # please override with --email
+commonarg= # passed to all makeinfo/texi2html invcations.
+dirargs= # passed to all tools (-I dir).
+dirs= # -I directories.
+htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
+default_htmlarg=true
+infoarg=--no-split
+generate_ascii=true
+generate_html=true
+generate_info=true
+generate_tex=true
+outdir=manual
+source_extra=
+split=node
+srcfile=
+texarg="-t @finalout"
+
+version="gendocs.sh $scriptversion
+
+Copyright 2021 Free Software Foundation, Inc.
+There is NO warranty. You may redistribute this software
+under the terms of the GNU General Public License.
+For more information about these matters, see the files named COPYING."
+
+usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
+
+Generate output in various formats from PACKAGE.texinfo (or .texi or
+.txi) source. See the GNU Maintainers document for a more extensive
+discussion:
+ https://www.gnu.org/prep/maintain_toc.html
+
+Options:
+ --email ADR use ADR as contact in generated web pages; always give this.
+
+ -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
+ -o OUTDIR write files into OUTDIR, instead of manual/.
+ -I DIR append DIR to the Texinfo search path.
+ --common ARG pass ARG in all invocations.
+ --html ARG pass ARG to makeinfo or texi2html for HTML targets,
+ instead of '$htmlarg'.
+ --info ARG pass ARG to makeinfo for Info, instead of --no-split.
+ --no-ascii skip generating the plain text output.
+ --no-html skip generating the html output.
+ --no-info skip generating the info output.
+ --no-tex skip generating the dvi and pdf output.
+ --source ARG include ARG in tar archive of sources.
+ --split HOW make split HTML by node, section, chapter; default node.
+ --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
+
+ --texi2html use texi2html to make HTML target, with all split versions.
+ --docbook convert through DocBook too (xml, txt, html, pdf).
+
+ --help display this help and exit successfully.
+ --version display version information and exit successfully.
+
+Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
+
+Typical sequence:
+ cd PACKAGESOURCE/doc
+ wget \"$scripturl\"
+ wget \"$templateurl\"
+ $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
+
+Output will be in a new subdirectory \"manual\" (by default;
+use -o OUTDIR to override). Move all the new files into your web CVS
+tree, as explained in the Web Pages node of maintain.texi.
+
+Please use the --email ADDRESS option so your own bug-reporting
+address will be used in the generated HTML pages.
+
+MANUAL-TITLE is included as part of the HTML <title> of the overall
+manual/index.html file. It should include the name of the package being
+documented. manual/index.html is created by substitution from the file
+$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
+generic template for your own purposes.)
+
+If you have several manuals, you'll need to run this script several
+times with different MANUAL values, specifying a different output
+directory with -o each time. Then write (by hand) an overall index.html
+with links to them all.
+
+If a manual's Texinfo sources are spread across several directories,
+first copy or symlink all Texinfo sources into a single directory.
+(Part of the script's work is to make a tar.gz of the sources.)
+
+As implied above, by default monolithic Info files are generated.
+If you want split Info, or other Info options, use --info to override.
+
+You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
+and PERL to control the programs that get executed, and
+GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
+looked for. With --docbook, the environment variables DOCBOOK2HTML,
+DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
+
+By default, makeinfo and texi2dvi are run in the default (English)
+locale, since that's the language of most Texinfo manuals. If you
+happen to have a non-English manual and non-English web site, see the
+SETLANG setting in the source.
+
+Email bug reports or enhancement requests to bug-gnulib@gnu.org.
+"
+
+while test $# -gt 0; do
+ case $1 in
+ -s) shift; srcfile=$1;;
+ -o) shift; outdir=$1;;
+ -I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
+ --common) shift; commonarg=$1;;
+ --docbook) docbook=yes;;
+ --email) shift; EMAIL=$1;;
+ --html) shift; default_htmlarg=false; htmlarg=$1;;
+ --info) shift; infoarg=$1;;
+ --no-ascii) generate_ascii=false;;
+ --no-html) generate_ascii=false;;
+ --no-info) generate_info=false;;
+ --no-tex) generate_tex=false;;
+ --source) shift; source_extra=$1;;
+ --split) shift; split=$1;;
+ --tex) shift; texarg=$1;;
+ --texi2html) use_texi2html=1;;
+
+ --help) echo "$usage"; exit 0;;
+ --version) echo "$version"; exit 0;;
+ -*)
+ echo "$0: Unknown option \`$1'." >&2
+ echo "$0: Try \`--help' for more information." >&2
+ exit 1;;
+ *)
+ if test -z "$PACKAGE"; then
+ PACKAGE=$1
+ elif test -z "$MANUAL_TITLE"; then
+ MANUAL_TITLE=$1
+ else
+ echo "$0: extra non-option argument \`$1'." >&2
+ exit 1
+ fi;;
+ esac
+ shift
+done
+
+# makeinfo uses the dirargs, but texi2dvi doesn't.
+commonarg=" $dirargs $commonarg"
+
+# For most of the following, the base name is just $PACKAGE
+base=$PACKAGE
+
+if $default_htmlarg && test -n "$use_texi2html"; then
+ # The legacy texi2html doesn't support TOP_NODE_UP_URL
+ htmlarg="--css-ref=/software/gnulib/manual.css"
+fi
+
+if test -n "$srcfile"; then
+ # but here, we use the basename of $srcfile
+ base=`basename "$srcfile"`
+ case $base in
+ *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
+ esac
+ PACKAGE=$base
+elif test -s "$srcdir/$PACKAGE.texinfo"; then
+ srcfile=$srcdir/$PACKAGE.texinfo
+elif test -s "$srcdir/$PACKAGE.texi"; then
+ srcfile=$srcdir/$PACKAGE.texi
+elif test -s "$srcdir/$PACKAGE.txi"; then
+ srcfile=$srcdir/$PACKAGE.txi
+else
+ echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
+ exit 1
+fi
+
+if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
+ echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
+ echo "$0: it is available from $templateurl." >&2
+ exit 1
+fi
+
+# Function to return size of $1 in something resembling kilobytes.
+calcsize()
+{
+ size=`ls -ksl $1 | awk '{print $1}'`
+ echo $size
+}
+
+# copy_images OUTDIR HTML-FILE...
+# -------------------------------
+# Copy all the images needed by the HTML-FILEs into OUTDIR.
+# Look for them in . and the -I directories; this is simpler than what
+# makeinfo supports with -I, but hopefully it will suffice.
+copy_images()
+{
+ local odir
+ odir=$1
+ shift
+ $PERL -n -e "
+BEGIN {
+ \$me = '$prog';
+ \$odir = '$odir';
+ @dirs = qw(. $dirs);
+}
+" -e '
+/<img src="(.*?)"/g && ++$need{$1};
+
+END {
+ #print "$me: @{[keys %need]}\n"; # for debugging, show images found.
+ FILE: for my $f (keys %need) {
+ for my $d (@dirs) {
+ if (-f "$d/$f") {
+ use File::Basename;
+ my $dest = dirname ("$odir/$f");
+ #
+ use File::Path;
+ -d $dest || mkpath ($dest)
+ || die "$me: cannot mkdir $dest: $!\n";
+ #
+ use File::Copy;
+ copy ("$d/$f", $dest)
+ || die "$me: cannot copy $d/$f to $dest: $!\n";
+ next FILE;
+ }
+ }
+ die "$me: $ARGV: cannot find image $f\n";
+ }
+}
+' -- "$@" || exit 1
+}
+
+case $outdir in
+ /*) abs_outdir=$outdir;;
+ *) abs_outdir=$srcdir/$outdir;;
+esac
+
+echo "Making output for $srcfile"
+echo " in `pwd`"
+mkdir -p "$outdir/"
+
+#
+if $generate_info; then
+ cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
+ echo "Generating info... ($cmd)"
+ rm -f $PACKAGE.info* # get rid of any strays
+ eval "$cmd"
+ tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
+ ls -l "$outdir/$PACKAGE.info.tar.gz"
+ info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
+ # do not mv the info files, there's no point in having them available
+ # separately on the web.
+fi # end info
+
+#
+if $generate_tex; then
+ cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
+ printf "\nGenerating dvi... ($cmd)\n"
+ eval "$cmd"
+ # compress/finish dvi:
+ gzip -f -9 $PACKAGE.dvi
+ dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
+ mv $PACKAGE.dvi.gz "$outdir/"
+ ls -l "$outdir/$PACKAGE.dvi.gz"
+
+ cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
+ printf "\nGenerating pdf... ($cmd)\n"
+ eval "$cmd"
+ pdf_size=`calcsize $PACKAGE.pdf`
+ mv $PACKAGE.pdf "$outdir/"
+ ls -l "$outdir/$PACKAGE.pdf"
+fi # end tex (dvi + pdf)
+
+#
+if $generate_ascii; then
+ opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
+ cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+ printf "\nGenerating ascii... ($cmd)\n"
+ eval "$cmd"
+ ascii_size=`calcsize $PACKAGE.txt`
+ gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
+ ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
+ mv $PACKAGE.txt "$outdir/"
+ ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
+fi
+
+#
+
+if $generate_html; then
+# Split HTML at level $1. Used for texi2html.
+html_split()
+{
+ opt="--split=$1 --node-files $commonarg $htmlarg"
+ cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
+ printf "\nGenerating html by $1... ($cmd)\n"
+ eval "$cmd"
+ split_html_dir=$PACKAGE.html
+ (
+ cd ${split_html_dir} || exit 1
+ ln -sf ${PACKAGE}.html index.html
+ tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
+ )
+ eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+ rm -f "$outdir"/html_$1/*.html
+ mkdir -p "$outdir/html_$1/"
+ mv ${split_html_dir}/*.html "$outdir/html_$1/"
+ rmdir ${split_html_dir}
+}
+
+if test -z "$use_texi2html"; then
+ opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
+ cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+ printf "\nGenerating monolithic html... ($cmd)\n"
+ rm -rf $PACKAGE.html # in case a directory is left over
+ eval "$cmd"
+ html_mono_size=`calcsize $PACKAGE.html`
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ copy_images "$outdir/" $PACKAGE.html
+ mv $PACKAGE.html "$outdir/"
+ ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
+
+ # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
+ # it just always split by node. So if we're splitting by node anyway,
+ # leave it out.
+ if test "x$split" = xnode; then
+ split_arg=
+ else
+ split_arg=--split=$split
+ fi
+ #
+ opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
+ cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
+ printf "\nGenerating html by $split... ($cmd)\n"
+ eval "$cmd"
+ split_html_dir=$PACKAGE.html
+ copy_images $split_html_dir/ $split_html_dir/*.html
+ (
+ cd $split_html_dir || exit 1
+ tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
+ )
+ eval \
+ html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
+ rm -rf "$outdir/html_$split/"
+ mv $split_html_dir "$outdir/html_$split/"
+ du -s "$outdir/html_$split/"
+ ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
+
+else # use texi2html:
+ opt="--output $PACKAGE.html $commonarg $htmlarg"
+ cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
+ printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
+ rm -rf $PACKAGE.html # in case a directory is left over
+ eval "$cmd"
+ html_mono_size=`calcsize $PACKAGE.html`
+ gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
+ html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
+ mv $PACKAGE.html "$outdir/"
+
+ html_split node
+ html_split chapter
+ html_split section
+fi
+fi # end html
+
+#
+printf "\nMaking .tar.gz for sources...\n"
+d=`dirname $srcfile`
+(
+ cd "$d"
+ srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
+ tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
+ ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
+)
+texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
+
+#
+# Do everything again through docbook.
+if test -n "$docbook"; then
+ opt="-o - --docbook $commonarg"
+ cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
+ printf "\nGenerating docbook XML... ($cmd)\n"
+ eval "$cmd"
+ docbook_xml_size=`calcsize $PACKAGE-db.xml`
+ gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
+ docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
+ mv $PACKAGE-db.xml "$outdir/"
+
+ split_html_db_dir=html_node_db
+ opt="$commonarg -o $split_html_db_dir"
+ cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
+ printf "\nGenerating docbook HTML... ($cmd)\n"
+ eval "$cmd"
+ (
+ cd ${split_html_db_dir} || exit 1
+ tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
+ )
+ html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
+ rm -f "$outdir"/html_node_db/*.html
+ mkdir -p "$outdir/html_node_db"
+ mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
+ rmdir ${split_html_db_dir}
+
+ cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
+ printf "\nGenerating docbook ASCII... ($cmd)\n"
+ eval "$cmd"
+ docbook_ascii_size=`calcsize $PACKAGE-db.txt`
+ mv $PACKAGE-db.txt "$outdir/"
+
+ cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
+ printf "\nGenerating docbook PDF... ($cmd)\n"
+ eval "$cmd"
+ docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
+ mv $PACKAGE-db.pdf "$outdir/"
+fi
+
+#
+printf "\nMaking index.html for $PACKAGE...\n"
+if test -z "$use_texi2html"; then
+ CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
+ /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
+else
+ # should take account of --split here.
+ CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
+fi
+
+curdate=`$SETLANG date '+%B %d, %Y'`
+sed \
+ -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
+ -e "s!%%EMAIL%%!$EMAIL!g" \
+ -e "s!%%PACKAGE%%!$PACKAGE!g" \
+ -e "s!%%DATE%%!$curdate!g" \
+ -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
+ -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
+ -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
+ -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
+ -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
+ -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
+ -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
+ -e "s!%%PDF_SIZE%%!$pdf_size!g" \
+ -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
+ -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
+ -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
+ -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
+ -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
+ -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
+ -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
+ -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
+ -e "s,%%SCRIPTURL%%,$scripturl,g" \
+ -e "s!%%SCRIPTNAME%%!$prog!g" \
+ -e "$CONDS" \
+$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
+
+echo "Done, see $outdir/ subdirectory for new files."
+
+# Local variables:
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
diff --git a/doc/it/gendocs_template b/doc/it/gendocs_template
new file mode 100755
index 00000000..cd9ac383
--- /dev/null
+++ b/doc/it/gendocs_template
@@ -0,0 +1,101 @@
+<!--#include virtual="/server/header.html" -->
+<!-- Parent-Version: 1.78 -->
+
+<!--
+Copyright (C) 2006-2021 Free Software Foundation, Inc.
+
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without any warranty.
+-->
+
+<title>%%TITLE%% - GNU Project - Free Software Foundation</title>
+<!--#include virtual="/server/banner.html" -->
+<h2>%%TITLE%%</h2>
+
+<address>Free Software Foundation</address>
+<address>last updated %%DATE%%</address>
+
+<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
+
+<ul>
+<li><a href="%%PACKAGE%%.html">HTML
+ (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+<li><a href="html_node/index.html">HTML</a> - with one web page per
+ node.</li>
+%%IF HTML_SECTION%%
+<li><a href="html_section/index.html">HTML</a> - with one web page per
+ section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="html_chapter/index.html">HTML</a> - with one web page per
+ chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html.gz">HTML compressed
+ (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+ one web page.</li>
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
+ (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per node.</li>
+%%IF HTML_SECTION%%
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
+ (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per section.</li>
+%%ENDIF HTML_SECTION%%
+%%IF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
+ (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+ with one web page per chapter.</li>
+%%ENDIF HTML_CHAPTER%%
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document
+ (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.txt">ASCII text
+ (%%ASCII_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
+ (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
+ (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+<li><a href="%%PACKAGE%%.pdf">PDF file
+ (%%PDF_SIZE%%K bytes)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
+ (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+</ul>
+
+<p>You can <a href="https://shop.fsf.org/">buy printed copies of
+some manuals</a> (among other items) from the Free Software Foundation;
+this helps support FSF activities.</p>
+
+<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
+script</a>.)</p>
+
+<!-- If needed, change the copyright block at the bottom. In general,
+ all pages on the GNU web server should have the section about
+ verbatim copying. Please do NOT remove this without talking
+ with the webmasters first.
+ Please make sure the copyright date is consistent with the document
+ and that it is like this: "2001, 2002", not this: "2001-2002". -->
+</div><!-- for id="content", starts in the include above -->
+<!--#include virtual="/server/footer.html" -->
+<div id="footer">
+<div class="unprintable">
+
+<p>Please send general FSF &amp; GNU inquiries to
+<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
+There are also <a href="/contact/">other ways to contact</a>
+the FSF. Broken links and other corrections or suggestions can be sent
+to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
+</div>
+
+<p>Copyright &copy; 2020 Free Software Foundation, Inc.</p>
+
+<p>This page is licensed under a <a rel="license"
+href="https://creativecommons.org/licenses/by-nd/3.0/us/">Creative
+Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
+
+<!--#include virtual="/server/bottom-notes.html" -->
+
+</div>
+</div>
+</body>
+</html>
diff --git a/doc/it/genera_formati.sh b/doc/it/genera_formati.sh
new file mode 100755
index 00000000..66540f2e
--- /dev/null
+++ b/doc/it/genera_formati.sh
@@ -0,0 +1,13 @@
+:
+# questo script, eseguito in questa directory
+# genera tutti i formati della documentazione gawk
+# che si possono ricavare a partire
+# da gawktexi.in, nella directory ./manual
+#
+# dapprima si prepara il file di input (gawk.texi)
+#
+awk -f sidebar.awk < gawktexi.in > gawk.texi
+#
+# poi si invoca lo script che genera i vari formati
+#
+./gendocs.sh gawk gawk
diff --git a/doc/it/texinfo.tex b/doc/it/texinfo.tex
index 68153132..63a938b4 100644..100755
--- a/doc/it/texinfo.tex
+++ b/doc/it/texinfo.tex
@@ -3,9 +3,9 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2020-10-24.12}
+\def\texinfoversion{2021-04-25.21}
%
-% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc.
+% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
@@ -159,7 +159,7 @@
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
%
-% added for Italian
+% for Italian
%
\gdef\putwordla{la}
\gdef\putwordLa{La}
@@ -174,6 +174,8 @@
\def\xrefil#1{\putwordsivedail{} \xrefX[#1,,,,,,,]}
\def\xrefIl#1{\putwordSivedail{} \xrefX[#1,,,,,,,]}
%
+% end for Italian
+%
% Give the space character the catcode for a space.
\def\spaceisspace{\catcode`\ =10\relax}
@@ -248,7 +250,7 @@
\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount
\removelastskip\penalty-200\bigskip\fi\fi}
-% Output routine
+% Output routine
%
% For a final copy, take out the rectangles
@@ -588,9 +590,8 @@
\fi
}
-% @end foo executes the definition of \Efoo.
-% But first, it executes a specialized version of \checkenv
-%
+
+% @end foo calls \checkenv and executes the definition of \Efoo.
\parseargdef\end{%
\if 1\csname iscond.#1\endcsname
\else
@@ -1019,6 +1020,14 @@ where each line of input produces a line of output.}
\global\everypar = {}%
}
+% leave vertical mode without cancelling any first paragraph indent
+\gdef\imageindent{%
+ \toks0=\everypar
+ \everypar={}%
+ \ptexnoindent
+ \global\everypar=\toks0
+}
+
% @refill is a no-op.
\let\refill=\relax
@@ -1879,19 +1888,23 @@ output) for that.)}
\closein 1
\endgroup
%
- \def\xetexpdfext{pdf}%
- \ifx\xeteximgext\xetexpdfext
- \XeTeXpdffile "#1".\xeteximgext ""
- \else
- \def\xetexpdfext{PDF}%
+ % Putting an \hbox around the image can prevent an over-long line
+ % after the image.
+ \hbox\bgroup
+ \def\xetexpdfext{pdf}%
\ifx\xeteximgext\xetexpdfext
\XeTeXpdffile "#1".\xeteximgext ""
\else
- \XeTeXpicfile "#1".\xeteximgext ""
+ \def\xetexpdfext{PDF}%
+ \ifx\xeteximgext\xetexpdfext
+ \XeTeXpdffile "#1".\xeteximgext ""
+ \else
+ \XeTeXpicfile "#1".\xeteximgext ""
+ \fi
\fi
- \fi
- \ifdim \wd0 >0pt width \xeteximagewidth \fi
- \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
+ \ifdim \wd0 >0pt width \xeteximagewidth \fi
+ \ifdim \wd2 >0pt height \xeteximageheight \fi \relax
+ \egroup
}
\fi
@@ -2689,8 +2702,6 @@ end
\definetextfontsizexi
-\message{markup,}
-
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
@@ -2698,68 +2709,14 @@ end
%
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
-% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
-% define and register \INITMACRO to be called on markup style changes.
-% \INITMACRO can check \currentmarkupstyle for the innermost
-% style.
-
-\let\currentmarkupstyle\empty
-
-\def\setupmarkupstyle#1{%
- \def\currentmarkupstyle{#1}%
- \markupstylesetup
-}
-
-\let\markupstylesetup\empty
-
-\def\defmarkupstylesetup#1{%
- \expandafter\def\expandafter\markupstylesetup
- \expandafter{\markupstylesetup #1}%
- \def#1%
-}
-
-% Markup style setup for left and right quotes.
-\defmarkupstylesetup\markupsetuplq{%
- \expandafter\let\expandafter \temp
- \csname markupsetuplq\currentmarkupstyle\endcsname
- \ifx\temp\relax \markupsetuplqdefault \else \temp \fi
-}
-
-\defmarkupstylesetup\markupsetuprq{%
- \expandafter\let\expandafter \temp
- \csname markupsetuprq\currentmarkupstyle\endcsname
- \ifx\temp\relax \markupsetuprqdefault \else \temp \fi
-}
-
{
\catcode`\'=\active
\catcode`\`=\active
-\gdef\markupsetuplqdefault{\let`\lq}
-\gdef\markupsetuprqdefault{\let'\rq}
-
-\gdef\markupsetcodequoteleft{\let`\codequoteleft}
-\gdef\markupsetcodequoteright{\let'\codequoteright}
+\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
+\gdef\setregularquotes{\let`\lq \let'\rq}
}
-\let\markupsetuplqcode \markupsetcodequoteleft
-\let\markupsetuprqcode \markupsetcodequoteright
-%
-\let\markupsetuplqexample \markupsetcodequoteleft
-\let\markupsetuprqexample \markupsetcodequoteright
-%
-\let\markupsetuplqkbd \markupsetcodequoteleft
-\let\markupsetuprqkbd \markupsetcodequoteright
-%
-\let\markupsetuplqsamp \markupsetcodequoteleft
-\let\markupsetuprqsamp \markupsetcodequoteright
-%
-\let\markupsetuplqverb \markupsetcodequoteleft
-\let\markupsetuprqverb \markupsetcodequoteright
-%
-\let\markupsetuplqverbatim \markupsetcodequoteleft
-\let\markupsetuprqverbatim \markupsetcodequoteright
-
% Allow an option to not use regular directed right quote/apostrophe
% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
% The undirected quote is ugly, so don't make it the default, but it
@@ -2922,7 +2879,7 @@ end
}
% @samp.
-\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
+\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
% @indicateurl is \samp, that is, with quotes.
\let\indicateurl=\samp
@@ -2965,8 +2922,7 @@ end
\global\let'=\rq \global\let`=\lq % default definitions
%
\global\def\code{\begingroup
- \setupmarkupstyle{code}%
- % The following should really be moved into \setupmarkupstyle handlers.
+ \setcodequotes
\catcode\dashChar=\active \catcode\underChar=\active
\ifallowcodebreaks
\let-\codedash
@@ -3120,7 +3076,7 @@ end
\urefcatcodes
%
\global\def\urefcode{\begingroup
- \setupmarkupstyle{code}%
+ \setcodequotes
\urefcatcodes
\let&\urefcodeamp
\let.\urefcodedot
@@ -3241,8 +3197,8 @@ end
\def\kbdsub#1#2#3\par{%
\def\one{#1}\def\three{#3}\def\threex{??}%
\ifx\one\xkey\ifx\threex\three \key{#2}%
- \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
- \else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
+ \else{\tclose{\kbdfont\setcodequotes\look}}\fi
+ \else{\tclose{\kbdfont\setcodequotes\look}}\fi
}
% definition of @key that produces a lozenge. Doesn't adjust to text size.
@@ -3259,7 +3215,7 @@ end
% monospace, don't change it; that way, we respect @kbdinputstyle. But
% if it isn't monospace, then use \tt.
%
-\def\key#1{{\setupmarkupstyle{key}%
+\def\key#1{{\setregularquotes
\nohyphenation
\ifmonospace\else\tt\fi
#1}\null}
@@ -3389,16 +3345,20 @@ end
{\obeylines
\globaldefs=1
\envdef\displaymath{%
-\tex
+\tex%
\def\thisenv{\displaymath}%
+\begingroup\let\end\displaymathend%
$$%
}
-\def\Edisplaymath{$$
+\def\displaymathend{$$\endgroup\end}%
+
+\def\Edisplaymath{%
\def\thisenv{\tex}%
\end tex
}}
+
% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
% except specified as a normal braced arg, so no newlines to worry about.
@@ -4359,82 +4319,8 @@ $$%
\doitemize{#1.}\flushcr
}
-% @alphaenumerate and @capsenumerate are abbreviations for giving an arg
-% to @enumerate.
-%
-\def\alphaenumerate{\enumerate{a}}
-\def\capsenumerate{\enumerate{A}}
-\def\Ealphaenumerate{\Eenumerate}
-\def\Ecapsenumerate{\Eenumerate}
-
% @multitable macros
-% Amy Hendrickson, 8/18/94, 3/6/96
-%
-% @multitable ... @end multitable will make as many columns as desired.
-% Contents of each column will wrap at width given in preamble. Width
-% can be specified either with sample text given in a template line,
-% or in percent of \hsize, the current width of text on page.
-
-% Table can continue over pages but will only break between lines.
-
-% To make preamble:
-%
-% Either define widths of columns in terms of percent of \hsize:
-% @multitable @columnfractions .25 .3 .45
-% @item ...
-%
-% Numbers following @columnfractions are the percent of the total
-% current hsize to be used for each column. You may use as many
-% columns as desired.
-
-
-% Or use a template:
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item ...
-% using the widest term desired in each column.
-
-% Each new table line starts with @item, each subsequent new column
-% starts with @tab. Empty columns may be produced by supplying @tab's
-% with nothing between them for as many times as empty columns are needed,
-% ie, @tab@tab@tab will produce two empty columns.
-
-% @item, @tab do not need to be on their own lines, but it will not hurt
-% if they are.
-
-% Sample multitable:
-
-% @multitable {Column 1 template} {Column 2 template} {Column 3 template}
-% @item first col stuff @tab second col stuff @tab third col
-% @item
-% first col stuff
-% @tab
-% second col stuff
-% @tab
-% third col
-% @item first col stuff @tab second col stuff
-% @tab Many paragraphs of text may be used in any column.
-%
-% They will wrap at the width determined by the template.
-% @item@tab@tab This will be in third column.
-% @end multitable
-
-% Default dimensions may be reset by user.
-% @multitableparskip is vertical space between paragraphs in table.
-% @multitableparindent is paragraph indent in table.
-% @multitablecolmargin is horizontal space to be left between columns.
-% @multitablelinespace is space to leave between table items, baseline
-% to baseline.
-% 0pt means it depends on current normal line spacing.
-%
-\newskip\multitableparskip
-\newskip\multitableparindent
-\newdimen\multitablecolspace
-\newskip\multitablelinespace
-\multitableparskip=0pt
-\multitableparindent=6pt
-\multitablecolspace=12pt
-\multitablelinespace=0pt
% Macros used to set up halign preamble:
%
@@ -4482,8 +4368,6 @@ $$%
\go
}
-% multitable-only commands.
-%
% @headitem starts a heading row, which we typeset in bold. Assignments
% have to be global since we are inside the implicit group of an
% alignment entry. \everycr below resets \everytab so we don't have to
@@ -4500,14 +4384,8 @@ $$%
% default for tables with no headings.
\let\headitemcrhook=\relax
%
-% A \tab used to include \hskip1sp. But then the space in a template
-% line is not enough. That is bad. So let's go back to just `&' until
-% we again encounter the problem the 1sp was intended to solve.
-% --karl, nathan@acm.org, 20apr99.
\def\tab{\checkenv\multitable &\the\everytab}%
-% @multitable ... @end multitable definitions:
-%
\newtoks\everytab % insert after every tab.
%
\envdef\multitable{%
@@ -4522,9 +4400,8 @@ $$%
%
\tolerance=9500
\hbadness=9500
- \setmultitablespacing
- \parskip=\multitableparskip
- \parindent=\multitableparindent
+ \parskip=0pt
+ \parindent=6pt
\overfullrule=0pt
\global\colcount=0
%
@@ -4554,47 +4431,24 @@ $$%
% continue for many paragraphs if desired.
\halign\bgroup &%
\global\advance\colcount by 1
- \multistrut
+ \strut
\vtop{%
- % Use the current \colcount to find the correct column width:
+ \advance\hsize by -1\leftskip
+ % Find the correct column width
\hsize=\expandafter\csname col\the\colcount\endcsname
%
- % In order to keep entries from bumping into each other
- % we will add a \leftskip of \multitablecolspace to all columns after
- % the first one.
- %
- % If a template has been used, we will add \multitablecolspace
- % to the width of each template entry.
- %
- % If the user has set preamble in terms of percent of \hsize we will
- % use that dimension as the width of the column, and the \leftskip
- % will keep entries from bumping into each other. Table will start at
- % left margin and final column will justify at right margin.
- %
- % Make sure we don't inherit \rightskip from the outer environment.
\rightskip=0pt
\ifnum\colcount=1
- % The first column will be indented with the surrounding text.
- \advance\hsize by\leftskip
+ \advance\hsize by\leftskip % Add indent of surrounding text
\else
- \ifsetpercent \else
- % If user has not set preamble in terms of percent of \hsize
- % we will advance \hsize by \multitablecolspace.
- \advance\hsize by \multitablecolspace
- \fi
- % In either case we will make \leftskip=\multitablecolspace:
- \leftskip=\multitablecolspace
+ % In order to keep entries from bumping into each other.
+ \leftskip=12pt
+ \ifsetpercent \else
+ % If a template has been used
+ \advance\hsize by \leftskip
+ \fi
\fi
- % Ignoring space at the beginning and end avoids an occasional spurious
- % blank line, when TeX decides to break the line at the space before the
- % box from the multistrut, so the strut ends up on a line by itself.
- % For example:
- % @multitable @columnfractions .11 .89
- % @item @code{#}
- % @tab Legal holiday which is valid in major parts of the whole country.
- % Is automatically provided with highlighting sequences respectively
- % marking characters.
- \noindent\ignorespaces##\unskip\multistrut
+ \noindent\ignorespaces##\unskip\strut
}\cr
}
\def\Emultitable{%
@@ -4603,31 +4457,6 @@ $$%
\global\setpercentfalse
}
-\def\setmultitablespacing{%
- \def\multistrut{\strut}% just use the standard line spacing
- %
- % Compute \multitablelinespace (if not defined by user) for use in
- % \multitableparskip calculation. We used define \multistrut based on
- % this, but (ironically) that caused the spacing to be off.
- % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100.
-\ifdim\multitablelinespace=0pt
-\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip
-\global\advance\multitablelinespace by-\ht0
-\fi
-% Test to see if parskip is larger than space between lines of
-% table. If not, do nothing.
-% If so, set to same dimension as multitablelinespace.
-\ifdim\multitableparskip>\multitablelinespace
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
- % than skip between lines in the table.
-\fi%
-\ifdim\multitableparskip=0pt
-\global\multitableparskip=\multitablelinespace
-\global\advance\multitableparskip-7pt % to keep parskip somewhat smaller
- % than skip between lines in the table.
-\fi}
-
\message{conditionals,}
@@ -5241,30 +5070,29 @@ $$%
\let\lbracechar\{%
\let\rbracechar\}%
%
+ % Non-English letters.
+ \def\AA{AA}%
+ \def\AE{AE}%
+ \def\DH{DZZ}%
+ \def\L{L}%
+ \def\OE{OE}%
+ \def\O{O}%
+ \def\TH{TH}%
+ \def\aa{aa}%
+ \def\ae{ae}%
+ \def\dh{dzz}%
+ \def\exclamdown{!}%
+ \def\l{l}%
+ \def\oe{oe}%
+ \def\ordf{a}%
+ \def\ordm{o}%
+ \def\o{o}%
+ \def\questiondown{?}%
+ \def\ss{ss}%
+ \def\th{th}%
%
\let\do\indexnofontsdef
%
- % Non-English letters.
- \do\AA{AA}%
- \do\AE{AE}%
- \do\DH{DZZ}%
- \do\L{L}%
- \do\OE{OE}%
- \do\O{O}%
- \do\TH{TH}%
- \do\aa{aa}%
- \do\ae{ae}%
- \do\dh{dzz}%
- \do\exclamdown{!}%
- \do\l{l}%
- \do\oe{oe}%
- \do\ordf{a}%
- \do\ordm{o}%
- \do\o{o}%
- \do\questiondown{?}%
- \do\ss{ss}%
- \do\th{th}%
- %
\do\LaTeX{LaTeX}%
\do\TeX{TeX}%
%
@@ -5389,11 +5217,15 @@ $$%
% The default definitions
\def\sortas#1{}%
\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
+%
% for Italian
+%
\def\putwordSeeAlso{Si veda anche}
\def\seeentry#1{\i{\putwordSiVeda}\ #1}% for sorted index file only
\def\putwordSiVeda{Si veda}
+%
% end for Italian
+%
% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
@@ -7163,7 +6995,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% But \@ or @@ will get a plain @ character.
\envdef\tex{%
- \setupmarkupstyle{tex}%
+ \setregularquotes
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
\catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
@@ -7389,7 +7221,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If you want all examples etc. small: @set dispenvsize small.
% If you want even small examples the full size: @set dispenvsize nosmall.
% This affects the following displayed environments:
-% @example, @display, @format, @lisp
+% @example, @display, @format, @lisp, @verbatim
%
\def\smallword{small}
\def\nosmallword{nosmall}
@@ -7435,9 +7267,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
\maketwodispenvdef{lisp}{example}{%
\nonfillstart
- \tt\setupmarkupstyle{example}%
+ \tt\setcodequotes
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
- \gobble % eat return
+ \parsearg\gobble
}
% @display/@smalldisplay: same as @lisp except keep current font.
%
@@ -7595,7 +7427,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\setupverb{%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\leavevmode\endgraf}%
- \setupmarkupstyle{verb}%
+ \setcodequotes
\tabeightspaces
% Respect line breaks,
% print special symbols as themselves, and
@@ -7636,7 +7468,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
\tabexpand
- \setupmarkupstyle{verbatim}%
+ \setcodequotes
% Respect line breaks,
% print special symbols as themselves, and
% make each space count.
@@ -8055,7 +7887,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% leave the code in, but it's strange for @var to lead to typewriter.
% Nowadays we recommend @code, since the difference between a ttsl hyphen
% and a tt hyphen is pretty tiny. @code also disables ?` !`.
- \def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
+ \def\var##1{{\setregularquotes\ttslanted{##1}}}%
#1%
\sl\hyphenchar\font=45
}
@@ -8164,11 +7996,18 @@ might help (with 'rm \jobname.?? \jobname.??s')%
}
\fi
+\let\E=\expandafter
+
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
- \def\xeatspaces{\eatspaces}%
+ % expand the expansion of \eatleadingcr twice to maybe remove a leading
+ % newline (and \else and \fi tokens), then call \eatspaces on the result.
+ \def\xeatspaces##1{%
+ \E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
+ }}%
+ \def\xempty##1{}%
%
% Process the macro body under the current catcode regime.
\scantokens{#1@comment}%
@@ -8221,6 +8060,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
}
+{\catcode`\^^M=\other%
+\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
+% Warning: this won't work for a delimited argument
+% or for an empty argument
+
% Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3%
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
@@ -8387,6 +8231,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\let\hash\relax
% \hash is redefined to `#' later to get it into definitions
\let\xeatspaces\relax
+ \let\xempty\relax
\parsemargdefxxx#1,;,%
\ifnum\paramno<10\relax\else
\paramno0\relax
@@ -8398,9 +8243,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else \let\next=\parsemargdefxxx
\advance\paramno by 1
\expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
- {\xeatspaces{\hash\the\paramno}}%
+ {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
\edef\paramlist{\paramlist\hash\the\paramno,}%
\fi\next}
+% the \xempty{} is to give \eatleadingcr an argument in the case of an
+% empty macro argument.
% \parsemacbody, \parsermacbody
%
@@ -8989,7 +8836,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else
\ifhavexrefs
% We (should) know the real title if we have the xref values.
- \def\printedrefname{\refx{#1-title}{}}%
+ \def\printedrefname{\refx{#1-title}}%
\else
% Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}%
@@ -9083,7 +8930,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If the user specified the print name (third arg) to the ref,
% print it instead of our usual "Figure 1.2".
\ifdim\wd\printedrefnamebox = 0pt
- \refx{#1-snt}{}%
+ \refx{#1-snt}%
\else
\printedrefname
\fi
@@ -9118,28 +8965,30 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else
% Reference within this manual.
%
- % Only output a following space if the -snt ref is nonempty; for
- % @unnumbered and @anchor, it won't be.
- \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
+ % Only output a following space if the -snt ref is nonempty, as the ref
+ % will be empty for @unnumbered and @anchor.
+ \setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
%
% output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname
%
- % But we always want a comma and a space:
- ,\space
- %
- % output the `page 3'.
- \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
- % Add a , if xref followed by a space
- \if\space\noexpand\tokenafterxref ,%
- \else\ifx\ \tokenafterxref ,% @TAB
- \else\ifx\*\tokenafterxref ,% @*
- \else\ifx\ \tokenafterxref ,% @SPACE
- \else\ifx\
- \tokenafterxref ,% @NL
- \else\ifx\tie\tokenafterxref ,% @tie
- \fi\fi\fi\fi\fi\fi
+ \expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
+ % But we always want a comma and a space:
+ ,\space
+ %
+ % output the `page 3'.
+ \turnoffactive \putwordpage\tie\refx{#1-pg}%
+ % Add a , if xref followed by a space
+ \if\space\noexpand\tokenafterxref ,%
+ \else\ifx\ \tokenafterxref ,% @TAB
+ \else\ifx\*\tokenafterxref ,% @*
+ \else\ifx\ \tokenafterxref ,% @SPACE
+ \else\ifx\
+ \tokenafterxref ,% @NL
+ \else\ifx\tie\tokenafterxref ,% @tie
+ \fi\fi\fi\fi\fi\fi
+ \fi
\fi\fi
\fi
\endlink
@@ -9206,9 +9055,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi\fi\fi
}
-% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
-% is output afterwards if non-empty.
-\def\refx#1#2{%
+% \refx{NAME} - reference a cross-reference string named NAME.
+\def\refx#1{%
\requireauxfile
{%
\indexnofonts
@@ -9235,7 +9083,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% It's defined, so just use it.
\thisrefX
\fi
- #2% Output the suffix in any case.
}
% This is the macro invoked by entries in the aux file. Define a control
@@ -9345,10 +9192,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\catcode`\[=\other
\catcode`\]=\other
\catcode`\"=\other
- \catcode`\_=\other
- \catcode`\|=\other
- \catcode`\<=\other
- \catcode`\>=\other
+ \catcode`\_=\active
+ \catcode`\|=\active
+ \catcode`\<=\active
+ \catcode`\>=\active
\catcode`\$=\other
\catcode`\#=\other
\catcode`\&=\other
@@ -9569,7 +9416,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
\catcode`\^^M = 5 % in case we're inside an example
\normalturnoffactive % allow _ et al. in names
- \def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
+ \makevalueexpandable
% If the image is by itself, center it.
\ifvmode
\imagevmodetrue
@@ -9595,7 +9442,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% On the other hand, if we are in the case of @center @image, we don't
% want to start a paragraph, which will create a hsize-width box and
% eradicate the centering.
- \ifx\centersub\centerV\else \noindent \fi
+ \ifx\centersub\centerV \else \imageindent \fi
%
% Output the image.
\ifpdf
@@ -11622,7 +11469,7 @@ directory should work if nowhere else does.}
\let> = \activegtr
\let~ = \activetilde
\let^ = \activehat
- \markupsetuplqdefault \markupsetuprqdefault
+ \setregularquotes
\let\b = \strong
\let\i = \smartitalic
% in principle, all other definitions in \tex have to be undone too.
@@ -11681,8 +11528,7 @@ directory should work if nowhere else does.}
@let|=@normalverticalbar
@let~=@normaltilde
@let\=@ttbackslash
- @markupsetuplqdefault
- @markupsetuprqdefault
+ @setregularquotes
@unsepspaces
}
}
@@ -11775,8 +11621,7 @@ directory should work if nowhere else does.}
@c Do this last of all since we use ` in the previous @catcode assignments.
@catcode`@'=@active
@catcode`@`=@active
-@markupsetuplqdefault
-@markupsetuprqdefault
+@setregularquotes
@c Local variables:
@c eval: (add-hook 'before-save-hook 'time-stamp)
@@ -11789,3 +11634,4 @@ directory should work if nowhere else does.}
@c vim:sw=2:
@enablebackslashhack
+
diff --git a/doc/wordlist b/doc/wordlist
index 4acb7656..2aa56fcb 100644
--- a/doc/wordlist
+++ b/doc/wordlist
@@ -324,6 +324,7 @@ NR
NT
NUMCUR
NaN
+NaNs
Nachum
Neacsu
Neacsu's
diff --git a/eval.c b/eval.c
index 9e644523..c1d544c6 100644
--- a/eval.c
+++ b/eval.c
@@ -25,10 +25,8 @@
*/
#include "awk.h"
+#include <math.h>
-extern double pow(double x, double y);
-extern double modf(double x, double *yp);
-extern double fmod(double x, double y);
NODE **fcall_list = NULL;
long fcall_count = 0;
int currule = 0;
@@ -444,6 +442,7 @@ flags2str(int flagval)
{ NUMCUR, "NUMCUR" },
{ NUMBER, "NUMBER" },
{ USER_INPUT, "USER_INPUT" },
+ { BOOL, "BOOL" },
{ INTLSTR, "INTLSTR" },
{ NUMINT, "NUMINT" },
{ INTIND, "INTIND" },
@@ -1521,18 +1520,17 @@ eval_condition(NODE *t)
return boolval(t);
}
-typedef enum {
- SCALAR_EQ_NEQ,
- SCALAR_RELATIONAL
-} scalar_cmp_t;
+static bool cmp_doubles(const NODE *t1, const NODE *t2, scalar_cmp_t comparison_type);
+extern bool mpg_cmp_as_numbers(const NODE *t1, const NODE *t2, scalar_cmp_t comparison_type);
/* cmp_scalars -- compare two nodes on the stack */
-static inline int
+static bool
cmp_scalars(scalar_cmp_t comparison_type)
{
NODE *t1, *t2;
int di;
+ bool ret;
t2 = POP_SCALAR();
t1 = TOP();
@@ -1540,12 +1538,91 @@ cmp_scalars(scalar_cmp_t comparison_type)
DEREF(t2);
fatal(_("attempt to use array `%s' in a scalar context"), array_vname(t1));
}
- di = cmp_nodes(t1, t2, comparison_type == SCALAR_EQ_NEQ);
+
+ if ((t1->flags & STRING) != 0 || (t2->flags & STRING) != 0) {
+ bool use_strcmp = (comparison_type == SCALAR_EQ || comparison_type == SCALAR_NEQ);
+ di = cmp_nodes(t1, t2, use_strcmp);
+
+ switch (comparison_type) {
+ case SCALAR_EQ:
+ ret = (di == 0);
+ break;
+ case SCALAR_NEQ:
+ ret = (di != 0);
+ break;
+ case SCALAR_LT:
+ ret = (di < 0);
+ break;
+ case SCALAR_LE:
+ ret = (di <= 0);
+ break;
+ case SCALAR_GT:
+ ret = (di > 0);
+ break;
+ case SCALAR_GE:
+ ret = (di >= 0);
+ break;
+ }
+ } else {
+ fixtype(t1);
+ fixtype(t2);
+
+#ifdef HAVE_MPFR
+ if (do_mpfr)
+ ret = mpg_cmp_as_numbers(t1, t2, comparison_type);
+ else
+#endif
+ ret = cmp_doubles(t1, t2, comparison_type);
+ }
+
DEREF(t1);
DEREF(t2);
- return di;
+ return ret;
}
+
+/* cmp_doubles --- compare two doubles */
+
+static bool
+cmp_doubles(const NODE *t1, const NODE *t2, scalar_cmp_t comparison_type)
+{
+ /*
+ * This routine provides numeric comparisons that should work
+ * the same as in C. It should NOT be used for sorting.
+ */
+
+ bool t1_nan = isnan(t1->numbr);
+ bool t2_nan = isnan(t2->numbr);
+ int ret;
+
+ if ((t1_nan || t2_nan) && comparison_type != SCALAR_NEQ)
+ return false;
+
+ switch (comparison_type) {
+ case SCALAR_EQ:
+ ret = (t1->numbr == t2->numbr);
+ break;
+ case SCALAR_NEQ:
+ ret = (t1->numbr != t2->numbr);
+ break;
+ case SCALAR_LT:
+ ret = (t1->numbr < t2->numbr);
+ break;
+ case SCALAR_LE:
+ ret = (t1->numbr <= t2->numbr);
+ break;
+ case SCALAR_GT:
+ ret = (t1->numbr > t2->numbr);
+ break;
+ case SCALAR_GE:
+ ret = (t1->numbr >= t2->numbr);
+ break;
+ }
+
+ return ret;
+}
+
+
/* op_assign --- assignment operators excluding = */
static void
diff --git a/extension/CMakeLists.txt b/extension/CMakeLists.txt
deleted file mode 100644
index 1bb4ceb1..00000000
--- a/extension/CMakeLists.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-#
-# extension/CMakeLists.txt --- CMake input file for gawk
-#
-# Copyright (C) 2013
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-# Remove the definition of GAWK because of gawkapi.h.
-remove_definitions(-DGAWK)
-
-MACRO(BuildExtension name sources)
- add_library (${name} MODULE ${sources} ${ARGN})
- target_link_libraries(${name} ${EXTRA_LIBS})
- set_target_properties(${name} PROPERTIES PREFIX "")
- install(PROGRAMS ${CMAKE_BINARY_DIR}/extension/${name}${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION lib)
-ENDMACRO(BuildExtension)
-
-if (${HAVE_STRUCT_STAT_ST_BLKSIZE})
- BuildExtension(filefuncs filefuncs.c stack.c gawkfts.c)
-else()
- message(STATUS "extension filefuncs cannot be built because HAVE_STRUCT_STAT_ST_BLKSIZE is missing")
-endif()
-
-if (HAVE_FNMATCH AND HAVE_FNMATCH_H)
- BuildExtension(fnmatch fnmatch.c)
-else()
- message(STATUS "extension fnmatch cannot be built because function fnmatch or fnmatch.h is missing")
-endif()
-
-if (${HAVE_SYS_WAIT_H})
- BuildExtension(fork fork.c)
-else()
- message(STATUS "extension fork cannot be built because HAVE_SYS_WAIT_H is missing")
-endif()
-
-if (${HAVE_MKSTEMP})
- BuildExtension(inplace inplace.c)
-else()
- message(STATUS "extension inplace cannot be built because HAVE_MKSTEMP is missing")
-endif()
-
-BuildExtension(ordchr ordchr.c)
-
-if (HAVE_DIRENT_H AND HAVE_DIRFD)
- BuildExtension(readdir readdir.c)
-else()
- message(STATUS "extension readdir cannot be built because function readdir is missing")
-endif()
-
-BuildExtension(readfile readfile.c)
-
-BuildExtension(revoutput revoutput.c)
-
-if (${HAVE_GETDTABLESIZE})
- BuildExtension(revtwoway revtwoway.c)
-else()
- message(STATUS "extension revtwoway cannot be built because function getdtablesize is missing")
-endif()
-
-BuildExtension(rwarray rwarray.c)
-
-BuildExtension(time time.c)
-
-BuildExtension(testext testext.c)
-
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 094f6824..ee4ff404 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -29,15 +29,28 @@
2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+ * CMakeLists.txt: Removed.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
Get `make distcheck' working again:
* Makefile.am (EXTRA_DIST): Remove files that are now in build-aux.
* aclocal.m4: Regenerated.
+2021-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * rwarray.c (write_value): Add support for writing boolean values.
+ (read_value): Ditto.
+
2021-03-29 Arnold D. Robbins <arnold@skeeve.com>
* testext.c (var_test): Fix a comment. Update copyright year.
+2021-03-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * testext.c (valrep2str): Add support for AWK_BOOL.
+
2020-07-26 Arnold D. Robbins <arnold@skeeve.com>
* intdiv.c (do_intdiv): Change quotient and remainder to
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 45f9c734..a534a5a4 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -8,7 +8,7 @@
*/
/*
- * Copyright (C) 2009-2014, 2017, 2018, 2020 the Free Software Foundation, Inc.
+ * Copyright (C) 2009-2014, 2017, 2018, 2020, 2021 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -36,6 +36,7 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -249,6 +250,9 @@ write_value(FILE *fp, awk_value_t *val)
case AWK_UNDEFINED:
code = htonl(5);
break;
+ case AWK_BOOL:
+ code = htonl(6);
+ break;
default:
/* XXX can this happen? */
code = htonl(0);
@@ -258,13 +262,25 @@ write_value(FILE *fp, awk_value_t *val)
if (fwrite(& code, 1, sizeof(code), fp) != sizeof(code))
return awk_false;
- len = htonl(val->str_value.len);
- if (fwrite(& len, 1, sizeof(len), fp) != sizeof(len))
- return awk_false;
+ if (code == ntohl(6)) {
+ len = (val->bool_value == awk_true ? 4 : 5);
+ len = htonl(len);
+ const char *s = (val->bool_value == awk_true ? "TRUE" : "FALSE");
- if (fwrite(val->str_value.str, 1, val->str_value.len, fp)
- != (ssize_t) val->str_value.len)
- return awk_false;
+ if (fwrite(& len, 1, sizeof(len), fp) != sizeof(len))
+ return awk_false;
+
+ if (fwrite(s, 1, strlen(s), fp) != (ssize_t) strlen(s))
+ return awk_false;
+ } else {
+ len = htonl(val->str_value.len);
+ if (fwrite(& len, 1, sizeof(len), fp) != sizeof(len))
+ return awk_false;
+
+ if (fwrite(val->str_value.str, 1, val->str_value.len, fp)
+ != (ssize_t) val->str_value.len)
+ return awk_false;
+ }
}
return awk_true;
@@ -484,6 +500,9 @@ read_value(FILE *fp, awk_value_t *value)
case 5:
value->val_type = AWK_UNDEFINED;
break;
+ case 6:
+ value->val_type = AWK_BOOL;
+ break;
default:
/* this cannot happen! */
warning(ext_id, _("treating recovered value with unknown type code %d as a string"), code);
@@ -498,6 +517,13 @@ read_value(FILE *fp, awk_value_t *value)
return awk_false;
}
value->str_value.str[len] = '\0';
+ value->str_value.len = len;
+ if (code == 6) {
+ /* bool type */
+ bool val = (strcmp(value->str_value.str, "TRUE") == 0);
+ gawk_free(value->str_value.str);
+ value->bool_value = val ? awk_true : awk_false;
+ }
}
return awk_true;
diff --git a/extension/testext.c b/extension/testext.c
index a5bef7ae..bfaa8637 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -88,6 +88,13 @@ valrep2str(const awk_value_t *value)
size,
value->str_value.str);
break;
+ case AWK_BOOL:
+ if (value->str_value.len + 8 < size)
+ size = value->str_value.len;
+ sprintf(buf, "<bool>: %.*s",
+ size,
+ value->str_value.str);
+ break;
case AWK_NUMBER:
sprintf(buf, "%g", value->num_value);
break;
diff --git a/gawkapi.c b/gawkapi.c
index a60549dd..cdae4d55 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -160,6 +160,9 @@ awk_value_to_node(const awk_value_t *retval)
case AWK_UNDEFINED:
ext_ret_val = dupnode(Nnull_string);
break;
+ case AWK_BOOL:
+ ext_ret_val = make_bool_node(retval->bool_value != awk_false);
+ break;
case AWK_NUMBER:
switch (retval->num_type) {
case AWK_NUMBER_TYPE_DOUBLE:
@@ -532,6 +535,16 @@ assign_regex(NODE *node, awk_value_t *val)
val->val_type = AWK_REGEX;
}
+/* assign_bool --- return a bool node */
+
+static inline void
+assign_bool(NODE *node, awk_value_t *val)
+{
+ assert((node->flags & BOOL) != 0);
+ val->val_type = AWK_BOOL;
+ val->bool_value = get_number_si(node) != 0 ? awk_true : awk_false;
+}
+
/* node_to_awk_value --- convert a node into a value for an extension */
static awk_bool_t
@@ -567,8 +580,16 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
case Node_val:
/* a scalar value */
switch (wanted) {
+ case AWK_BOOL:
+ if ((node->flags & BOOL) != 0) {
+ assign_bool(node, val);
+ ret = awk_true;
+ } else
+ ret = awk_false;
+ break;
+
case AWK_NUMBER:
- if (node->flags & REGEX)
+ if ((node->flags & REGEX) != 0)
val->val_type = AWK_REGEX;
else {
(void) force_number(node);
@@ -578,7 +599,10 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
break;
case AWK_STRNUM:
- switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case NUMBER|BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case STRING:
val->val_type = AWK_STRING;
break;
@@ -612,10 +636,13 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
break;
case AWK_REGEX:
- switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
case STRING:
val->val_type = AWK_STRING;
break;
+ case NUMBER|BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case NUMBER:
val->val_type = AWK_NUMBER;
break;
@@ -640,7 +667,10 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
break;
case AWK_SCALAR:
- switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case NUMBER|BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case STRING:
val->val_type = AWK_STRING;
break;
@@ -668,7 +698,11 @@ node_to_awk_value(NODE *node, awk_value_t *val, awk_valtype_t wanted)
case AWK_UNDEFINED:
/* return true and actual type for request of undefined */
- switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags & (STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case NUMBER|BOOL:
+ assign_bool(node, val);
+ ret = awk_true;
+ break;
case STRING:
assign_string(node, val, AWK_STRING);
ret = awk_true;
diff --git a/gawkapi.h b/gawkapi.h
index 7eccc70a..69dd843f 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -298,7 +298,7 @@ typedef struct awk_two_way_processor {
} awk_two_way_processor_t;
#define gawk_api_major_version 3
-#define gawk_api_minor_version 1
+#define gawk_api_minor_version 2
/* Current version of the API. */
enum {
@@ -367,7 +367,8 @@ typedef enum {
AWK_STRNUM,
AWK_ARRAY,
AWK_SCALAR, /* opaque access to a variable */
- AWK_VALUE_COOKIE /* for updating a previously created value */
+ AWK_VALUE_COOKIE, /* for updating a previously created value */
+ AWK_BOOL
} awk_valtype_t;
/*
@@ -382,6 +383,7 @@ typedef struct awk_value {
awk_array_t a;
awk_scalar_t scl;
awk_value_cookie_t vc;
+ awk_bool_t b;
} u;
#define str_value u.s
#define strnum_value str_value
@@ -392,6 +394,7 @@ typedef struct awk_value {
#define array_cookie u.a
#define scalar_cookie u.scl
#define value_cookie u.vc
+#define bool_value u.b
} awk_value_t;
/*
@@ -566,28 +569,30 @@ typedef struct gawk_api {
Table entry is type returned:
- +-------------------------------------------------------+
- | Type of Actual Value: |
- +--------+--------+--------+--------+-------+-----------+
- | String | Strnum | Number | Regex | Array | Undefined |
- +-----------+-----------+--------+--------+--------+--------+-------+-----------+
- | | String | String | String | String | String | false | false |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | | Strnum | false | Strnum | Strnum | false | false | false |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | | Number | Number | Number | Number | false | false | false |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | | Regex | false | false | false | Regex | false | false |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | Type | Array | false | false | false | false | Array | false |
- | Requested +-----------+--------+--------+--------+--------+-------+-----------+
- | | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | | Undefined | String | Strnum | Number | Regex | Array | Undefined |
- | +-----------+--------+--------+--------+--------+-------+-----------+
- | | Value | false | false | false | false | false | false |
- | | Cookie | | | | | | |
- +-----------+-----------+--------+--------+--------+--------+-------+-----------+
+ +----------------------------------------------------------------+
+ | Type of Actual Value: |
+ +--------+--------+--------+--------+--------+-------+-----------+
+ | String | Strnum | Number | Regex | Bool | Array | Undefined |
+ +-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | String | String | String | String | String | String | false | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Strnum | false | Strnum | Strnum | false | false | false | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Number | Number | Number | Number | false | Number | false | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Regex | false | false | false | Regex | false | false | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | Type | Bool | false | false | false | false | Bool | false | false |
+ | Requested +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Array | false | false | false | false | false | Array | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Scalar | Scalar | Scalar | Scalar | Scalar | Scalar | false | false |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Undefined | String | Strnum | Number | Regex | Bool | Array | Undefined |
+ | +-----------+--------+--------+--------+--------+--------+-------+-----------+
+ | | Value | false | false | false | false | false | false | false |
+ | | Cookie | | | | | | | |
+ +-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
*/
/* Functions to handle parameters passed to the extension. */
@@ -1070,6 +1075,16 @@ make_number_mpfr(void *mpfr_ptr, awk_value_t *result)
return result;
}
+/* make_bool --- make a bool value in result */
+
+static inline awk_value_t *
+make_bool(awk_bool_t boolval, awk_value_t *result)
+{
+ result->val_type = AWK_BOOL;
+ result->bool_value = boolval;
+ return result;
+}
+
/*
* Each extension must define a function with this prototype:
diff --git a/interpret.h b/interpret.h
index d52d537e..df70bd09 100644
--- a/interpret.h
+++ b/interpret.h
@@ -493,37 +493,37 @@ uninitialized_scalar:
break;
case Op_equal:
- r = node_Boolean[cmp_scalars(SCALAR_EQ_NEQ) == 0];
+ r = node_Boolean[cmp_scalars(SCALAR_EQ)];
UPREF(r);
REPLACE(r);
break;
case Op_notequal:
- r = node_Boolean[cmp_scalars(SCALAR_EQ_NEQ) != 0];
+ r = node_Boolean[cmp_scalars(SCALAR_NEQ)];
UPREF(r);
REPLACE(r);
break;
case Op_less:
- r = node_Boolean[cmp_scalars(SCALAR_RELATIONAL) < 0];
+ r = node_Boolean[cmp_scalars(SCALAR_LT)];
UPREF(r);
REPLACE(r);
break;
case Op_greater:
- r = node_Boolean[cmp_scalars(SCALAR_RELATIONAL) > 0];
+ r = node_Boolean[cmp_scalars(SCALAR_GT)];
UPREF(r);
REPLACE(r);
break;
case Op_leq:
- r = node_Boolean[cmp_scalars(SCALAR_RELATIONAL) <= 0];
+ r = node_Boolean[cmp_scalars(SCALAR_LE)];
UPREF(r);
REPLACE(r);
break;
case Op_geq:
- r = node_Boolean[cmp_scalars(SCALAR_RELATIONAL) >= 0];
+ r = node_Boolean[cmp_scalars(SCALAR_GE)];
UPREF(r);
REPLACE(r);
break;
diff --git a/main.c b/main.c
index 288833ae..fae3b3a9 100644
--- a/main.c
+++ b/main.c
@@ -980,7 +980,6 @@ load_procinfo_argv()
// hook it into PROCINFO
sub = make_string("argv", 4);
assoc_set(PROCINFO_node, sub, argv_array);
-
}
/* load_procinfo --- populate the PROCINFO array */
diff --git a/mpfr.c b/mpfr.c
index 4010d0c1..829f1f34 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -476,6 +476,53 @@ mpg_cmp(const NODE *t1, const NODE *t2)
return cmp_awknums(t1, t2);
}
+/* mpg_cmp_as_numbers --- compare two numbers, similar to doubles */
+
+bool
+mpg_cmp_as_numbers(const NODE *t1, const NODE *t2, scalar_cmp_t comparison_type)
+{
+ /*
+ * This routine provides numeric comparisons that should work
+ * the same as in C. It should NOT be used for sorting.
+ */
+
+ bool t1_nan = mpfr_nan_p(t1->mpg_numbr);
+ bool t2_nan = mpfr_nan_p(t2->mpg_numbr);
+ bool ret = false;
+
+ // MPFR is different than native doubles...
+ if (t1_nan || t2_nan)
+ return comparison_type == SCALAR_NEQ;
+
+ int di = mpg_cmp(t1, t2);
+
+ switch (comparison_type) {
+ case SCALAR_EQ:
+ ret = (di == 0);
+ break;
+ case SCALAR_NEQ:
+ ret = (di != 0);
+ break;
+ case SCALAR_LT:
+ ret = (di < 0);
+ break;
+ case SCALAR_LE:
+ ret = (di <= 0);
+ break;
+ case SCALAR_GT:
+ ret = (di > 0);
+ break;
+ case SCALAR_GE:
+ ret = (di >= 0);
+ break;
+ default:
+ cant_happen();
+ break;
+ }
+
+ return ret;
+}
+
/*
* mpg_update_var --- update NR or FNR.
diff --git a/node.c b/node.c
index 12d7a046..cbf5c56e 100644
--- a/node.c
+++ b/node.c
@@ -370,7 +370,7 @@ int
cmp_awknums(const NODE *t1, const NODE *t2)
{
/*
- * This routine is also used to sort numeric array indices or values.
+ * This routine is used to sort numeric array indices or values.
* For the purposes of sorting, NaN is considered greater than
* any other value, and all NaN values are considered equivalent and equal.
* This isn't in compliance with IEEE standard, but compliance w.r.t. NaN
@@ -390,7 +390,6 @@ cmp_awknums(const NODE *t1, const NODE *t2)
return 1;
}
-
/* make_str_node --- make a string node */
NODE *
@@ -1083,3 +1082,24 @@ more_blocks(int id)
}
#endif
+
+/* make_bool_node --- make a boolean-valued node */
+
+extern NODE *
+make_bool_node(bool value)
+{
+ NODE *val;
+ const char *sval;
+ AWKNUM nval;
+
+ sval = (value ? "1" : "0");
+ nval = (value ? 1.0 : 0.0);
+
+ val = make_number(nval);
+ val->stptr = estrdup(sval, strlen(sval));
+ val->stlen = strlen(sval);
+ val->flags |= NUMCUR|STRCUR|BOOL;
+ val->stfmt = STFMT_UNUSED;
+
+ return val;
+}
diff --git a/pc/ChangeLog b/pc/ChangeLog
index cfe6ab73..894dea38 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -49,6 +49,10 @@
* Makefile.tst: Rebuilt.
* config.h: Rebuilt.
+2021-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.tst: Rebuilt.
+
2021-02-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.tst: Rebuilt.
diff --git a/pc/Makefile.tst b/pc/Makefile.tst
index 34e8e39b..37183624 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -190,7 +190,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
- arraytype \
+ arraytype asortbool \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 commas crlf \
@@ -2585,6 +2585,11 @@ arraytype:
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \
else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi
+asortbool:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@echo Expect $@ to fail with DJGPP.
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
deleted file mode 100644
index cd930077..00000000
--- a/po/CMakeLists.txt
+++ /dev/null
@@ -1,133 +0,0 @@
-# Most of this copied from the repository of Stellarium
-# http://sourceforge.net/projects/stellarium/
-
-# Special targets for translations:
-#
-# translations
-# Converts all PO files to GMO files. Note that it does *not* update
-# the PO files or the PO templates -- in fact, these files are never
-# updated automatically.
-#
-# generate-pot
-# Re-creates all POT files unconditionally.
-#
-# update-po
-# Updates all PO files unconditionally. Note that it takes care of
-# updating the POT files.
-#
-# translations-<DOMAIN>
-# generate-pot-<DOMAIN>
-# update-po-<DOMAIN>
-# Same as above, but only affect the files in the corresponding
-# po/<DOMAIN> directory. (DOMAIN is actually the base name of the POT
-# file in the subdirectory, but that should match the directory name
-# anyway.)
-
-ADD_CUSTOM_TARGET(translations)
-ADD_CUSTOM_TARGET(generate-pot)
-ADD_CUSTOM_TARGET(update-po)
-
-# GETTEXT_CREATE_TRANSLATIONS(domain [DEFAULT_TARGET] lang1 ... langN)
-#
-# Creates custom build rules to create and install (G)MO files for the
-# specified languages. If the DEFAULT_TARGET option is used, the
-# translations will also be created when building the default target.
-#
-# "domain" is the translation domain, eg. "gawk". A POT file
-# with the name ${domain}.pot must exist in the directory of the
-# CMakeLists.txt file invoking the macro.
-#
-# This macro also creates the "translations-${domain}" and
-# "update-po-${domain}" targets (see above for an explanation).
-#
-MACRO(GETTEXT_CREATE_TRANSLATIONS _domain _firstLang)
-
- SET(_gmoFiles)
- GET_FILENAME_COMPONENT(_absPotFile ${_domain}.pot ABSOLUTE)
-
- # Update these PO files when building the "update-po-<DOMAIN>" and
- # "update-po" targets.
- ADD_CUSTOM_TARGET(update-po-${_domain})
- ADD_DEPENDENCIES(update-po update-po-${_domain})
-
- # Make sure the POT file is updated before updating the PO files.
- ADD_DEPENDENCIES(update-po-${_domain} generate-pot-${_domain})
-
- SET(_addToAll)
- IF(${_firstLang} STREQUAL "DEFAULT_TARGET")
- SET(_addToAll "ALL")
- SET(_firstLang)
- ENDIF(${_firstLang} STREQUAL "DEFAULT_TARGET")
-
- FOREACH (_lang ${ARGN})
- GET_FILENAME_COMPONENT(_absFile ${_lang}.po ABSOLUTE)
- FILE(RELATIVE_PATH _relFile ${PROJECT_SOURCE_DIR} ${_absFile})
- SET(_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo)
-
- # Convert a PO file into a GMO file.
- ADD_CUSTOM_COMMAND(
- OUTPUT ${_gmoFile}
- COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_absFile}
- DEPENDS ${_absFile}
- )
-
- # Update the PO file unconditionally when building the
- # "update-po-<DOMAIN>" target. Note that to see the file being
- # processed, we have to run "cmake -E echo", because the
- # COMMENT is not displayed by cmake...
- ADD_CUSTOM_COMMAND(
- TARGET update-po-${_domain}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E echo "** Updating ${_relFile}"
- COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE}
- --quiet --update -m --backup=none -s
- ${_absFile} ${_absPotFile}
- VERBATIM
- )
-
- INSTALL(FILES ${_gmoFile} DESTINATION share/locale/${_lang}/LC_MESSAGES RENAME ${_domain}.mo)
- SET(_gmoFiles ${_gmoFiles} ${_gmoFile})
-
- ENDFOREACH (_lang)
-
- # Create the GMO files when building the "translations-<DOMAIN>" and
- # "translations" targets.
- ADD_CUSTOM_TARGET(translations-${_domain} ${_addToAll} DEPENDS ${_gmoFiles})
- ADD_DEPENDENCIES(translations translations-${_domain})
-
-ENDMACRO(GETTEXT_CREATE_TRANSLATIONS )
-
-SET(gawk_DOMAIN gawk)
-SET(gawk_POT ${gawk_DOMAIN}.pot)
-
-file(READ LINGUAS linguas)
-string(REGEX REPLACE "\n" ";" linguas ${linguas})
-GETTEXT_CREATE_TRANSLATIONS(${gawk_DOMAIN} DEFAULT_TARGET ${linguas})
-
-ADD_CUSTOM_TARGET(
- generate-pot-${gawk_DOMAIN}
- ${GETTEXT_XGETTEXT_EXECUTABLE}
- -o ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT}
- -C
- --keyword=_
- --keyword=N_
- --keyword=q_
- --keyword=translate:2
- --add-comments=TRANSLATORS:
- --directory=${CMAKE_BINARY_DIR}
- --directory=${CMAKE_SOURCE_DIR}
- --output-dir=${CMAKE_BINARY_DIR}
- --files-from=${CMAKE_CURRENT_SOURCE_DIR}/POTFILES.in
- --copyright-holder=FSF
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- COMMENT "Generating ${gawk_POT}"
- VERBATIM
-)
-# TODO: It would be nice to just depend on the exact files in POTFILES.in
-#file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${gawk_POT} UiHeaders)
-#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} UiHeaders)
-#ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} gawk_UIS_H)
-# Make sure the UI headers are created first.
-ADD_DEPENDENCIES(generate-pot-${gawk_DOMAIN} StelGuiLib) # ??? FIXME
-# Generate this POT file when building the "generate-pot" target.
-ADD_DEPENDENCIES(generate-pot generate-pot-${gawk_DOMAIN})
diff --git a/po/ChangeLog b/po/ChangeLog
index 2049632e..90333469 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -14,6 +14,10 @@
* it.po: Updated.
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
+ * CMakeLists.txt: Removed.
+
2021-02-13 Arnold D. Robbins <arnold@skeeve.com>
* bg.po: New translation! (Bulgarian)
diff --git a/po/it.po b/po/it.po
index c9749778..c9749778 100644..100755
--- a/po/it.po
+++ b/po/it.po
diff --git a/str_array.c b/str_array.c
index 84bd2f02..215a52fd 100644
--- a/str_array.c
+++ b/str_array.c
@@ -94,6 +94,7 @@ static void grow_table(NODE *symbol);
static unsigned long gst_hash_string(const char *str, size_t len, unsigned long hsize, size_t *code);
static unsigned long scramble(unsigned long x);
+static unsigned long fnv1a_hash_string(const char *str, size_t len, unsigned long hsize, size_t *code);
static unsigned long awk_hash(const char *s, size_t len, unsigned long hsize, size_t *code);
unsigned long (*hash)(const char *s, size_t len, unsigned long hsize, size_t *code) = awk_hash;
@@ -111,8 +112,13 @@ str_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED)
/* check relevant environment variables */
if ((newval = getenv_long("STR_CHAIN_MAX")) > 0)
STR_CHAIN_MAX = newval;
- if ((val = getenv("AWK_HASH")) != NULL && strcmp(val, "gst") == 0)
- hash = gst_hash_string;
+
+ if ((val = getenv("AWK_HASH")) != NULL) {
+ if (strcmp(val, "gst") == 0)
+ hash = gst_hash_string;
+ else if (strcmp(val, "fnv1a") == 0)
+ hash = fnv1a_hash_string;
+ }
} else
null_array(symbol);
@@ -772,6 +778,34 @@ scramble(unsigned long x)
return x;
}
+/* fnv1a_hash_string --- fnv1a hash function */
+
+/*
+ * FNV-1a hash function
+ * http://www.isthe.com/chongo/tech/comp/fnv/index.html
+ */
+
+static unsigned long
+fnv1a_hash_string(const char *str, size_t len, unsigned long hsize, size_t *code)
+{
+ /* FNV-1a */
+ register unsigned ret = 2166136261U;
+
+ while (len > 0) {
+ ret ^= (unsigned char) (*str++);
+ ret *= 16777619U;
+ len-- ;
+ }
+
+ if (code != NULL)
+ *code = ret;
+
+ if (ret >= hsize)
+ ret %= hsize;
+
+ return ret;
+}
+
/* env_remove --- for ENVIRON, remove value from real environment */
static NODE **
diff --git a/support/CMakeLists.txt b/support/CMakeLists.txt
deleted file mode 100644
index 5e7fd3ad..00000000
--- a/support/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# CMakeLists.txt --- CMake input file for gawk's support library
-#
-# Copyright (C) 2016
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-
-add_definitions(-DGAWK)
-add_definitions(-DHAVE_CONFIG_H)
-add_definitions(-D_GNU_SOURCE)
-add_library (support STATIC
- dfa.c
- getopt1.c
- getopt.c
- localeinfo.c
- random.c
- regex.c
-)
diff --git a/support/ChangeLog b/support/ChangeLog
index 51ff18c9..1930b98c 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -36,6 +36,10 @@
2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+ * CMakeLists.txt: Removed.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
* Makefile.am (EXTRA_DIST): Move some files to ...
(libsupport_a_SOURCES): ... here. Add some more files.
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644
index fee5eeca..00000000
--- a/test/CMakeLists.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# test/CMakeLists.txt --- CMake input file for gawk
-#
-# Copyright (C) 2013
-# the Free Software Foundation, Inc.
-#
-# This file is part of GAWK, the GNU implementation of the
-# AWK Programming Language.
-#
-# GAWK is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# GAWK is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-#
-
-## process this file with CMake to produce Makefile
-
-if(WIN32)
- set(SHELL_PREFIX "C:\\MinGW\\msys\\1.0\\bin\\sh")
-endif()
-
-# Find the names of the groups of tests in Makefile.am.
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ALL_GROUPS)
-string(REGEX MATCHALL "[A-Z_]*_TESTS " ALL_GROUPS "${ALL_GROUPS}")
-string(REGEX REPLACE "_TESTS " ";" ALL_GROUPS "${ALL_GROUPS}")
-# For each group of test cases, search through Makefile.am and find the test cases.
-foreach(testgroup ${ALL_GROUPS} )
- file(READ ${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am ONE_GROUP)
- string(REGEX MATCH "${testgroup}_TESTS = [a-z0-9_ \\\n\t]*" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE "${testgroup}_TESTS = " "" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE "[\\\n\t]" "" ONE_GROUP "${ONE_GROUP}")
- string(REGEX REPLACE " " ";" ONE_GROUP "${ONE_GROUP}")
- # Use each name of a test case to start a script that executes the test case.
- foreach(testcase ${ONE_GROUP} )
- add_test("${testgroup}.${testcase}" ${SHELL_PREFIX} ${CMAKE_SOURCE_DIR}/cmake/basictest ${CMAKE_BINARY_DIR}/gawk${CMAKE_EXECUTABLE_SUFFIX} ${testcase})
- endforeach(testcase)
-endforeach(testgroup)
-
-# Create an empty configuration file for customizing test execution.
-set(CTestCustom ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
-file(WRITE ${CTestCustom} "# DO NOT EDIT, THIS FILE WILL BE OVERWRITTEN\n" )
-# Test case SHLIB.filefuncs needs a file named gawkapi.o in source directory.
-file(APPEND ${CTestCustom} "file(COPY ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_SOURCE_DIR}/gawkapi.o)\n")
-# Exclude test cases from execution that make no sense on a certain platform.
-file(APPEND ${CTestCustom} "set(CTEST_CUSTOM_TESTS_IGNORE\n")
-if(WIN32)
- file(APPEND ${CTestCustom} " BASIC.exitval2\n")
- file(APPEND ${CTestCustom} " BASIC.hsprint\n")
- file(APPEND ${CTestCustom} " BASIC.rstest4\n")
- file(APPEND ${CTestCustom} " BASIC.rstest5\n")
- file(APPEND ${CTestCustom} " UNIX.getlnhd\n")
- file(APPEND ${CTestCustom} " UNIX.pid\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.beginfile1\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.beginfile2\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.clos1way\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd1\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.devfd2\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.getlndir\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.posix\n")
- file(APPEND ${CTestCustom} " GAWK_EXT.pty1\n")
- file(APPEND ${CTestCustom} " INET.inetdayu\n")
- file(APPEND ${CTestCustom} " INET.inetdayt\n")
- file(APPEND ${CTestCustom} " INET.inetechu\n")
- file(APPEND ${CTestCustom} " INET.inetecht\n")
- file(APPEND ${CTestCustom} " MACHINE.double2\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.fmttest\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.lc_num1\n")
- file(APPEND ${CTestCustom} " LOCALE_CHARSET.mbfw1\n")
- file(APPEND ${CTestCustom} " SHLIB.filefuncs\n")
- file(APPEND ${CTestCustom} " SHLIB.fnmatch\n")
- file(APPEND ${CTestCustom} " SHLIB.fork\n")
- file(APPEND ${CTestCustom} " SHLIB.fork2\n")
- file(APPEND ${CTestCustom} " SHLIB.fts\n")
- file(APPEND ${CTestCustom} " SHLIB.functab4\n")
- file(APPEND ${CTestCustom} " SHLIB.readdir\n")
- file(APPEND ${CTestCustom} " SHLIB.revtwoway\n")
- file(APPEND ${CTestCustom} " SHLIB.rwarray\n")
-endif()
-file(APPEND ${CTestCustom} ")\n")
-
diff --git a/test/ChangeLog b/test/ChangeLog
index 553ba2b5..98b5622a 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -78,16 +78,41 @@
2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+ * CMakeLists.txt: Removed.
+
+2021-05-05 Arnold D. Robbins <arnold@skeeve.com>
+
* Makefile.am (iolint): Fix for out-of-tree builds.
(testext): Ditto
* iolint.ok: Updated.
+2021-05-02 Arnold D. Robbins <arnold@skeeve.com>
+
+ * asortbool.awk, functab5.ok, id.ok, rwarrray.awk,
+ symtab11.ok: Revise after code changes.
+
+2021-04-28 Arnold D. Robbins <arnold@skeeve.com>
+
+ * asortbool.ok: Revise after code changes.
+ * rwarray.awk: Ditto.
+
2021-04-14 Arnold D. Robbins <arnold@skeeve.com>
* noeffect.awk: Add more test cases. Thanks to Wolfgang Laun
<wolfgang.laun@gmail.com>.
* lintwarn.ok, noeffect.ok: Updated after code and test changes.
+2021-03-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * Makefile.am (EXTRA_DIST): asortbool, new test.
+ * asortbool.awk, asortbool.ok: New files.
+ * rwarray.awk: Add test of saving/restoring bool values.
+
+2021-03-08 Arnold D. Robbins <arnold@skeeve.com>
+
+ * dumpvars.ok, functab5.ok, id.ok, intest.awk, symtab11.ok,
+ symtab8.ok: Updated after code changes.
+
2021-02-13 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): argcasfile, new test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 7cd73d1d..6ae57c9c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -133,6 +133,8 @@ EXTRA_DIST = \
assignnumfield.ok \
assignnumfield2.awk \
assignnumfield2.ok \
+ asortbool.awk \
+ asortbool.ok \
awkpath.ok \
back89.awk \
back89.in \
@@ -1437,7 +1439,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
- arraytype \
+ arraytype asortbool \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 commas crlf \
diff --git a/test/Makefile.in b/test/Makefile.in
index 1b4ec17c..dbcd8ed1 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -399,6 +399,8 @@ EXTRA_DIST = \
assignnumfield.ok \
assignnumfield2.awk \
assignnumfield2.ok \
+ asortbool.awk \
+ asortbool.ok \
awkpath.ok \
back89.awk \
back89.in \
@@ -1703,7 +1705,7 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort arraysort2 \
- arraytype \
+ arraytype asortbool \
backw badargs beginfile1 beginfile2 binmode1 \
charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 clos1way5 \
clos1way6 commas crlf \
@@ -4273,6 +4275,11 @@ arraytype:
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \
else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi
+asortbool:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 5558ae7f..dbe992a3 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1330,6 +1330,11 @@ arraytype:
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ ; \
else $(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ ; fi
+asortbool:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
backw:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/asortbool.awk b/test/asortbool.awk
new file mode 100644
index 00000000..3ee02cb2
--- /dev/null
+++ b/test/asortbool.awk
@@ -0,0 +1,19 @@
+BEGIN {
+ a[1] = "foo"
+ a[2] = -45
+ a[3] = 45
+ a[4][1] = 47
+ a[5] = mkbool(1)
+ a[6] = mkbool(0)
+
+ asort(a, b, "@val_type_asc")
+
+ j = length(b)
+ for (i = 1; i <= j; i++) {
+ printf("%d, %s: ", i, typeof(b[i]))
+ if (isarray(b[i]))
+ print b[i][1]
+ else
+ print b[i]
+ }
+}
diff --git a/test/asortbool.ok b/test/asortbool.ok
new file mode 100644
index 00000000..623e417a
--- /dev/null
+++ b/test/asortbool.ok
@@ -0,0 +1,6 @@
+1, number: -45
+2, number|bool: 0
+3, number|bool: 1
+4, number: 45
+5, string: foo
+6, array: 47
diff --git a/test/dumpvars.ok b/test/dumpvars.ok
index 85d1c859..7caecd35 100644
--- a/test/dumpvars.ok
+++ b/test/dumpvars.ok
@@ -9,7 +9,7 @@ FILENAME: "-"
FNR: 3
FPAT: "[^[:space:]]+"
FS: " "
-FUNCTAB: array, 41 elements
+FUNCTAB: array, 42 elements
IGNORECASE: 0
LINT: 0
NF: 1
diff --git a/test/functab5.ok b/test/functab5.ok
index 9ac4295d..d27f1393 100644
--- a/test/functab5.ok
+++ b/test/functab5.ok
@@ -21,6 +21,7 @@ length'
log'
lshift'
match'
+mkbool'
mktime'
or'
patsplit'
diff --git a/test/id.ok b/test/id.ok
index ab4df74a..941d5add 100644
--- a/test/id.ok
+++ b/test/id.ok
@@ -52,6 +52,7 @@ length -> builtin
log -> builtin
lshift -> builtin
match -> builtin
+mkbool -> builtin
mktime -> builtin
or -> builtin
patsplit -> builtin
diff --git a/test/intest.awk b/test/intest.awk
index f030d07a..18e0cc4d 100644
--- a/test/intest.awk
+++ b/test/intest.awk
@@ -1,4 +1,4 @@
BEGIN {
- bool = ((b = 1) in c);
- print bool, b # gawk-3.0.1 prints "0 "; should print "0 1"
+ bool_result = ((b = 1) in c);
+ print bool_result, b # gawk-3.0.1 prints "0 "; should print "0 1"
}
diff --git a/test/rwarray.awk b/test/rwarray.awk
index 86a4b589..eae22304 100644
--- a/test/rwarray.awk
+++ b/test/rwarray.awk
@@ -11,6 +11,9 @@ BEGIN {
split("-2.4", f)
dict[strnum_sub] = f[1]
+ bool_sub = "bool-sub"
+ dict[bool_sub] = mkbool(1)
+
n = asorti(dict, dictindices)
for (i = 1; i <= n; i++)
printf("dict[%s] = %s\n", dictindices[i], dict[dictindices[i]]) > "orig.out"
@@ -51,4 +54,12 @@ BEGIN {
if (typeof(dict[strnum_sub]) != "strnum")
printf("dict[\"%s\"] should be strnum, is %s\n",
strnum_sub, typeof(dict[strnum_sub]));
+
+ if (typeof(dict[bool_sub]) != "number|bool")
+ printf("dict[\"%s\"] should be number|bool, is %s\n",
+ bool_sub, typeof(dict[bool_sub]));
+
+ if ((dict[bool_sub] "") != "1")
+ printf("dict[\"%s\"] should be 1, is %s\n",
+ bool_sub, dict[bool_sub]);
}
diff --git a/test/symtab11.ok b/test/symtab11.ok
index 7d4be46c..c46d3aed 100644
--- a/test/symtab11.ok
+++ b/test/symtab11.ok
@@ -53,6 +53,7 @@ BEGIN -- Functab is next
[log] = log
[lshift] = lshift
[match] = match
+[mkbool] = mkbool
[mktime] = mktime
[or] = or
[patsplit] = patsplit
diff --git a/test/symtab8.ok b/test/symtab8.ok
index da29b585..0cf40fe9 100644
--- a/test/symtab8.ok
+++ b/test/symtab8.ok
@@ -9,7 +9,7 @@ FIELDWIDTHS: ""
FNR: 1
FPAT: "[^[:space:]]+"
FS: " "
-FUNCTAB: array, 41 elements
+FUNCTAB: array, 42 elements
IGNORECASE: 0
LINT: 0
NF: 1