aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt109
-rw-r--r--ChangeLog161
-rw-r--r--Makefile.am8
-rw-r--r--Makefile.in137
-rw-r--r--NEWS35
-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-xconfigure24
-rw-r--r--configure.ac7
-rw-r--r--doc/CMakeLists.txt95
-rw-r--r--doc/ChangeLog121
-rw-r--r--doc/Makefile.am23
-rw-r--r--doc/Makefile.in23
-rw-r--r--doc/awkcard.in32
-rw-r--r--doc/gawk.12238
-rw-r--r--doc/gawk.info1592
-rw-r--r--doc/gawk.texi544
-rw-r--r--doc/gawkbug.172
-rw-r--r--doc/gawktexi.in544
-rw-r--r--doc/it/ChangeLog167
-rw-r--r--doc/it/README.txt33
-rw-r--r--doc/it/gawk.12723
-rwxr-xr-x[-rw-r--r--]doc/it/gawktexi.in2636
-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.tex440
-rw-r--r--doc/wordlist25
-rw-r--r--doc/wordlist3106
-rw-r--r--doc/wordlist513
-rw-r--r--eval.c97
-rw-r--r--extension/CMakeLists.txt84
-rw-r--r--extension/ChangeLog100
-rw-r--r--extension/intdiv.c3
-rw-r--r--extension/rwarray.3am39
-rw-r--r--extension/rwarray.c343
-rw-r--r--extension/testext.c113
-rw-r--r--gawkapi.c53
-rw-r--r--gawkapi.h63
-rw-r--r--gawkbug.in277
-rw-r--r--interpret.h12
-rw-r--r--main.c14
-rw-r--r--mpfr.c47
-rw-r--r--node.c24
-rw-r--r--pc/ChangeLog8
-rw-r--r--pc/Makefile.tst135
-rw-r--r--po/CMakeLists.txt133
-rw-r--r--po/ChangeLog8
-rw-r--r--po/it.po1212
-rw-r--r--re.c12
-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/ChangeLog50
-rw-r--r--test/Makefile.am75
-rw-r--r--test/Makefile.in140
-rw-r--r--test/Maketests65
-rw-r--r--test/asortbool.awk19
-rw-r--r--test/asortbool.ok6
-rw-r--r--test/badargs.ok3
-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/nsidentifier.ok1
-rw-r--r--test/readall.ok7
-rw-r--r--test/readall1.awk10
-rw-r--r--test/readall2.awk15
-rw-r--r--test/rwarray.awk11
-rw-r--r--test/symtab11.ok1
-rw-r--r--test/symtab8.ok2
-rw-r--r--test/testext-mpfr.ok2
-rw-r--r--test/testext.ok2
93 files changed, 8432 insertions, 8997 deletions
diff --git a/.gitignore b/.gitignore
index 72445191..72308efe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,7 @@ config.h
config.log
config.status
gawk
+gawkbug
stamp-h1
test/fmtspcl.ok
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 63cce95d..434748d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,24 @@
(do_dcngettext): Require strings for arguments 5, 4, 2, and 1, and
number for argument 3.
+2022-03-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * NEWS: Updated.
+
+2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * main.c (usage): Update the message for the gawkbug program.
+
+2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ Add `gawkbug' reporting program.
+
+ * gawkbug.in: New file.
+ * Makefile.am (bin_SCRIPTS): New, for gawkbug.
+ * configure.ac: Add gawkbug to AC_CONFIG_FILES list.
+ * NEWS: Updated.
+ * .gitignore: Updated.
+
2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
* awk.h (cant_happen): Change to allow a format string and arguments,
@@ -24,6 +42,26 @@
* awkgram.y, debug.c, eval.c, interpret.h, io.c, main.c, mpfr.c,
profile.c, re.c, symbol.c: Fix all uses of cant_happen().
+2022-02-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ Memory issues with MPFR, fix part 2. (Part 1 is in the
+ extension directory.)
+
+ * gawkapi.c (awk_value_to_node): Clear the GMP/MPFR values
+ returned from the C extension after setting the internal
+ variable.
+
+2022-02-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ Enable interval expressions even for --traditional, as BWK
+ awk has supported them since 2019.
+
+ * NEWS: Updated.
+ * main.c (main): Add lint warning for --re-interval.
+ (parse_args): Add explanatory comment.
+ * re.c (resetup): Update the comment w.r.t. interval expressions.
+ Change the test for enabled them to if do_traditional.
+
2022-02-22 Arnold D. Robbins <arnold@skeeve.com>
Fix resource links found by Coverity. Thanks to
@@ -105,6 +143,14 @@
* re.c (reflags2str): Ditto.
* str_array.c (env_array_func): Ditto.
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawkapi.c (api_sym_update): Allow undefined Node_var_new variables
+ to be converted to arrays, otherwise API functions have no way
+ of creating an array that is referenced in an undefined fashion in
+ the program. This is somewhat comparable to how the set_argument
+ API allows an undefined argument variable to be converted to an array.
+
2021-12-02 Andrew J. Schorr <aschorr@telemetry-investments.com>
* builtin.c (efwrite): Don't use return in call of function
@@ -254,6 +300,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.
@@ -325,6 +376,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.
@@ -334,6 +390,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.c (arg_assign): For -v '@/...' make sure that there are
@@ -355,6 +448,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
@@ -477,6 +625,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/Makefile.am b/Makefile.am
index e48f61e9..5e38aac2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,10 +70,11 @@ SUBDIRS += extras doc awklib po test
# what to make and install
bin_PROGRAMS = gawk
+bin_SCRIPTS = gawkbug
include_HEADERS = gawkapi.h
BUILT_SOURCES = $(srcdir)/pc/Makefile.tst
-# sources for both gawk and dgawk
+# sources for gawk
base_sources = \
array.c \
awk.h \
@@ -129,11 +130,14 @@ DEFLIBPATH="\"$(pkgextensiondir)\""
DEFS= -DDEFPATH=$(DEFPATH) -DDEFLIBPATH=$(DEFLIBPATH) -DSHLIBEXT=$(SHLIBEXT) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR='"$(datadir)/locale"' -I"$(srcdir)/support"
# Get rid of core files when cleaning
-CLEANFILES = core core.*
+CLEANFILES = core core.* $(bin_SCRIPTS)
# We want hard links for install-exec-hook, below
LN= ln
+# Make copies...
+CP= cp
+
# For some make's, e.g. OpenBSD, that don't define this
RM = rm -f
diff --git a/Makefile.in b/Makefile.in
index 40f2b043..5c77b9e8 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -38,6 +38,7 @@
#
+
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -139,9 +140,10 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = gawkbug
CONFIG_CLEAN_VPATH_FILES =
-am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(includedir)"
PROGRAMS = $(bin_PROGRAMS)
am__objects_1 = array.$(OBJEXT) awkgram.$(OBJEXT) builtin.$(OBJEXT) \
cint_array.$(OBJEXT) command.$(OBJEXT) debug.$(OBJEXT) \
@@ -158,6 +160,34 @@ am__DEPENDENCIES_1 =
gawk_DEPENDENCIES = support/libsupport.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+SCRIPTS = $(bin_SCRIPTS)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -220,33 +250,6 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
HEADERS = $(include_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
@@ -276,7 +279,8 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
DIST_SUBDIRS = support . extension extras doc awklib po test
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/configh.in \
- $(top_srcdir)/build-aux/ar-lib $(top_srcdir)/build-aux/compile \
+ $(srcdir)/gawkbug.in $(top_srcdir)/build-aux/ar-lib \
+ $(top_srcdir)/build-aux/compile \
$(top_srcdir)/build-aux/config.guess \
$(top_srcdir)/build-aux/config.rpath \
$(top_srcdir)/build-aux/config.sub \
@@ -508,10 +512,11 @@ EXTRA_DIST = \
# Build in awklib after in doc, since we want to extract
# sample files if doc/gawk.texi changed.
SUBDIRS = support . $(am__append_1) extras doc awklib po test
+bin_SCRIPTS = gawkbug
include_HEADERS = gawkapi.h
BUILT_SOURCES = $(srcdir)/pc/Makefile.tst
-# sources for both gawk and dgawk
+# sources for gawk
base_sources = \
array.c \
awk.h \
@@ -563,11 +568,14 @@ SHLIBEXT = "\"$(GAWKLIBEXT)"\"
DEFLIBPATH = "\"$(pkgextensiondir)\""
# Get rid of core files when cleaning
-CLEANFILES = core core.*
+CLEANFILES = core core.* $(bin_SCRIPTS)
# We want hard links for install-exec-hook, below
LN = ln
+# Make copies...
+CP = cp
+
# For some make's, e.g. OpenBSD, that don't define this
RM = rm -f
all: $(BUILT_SOURCES) config.h
@@ -623,6 +631,8 @@ $(srcdir)/configh.in: $(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
+gawkbug: $(top_builddir)/config.status $(srcdir)/gawkbug.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
@@ -669,6 +679,41 @@ clean-binPROGRAMS:
gawk$(EXEEXT): $(gawk_OBJECTS) $(gawk_DEPENDENCIES) $(EXTRA_gawk_DEPENDENCIES)
@rm -f gawk$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(gawk_OBJECTS) $(gawk_LDADD) $(LIBS)
+install-binSCRIPTS: $(bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -1054,10 +1099,10 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) check-local
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(PROGRAMS) $(HEADERS) config.h
+all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
@@ -1148,7 +1193,7 @@ install-dvi: install-dvi-recursive
install-dvi-am:
-install-exec-am: install-binPROGRAMS
+install-exec-am: install-binPROGRAMS install-binSCRIPTS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-recursive
@@ -1213,7 +1258,8 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS
+uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \
+ uninstall-includeHEADERS
.MAKE: $(am__recursive_targets) all check check-am install install-am \
install-exec install-exec-am install-strip
@@ -1227,15 +1273,16 @@ uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS
distclean-generic distclean-hdr distclean-local distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-exec-hook install-html \
- install-html-am install-includeHEADERS install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
- uninstall-am uninstall-binPROGRAMS uninstall-includeHEADERS
+ install-binSCRIPTS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-exec-hook \
+ install-html install-html-am install-includeHEADERS \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-binSCRIPTS uninstall-includeHEADERS
.PRECIOUS: Makefile
diff --git a/NEWS b/NEWS
index b4f3a72d..5946cea6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,42 @@
- Copyright (C) 2019, 2020, 2021 Free Software Foundation, Inc.
+ Copyright (C) 2019, 2020, 2021, 2022 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.
+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.
+
+5. As BWK awk has supported interval expressions since 2019, they are
+now enabled even if --traditional is supplied. The -r/--re-interval option
+remains, but it does nothing.
+
+6. The rwarray extension has two new functions, writeall() and readall(),
+for saving / restoring all of gawk's variables and arrays.
+
+7. The new `gawkbug' script should be used for reporting bugs.
+
+8. The manual page (doc/gawk.1) has been considerably reduced in size.
+Wherever possible, details were replaced with references to the online
+copy of the manual.
+
Changes from 5.1.1 to 5.1.2
---------------------------
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 ca648087..732aec04 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;
@@ -1514,6 +1519,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);
extern void check_exact_args(int nargs, const char *fname, int count);
extern void check_args_min_max(int nargs, const char *fname, int min, int max);
/* debug.c */
@@ -1589,6 +1595,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);
@@ -1719,6 +1734,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 194b49e5..a4aa170d 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -4837,6 +4837,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 072d8adf..6f66fb53 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -2329,6 +2329,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 f92e0cae..0afeb944 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4305,7 +4305,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;
@@ -4492,7 +4495,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
@@ -4537,6 +4540,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 4b1d8a8d..648eabd0 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.1.
+# 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.1'
-PACKAGE_STRING='GNU Awk 5.1.1'
+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.1 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.1:";;
+ 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.1
+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.1, 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.1'
+ VERSION='5.1.60'
printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -13682,6 +13682,8 @@ esac
ac_config_files="$ac_config_files Makefile support/Makefile awklib/Makefile doc/Makefile extras/Makefile po/Makefile.in test/Makefile"
+ac_config_files="$ac_config_files gawkbug"
+
if test "$enable_extensions" = "yes"
then
@@ -14224,7 +14226,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.1, 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 +14296,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.1
+GNU Awk config.status 5.1.60
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
@@ -14439,6 +14441,7 @@ do
"extras/Makefile") CONFIG_FILES="$CONFIG_FILES extras/Makefile" ;;
"po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+ "gawkbug") CONFIG_FILES="$CONFIG_FILES gawkbug" ;;
*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
@@ -15241,6 +15244,7 @@ See \`config.log' for more details" "$LINENO" 5; }
;;
esac
done ;;
+ "gawkbug":F) chmod +x gawkbug ;;
esac
done # for ac_tag
diff --git a/configure.ac b/configure.ac
index 2cb595ca..38197101 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.1],[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.
@@ -475,13 +475,14 @@ dylib) GAWKLIBEXT=so ;; # MacOS uses .dylib for shared libraries, but libtool us
esac
AC_SUBST(GAWKLIBEXT)
-AC_CONFIG_FILES(Makefile
+AC_CONFIG_FILES([Makefile
support/Makefile
awklib/Makefile
doc/Makefile
extras/Makefile
po/Makefile.in
- test/Makefile)
+ test/Makefile])
+AC_CONFIG_FILES([gawkbug], [chmod +x gawkbug])
if test "$enable_extensions" = "yes"
then
AC_CONFIG_SUBDIRS(extension)
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 6e703394..995d6a6d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,13 @@
+2022-03-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.1: Formatting fixes.
+
+2022-03-03 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawk.1: Chopped down in size by about 40%.
+ * wordlist3: Updated for new man page.
+ * wordlist: Updated since it needed it.
+
2022-03-01 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Typo fix. Thanks to Antonio Columbo for pointing
@@ -5,9 +15,34 @@
2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+ * gawktexi.in (Bugs): Updated to describe the gawkbug program.
+ * awkcard.in: Ditto.
+
+2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkbug.1, wordlist5: New files.
+ * Makefile.am: Adjust everything for additional man page.
+
+2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
* gawktexi.in (Array Sorting Functions): Add a note to be careful
to use local variables in comparison functions.
+2022-02-25 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (API Ownership of MPFR and GMP Values): Rework for
+ changes to code.
+
+2022-02-23 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawktexi.in (Extension Sample Read write array): Fix description of
+ readall to say readall instead of writeall.
+
+2022-02-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * awkcard.in: Update --re-interval description.
+ * gawktexi.in: Ditto, in all relevant places.
+
2022-02-07 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Indirect Calls): Expand discussion of calling
@@ -24,6 +59,11 @@
* texinfo.tex: Updated from GNULIB.
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * gawktexi.in: Document new rwarray functions writeall and readall.
+ * wordlist: Add readall and writeall.
+
2021-11-25 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in: Add missing @item for AWKgo. Thanks to Antonio
@@ -205,12 +245,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.
@@ -222,10 +299,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.
@@ -296,12 +389,38 @@
* 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.
+
2020-10-31 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e5d6bf19..fd44ba53 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -27,7 +27,7 @@
info_TEXINFOS = gawk.texi gawkinet.texi gawkworkflow.texi
-man_MANS = gawk.1
+man_MANS = gawk.1 gawkbug.1
EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \
README.card ad.block setter.outline \
@@ -54,7 +54,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \
bc_notes
# Get rid of generated files when cleaning
-CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf gawkworkflow.pdf awkcard.pdf gawk.1.pdf
+CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf gawkworkflow.pdf awkcard.pdf gawk.1.pdf gawkbug.1.pdf
MAKEINFO = @MAKEINFO@ --no-split --force
@@ -80,9 +80,9 @@ AWKCARD = awkcard.ps
gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk
awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi
-postscript: gawk.ps gawkinet.ps gawkworkflow.ps gawk.1.ps $(AWKCARD)
+postscript: gawk.ps gawkinet.ps gawkworkflow.ps gawk.1.ps gawkbug.1.ps $(AWKCARD)
-pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
+pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf gawkbug.1.pdf
gawk.ps: gawk.dvi
TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi
@@ -99,6 +99,12 @@ gawk.1.ps: gawk.1
gawk.1.pdf: gawk.1.ps
ps2pdf gawk.1.ps gawk.1.pdf
+gawkbug.1.ps: gawkbug.1
+ -groff -man $(srcdir)/gawkbug.1 > gawkbug.1.ps
+
+gawkbug.1.pdf: gawkbug.1.ps
+ ps2pdf gawkbug.1.ps gawkbug.1.pdf
+
awkcard.tr: awkcard.in
sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr
@@ -123,11 +129,18 @@ spellworkflow:
export LC_ALL=C ; spell "$(srcdir)"/gawkworkflow.texi | \
sort -u | comm -23 - "$(srcdir)"/wordlist2
-spellmanpage:
+spellmanpage: spellgawkmanpage spellgawkbugmanpage
+
+spellgawkmanpage:
@echo ==== gawk.1 ====
export LC_ALL=C ; spell "$(srcdir)"/gawk.1 | \
sort -u | comm -23 - "$(srcdir)"/wordlist3
+spellgawkbugmanpage:
+ @echo ==== gawkbug.1 ====
+ export LC_ALL=C ; spell "$(srcdir)"/gawkbug.1 | \
+ sort -u | comm -23 - "$(srcdir)"/wordlist5
+
spellinet:
@echo ==== gawkinet.texi ====
export LC_ALL=C ; spell "$(srcdir)"/gawkinet.texi | \
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 2984eb32..aa9f18e7 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -365,7 +365,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
info_TEXINFOS = gawk.texi gawkinet.texi gawkworkflow.texi
-man_MANS = gawk.1
+man_MANS = gawk.1 gawkbug.1
EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \
README.card ad.block setter.outline \
awkcard.in awkforai.txt texinfo.tex cardfonts \
@@ -392,7 +392,7 @@ EXTRA_DIST = ChangeLog ChangeLog.0 ChangeLog.1 \
# Get rid of generated files when cleaning
-CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf gawkworkflow.pdf awkcard.pdf gawk.1.pdf
+CLEANFILES = *.ps *.html *.dvi *~ awkcard.nc awkcard.tr gawk.pdf gawkinet.pdf gawkworkflow.pdf awkcard.pdf gawk.1.pdf gawkbug.1.pdf
TROFF = groff -t -Tps -U
SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \
-e "s/^\/level0 save def/\/level0 save def 30 -48 translate/"
@@ -905,9 +905,9 @@ uninstall-man: uninstall-man1
gawk.texi: $(srcdir)/gawktexi.in $(srcdir)/sidebar.awk
awk -f $(srcdir)/sidebar.awk < $(srcdir)/gawktexi.in > gawk.texi
-postscript: gawk.ps gawkinet.ps gawkworkflow.ps gawk.1.ps $(AWKCARD)
+postscript: gawk.ps gawkinet.ps gawkworkflow.ps gawk.1.ps gawkbug.1.ps $(AWKCARD)
-pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf
+pdf-local: postscript gawk.pdf gawkinet.pdf awkcard.pdf gawk.1.pdf gawkbug.1.pdf
gawk.ps: gawk.dvi
TEXINPUTS=$(srcdir): dvips -o gawk.ps gawk.dvi
@@ -924,6 +924,12 @@ gawk.1.ps: gawk.1
gawk.1.pdf: gawk.1.ps
ps2pdf gawk.1.ps gawk.1.pdf
+gawkbug.1.ps: gawkbug.1
+ -groff -man $(srcdir)/gawkbug.1 > gawkbug.1.ps
+
+gawkbug.1.pdf: gawkbug.1.ps
+ ps2pdf gawkbug.1.ps gawkbug.1.pdf
+
awkcard.tr: awkcard.in
sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr
@@ -948,11 +954,18 @@ spellworkflow:
export LC_ALL=C ; spell "$(srcdir)"/gawkworkflow.texi | \
sort -u | comm -23 - "$(srcdir)"/wordlist2
-spellmanpage:
+spellmanpage: spellgawkmanpage spellgawkbugmanpage
+
+spellgawkmanpage:
@echo ==== gawk.1 ====
export LC_ALL=C ; spell "$(srcdir)"/gawk.1 | \
sort -u | comm -23 - "$(srcdir)"/wordlist3
+spellgawkbugmanpage:
+ @echo ==== gawkbug.1 ====
+ export LC_ALL=C ; spell "$(srcdir)"/gawkbug.1 | \
+ sort -u | comm -23 - "$(srcdir)"/wordlist5
+
spellinet:
@echo ==== gawkinet.texi ====
export LC_ALL=C ; spell "$(srcdir)"/gawkinet.texi | \
diff --git a/doc/awkcard.in b/doc/awkcard.in
index eeda41af..9c1095de 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -204,8 +204,8 @@ T}
.\" --- Bug Reports
.ES
.fi
-\*(CDIf you find a bug in this reference card, please report it via electronic
-mail to \*(FCbug-gawk@gnu.org\*(FR.\*(CX
+\*(CDIf you find a bug in this reference card, please use
+\*(FCgawkbug\*(FR to report it.\*(CX
.EB "\s+2\f(HBBUG REPORTS\*(FR\s0"
.BT
@@ -304,8 +304,7 @@ The profile contains execution counts in the left margin.
.TI "\*(FC\-P\*(FR, \*(FC\-\^\-posix\*(FR
Disable common and GNU extensions.
.TI "\*(FC\-r\*(FR, \*(FC\-\^\-re\-interval\*(FR
-Enable \*(FIinterval expressions\*(FR.
-(Needed with \*(FC\-c\*(FR.)\*(CB
+Does nothing; for backwards compatibility only.\*(CB
.in -4n
.EB "\s+2\f(HBCOMMAND LINE ARGUMENTS (\*(GK\f(HB)\*(FR\s0"
@@ -1916,6 +1915,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 +1971,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 +1978,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
diff --git a/doc/gawk.1 b/doc/gawk.1
index 0d498ab1..ce2681ac 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Jul 05 2021" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "March 1 2022" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -58,37 +58,12 @@ available in the
and
.B ARGV
pre-defined \*(AK variables.
-.PP
-When
-.I gawk
-is invoked with the
-.B \-\^\-profile
-option, it starts gathering profiling statistics
-from the execution of the program.
-.I Gawk
-runs more slowly in this mode, and automatically produces an execution
-profile in the file
-.B awkprof.out
-when done.
-See the
-.B \-\^\-profile
-option, below.
-.PP
-.I Gawk
-also has an integrated debugger. An interactive debugging session can
-be started by supplying the
-.B \-\^\-debug
-option to the command line. In this mode of execution,
-.I gawk
-loads the
-AWK source code and then prompts for debugging commands.
-.I Gawk
-can only debug AWK program source provided with the
-.B \-f
-and
-.B \-\^\-include
-options.
-The debugger is documented in \*(EP.
+.SH PREFACE
+This manual page is intentionally as terse as possible.
+Full details are provided in \*(EP, and you should look
+there for the full story on any specific feature.
+Where possible, links to the online version of the manual
+are provided.
.SH OPTION FORMAT
.I Gawk
options may be either traditional \*(PX-style one letter options,
@@ -119,27 +94,19 @@ Standard options are listed first, followed by options for
.I gawk
extensions, listed alphabetically by short option.
.TP
-.PD 0
-.BI \-f " program-file"
-.TP
-.PD
+.BI \-f " program-file\fR,\fP "\c
.BI \-\^\-file " program-file"
Read the \*(AK program source from the file
.IR program-file ,
instead of from the first command line argument.
Multiple
.B \-f
-(or
-.BR \-\^\-file )
options may be used.
Files read with
.B \-f
are treated as if they begin with an implicit \fB@namespace "awk"\fR statement.
.TP
-.PD 0
-.BI \-F " fs"
-.TP
-.PD
+.BI \-F " fs\fR, \fP"\c
.BI \-\^\-field-separator " fs"
Use
.I fs
@@ -148,11 +115,7 @@ for the input field separator (the value of the
predefined
variable).
.TP
-.PD 0
-\fB\-v\fI var\fB\^=\^\fIval\fR
-.TP
-.PD
-\fB\-\^\-assign \fIvar\fB\^=\^\fIval\fR
+\fB\-v\fI var\fB\^=\^\fIval\fR, \fB\-\^\-assign \fIvar\fB\^=\^\fIval\fR
Assign the value
.I val
to the variable
@@ -162,23 +125,14 @@ Such variable values are available to the
.B BEGIN
rule of an \*(AK program.
.TP
-.PD 0
-.B \-b
-.TP
-.PD
+.BR \-b ", "\c
.B \-\^\-characters\-as\-bytes
-Treat all input data as single-byte characters. In other words,
-don't pay any attention to the locale information when attempting to
-process strings as multibyte characters.
+Treat all input data as single-byte characters.
The
.B \-\^\-posix
option overrides this one.
-.bp
.TP
-.PD 0
-.B \-c
-.TP
-.PD
+.BR \-c ", "\c
.B \-\^\-traditional
Run in
.I compatibility
@@ -187,52 +141,20 @@ mode. In compatibility mode,
behaves identically to Brian Kernighan's
.IR awk ;
none of the \*(GN-specific extensions are recognized.
-.\" The use of
-.\" .B \-\^\-traditional
-.\" is preferred over the other forms of this option.
-See
-.BR "GNU EXTENSIONS" ,
-below, for more information.
-.TP
-.PD 0
-.B \-C
.TP
-.PD
+.BR \-C ", "\c
.B \-\^\-copyright
Print the short version of the \*(GN copyright information message on
the standard output and exit successfully.
.TP
-.PD 0
-\fB\-d\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-dump-variables\fR[\fB=\fIfile\fR]
+\fB\-d\fR[\fIfile\fR], \fB\-\^\-dump-variables\fR[\fB=\fIfile\fR]
Print a sorted list of global variables, their types and final values to
.IR file .
-If no
-.I file
-is provided,
-.I gawk
-uses a file named
+The default file is
.B awkvars.out
in the current directory.
-.sp .5
-Having a list of all the global variables is a good way to look for
-typographical errors in your programs.
-You would also use this option if you have a large program with a lot of
-functions, and you want to be sure that your functions don't
-inadvertently use global variables that you meant to be local.
-(This is a particularly easy mistake to make with simple variable
-names like
-.BR i ,
-.BR j ,
-and so on.)
.TP
-.PD 0
-\fB\-D\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-debug\fR[\fB=\fIfile\fR]
+\fB\-D\fR[\fIfile\fR], \fB\-\^\-debug\fR[\fB=\fIfile\fR]
Enable debugging of \*(AK programs.
By default, the debugger reads commands interactively from the keyboard
(standard input).
@@ -240,31 +162,30 @@ The optional
.I file
argument specifies a file with a list
of commands for the debugger to execute non-interactively.
+.sp .5
+In this mode of execution,
+.I gawk
+loads the
+AWK source code and then prompts for debugging commands.
+.I Gawk
+can only debug AWK program source provided with the
+.B \-f
+and
+.B \-\^\-include
+options.
+The debugger is documented in \*(EP; see
+.IR https://www.gnu.org/software/gawk/manual/html_node/Debugger.html#Debugger .
.TP
-.PD 0
-.BI "\-e " program-text
-.TP
-.PD
+.BI \-e " program-text\fR, \fP"\c
.BI \-\^\-source " program-text"
Use
.I program-text
as \*(AK program source code.
-This option allows the easy intermixing of library functions (used via the
-.B \-f
-and
-.B \-\^\-include
-options) with source code entered on the command line.
-It is intended primarily for medium to large \*(AK programs used
-in shell scripts.
Each argument supplied via
.B \-e
is treated as if it begins with an implicit \fB@namespace "awk"\fR statement.
.TP
-.PD 0
-.BI "\-E " file
-.TP
-.PD
-.BI \-\^\-exec " file"
+\fB\-E \fIfile\fR, \fB\-\^\-exec \fIfile\fR
Similar to
.BR \-f ,
however, this is option is the last one processed.
@@ -275,38 +196,23 @@ passing in options or source code (!) on the command line
from a URL.
This option disables command-line variable assignments.
.TP
-.PD 0
-.B \-g
-.TP
-.PD
+.BR \-g ", "\c
.B \-\^\-gen\-pot
Scan and parse the \*(AK program, and generate a \*(GN
.B \&.pot
(Portable Object Template)
format file on standard output with entries for all localizable
strings in the program. The program itself is not executed.
-See the \*(GN
-.I gettext
-distribution for more information on
-.B \&.pot
-files.
-.TP
-.PD 0
-.B \-h
.TP
-.PD
+.BR \-h ", "\c
.B \-\^\-help
Print a relatively short summary of the available options on
the standard output.
-(Per the
+Per the
.IR "GNU Coding Standards" ,
-these options cause an immediate, successful exit.)
-.TP
-.PD 0
-.BI "\-i " include-file
+these options cause an immediate, successful exit.
.TP
-.PD
-.BI \-\^\-include " include-file"
+\fB\-i \fIinclude-file\fR, \fB\-\^\-include \fIinclude-file\fR
Load an awk source library.
This searches for the library using the
.B AWKPATH
@@ -320,10 +226,7 @@ Files read with
.B \-\^\-include
are treated as if they begin with an implicit \fB@namespace "awk"\fR statement.
.TP
-.PD 0
-.BI \-I
-.TP
-.PD
+.BR \-I ", "\c
.B \-\^\-trace
Print the internal byte code names as they are executed when running
the program. The trace is printed to standard error. Each ``op code''
@@ -331,10 +234,7 @@ is preceded by a
.B +
sign in the output.
.TP
-.PD 0
-.BI "\-l " lib
-.TP
-.PD
+.BI \-l " lib\fR, "\c
.BI \-\^\-load " lib"
Load a
.I gawk
@@ -347,33 +247,15 @@ be made after appending the default shared library suffix for the platform.
The library initialization routine is expected to be named
.BR dl_load() .
.TP
-.PD 0
-.BR "\-L " [ \fIvalue\fR ]
-.TP
-.PD
-.BR \-\^\-lint [ =\fIvalue\fR ]
+\fB\-L \fR[\fIvalue\fR], \fB\-\^\-lint\fR[\fB=\fIvalue\fR]
Provide warnings about constructs that are
dubious or non-portable to other \*(AK implementations.
-With an optional argument of
-.BR fatal ,
-lint warnings become fatal errors.
-This may be drastic, but its use will certainly encourage the
-development of cleaner \*(AK programs.
-With an optional argument of
-.BR invalid ,
-only warnings about things that are
-actually invalid are issued.
-(This is not fully implemented yet.)
-With an optional argument of
-.BR no-ext ,
-warnings about
-.I gawk
-extensions are disabled.
-.TP
-.PD 0
-.B \-M
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Options.html#Options
+for the list of possible values for
+.IR value .
.TP
-.PD
+.BR \-M ", "\c
.B \-\^\-bignum
Force arbitrary precision arithmetic on numbers. This option has
no effect if
@@ -383,158 +265,76 @@ is not compiled to use the GNU MPFR and GMP libraries.
.I gawk
issues a warning.)
.TP
-.PD 0
-.B \-n
-.TP
-.PD
+.BR \-n ", "\c
.B \-\^\-non\-decimal\-data
Recognize octal and hexadecimal values in input data.
.I "Use this option with great caution!"
.TP
-.PD 0
-.B \-N
-.TP
-.PD
+.BR \-N ", "\c
.B \-\^\-use\-lc\-numeric
Force
.I gawk
to use the locale's decimal point character when parsing input data.
-Although the POSIX standard requires this behavior, and
-.I gawk
-does so when
-.B \-\^\-posix
-is in effect, the default is to follow traditional behavior and use a
-period as the decimal point, even in locales where the period is not the
-decimal point character. This option overrides the default behavior,
-without the full draconian strictness of the
-.B \-\^\-posix
-option.
.ig
.\" This option is left undocumented, on purpose.
.TP
-.PD 0
-.B "\-W nostalgia"
-.TP
-.PD
+.BR "\-W nostalgia" ", "\c
.B \-\^\-nostalgia
Provide a moment of nostalgia for long time
.I awk
users.
..
.TP
-.PD 0
-\fB\-o\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-pretty-print\fR[\fB=\fIfile\fR]
+\fB\-o\fR[\fIfile\fR], \fB\-\^\-pretty-print\fR[\fB=\fIfile\fR]
Output a pretty printed version of the program to
.IR file .
-If no
-.I file
-is provided,
-.I gawk
-uses a file named
+The default file is
.B awkprof.out
in the current directory.
This option implies
.BR \-\^\-no\-optimize .
.TP
-.PD 0
-.B \-O
-.TP
-.PD
+.BR \-O ", "\c
.B \-\^\-optimize
Enable
.IR gawk 's
default optimizations upon the internal representation of the program.
-Currently, this just includes simple constant folding.
This option is on by default.
.TP
-.PD 0
-\fB\-p\fR[\fIprof-file\fR]
-.TP
-.PD
-\fB\-\^\-profile\fR[\fB=\fIprof-file\fR]
+\fB\-p\fR[\fIprof-file\fR], \fB\-\^\-profile\fR[\fB=\fIprof-file\fR]
Start a profiling session, and send the profiling data to
.IR prof-file .
The default is
-.BR awkprof.out .
+.B awkprof.out
+in the current directory.
The profile contains execution counts of each statement in the program
in the left margin and function call counts for each user-defined function.
+.I Gawk
+runs more slowly in this mode.
This option implies
.BR \-\^\-no\-optimize .
.TP
-.PD 0
-.B \-P
-.TP
-.PD
+.BR \-P ", "\c
.B \-\^\-posix
This turns on
.I compatibility
-mode, with the following additional restrictions:
-.RS
-.TP "\w'\(bu'u+1n"
-\(bu
-.B \ex
-escape sequences are not recognized.
-.TP
-\(bu
-You cannot continue lines after
-.B ?
-and
-.BR : .
-.TP
-\(bu
-The synonym
-.B func
-for the keyword
-.B function
-is not recognized.
-.TP
-\(bu
-The operators
-.B **
-and
-.B **=
-cannot be used in place of
-.B ^
-and
-.BR ^= .
-.RE
-.TP
-.PD 0
-.B \-r
+mode, and disables a number of common extensions.
.TP
-.PD
+.BR \-r ", "\c
.B \-\^\-re\-interval
Enable the use of
.I "interval expressions"
-in regular expression matching
-(see
-.BR "Regular Expressions" ,
-below).
-Interval expressions were not traditionally available in the
-\*(AK language. The \*(PX standard added them, to make
-.I awk
-and
-.I egrep
-consistent with each other.
-They are enabled by default, but this option remains for use together with
-.BR \-\^\-traditional .
-.TP
-.PD 0
-.B \-s
+in regular expression matching.
+Interval expressions
+are enabled by default, but this option remains for backwards compatibility.
.TP
-.PD
+.BR \-s ", "\c
.B \-\^\-no\-optimize
Disable
.IR gawk 's
default optimizations upon the internal representation of the program.
.TP
-.PD 0
-.B \-S
-.TP
-.PD
+.BR \-S ", "\c
.B \-\^\-sandbox
Run
.I gawk
@@ -546,51 +346,33 @@ output redirection with
.BR print " and " printf ,
and loading dynamic extensions.
Command execution (through pipelines) is also disabled.
-This effectively blocks a script from accessing local resources,
-except for the files specified on the command line.
-.TP
-.PD 0
-.B \-t
.TP
-.PD
+.BR \-t ", "\c
.B \-\^\-lint\-old
Provide warnings about constructs that are
not portable to the original version of \*(UX
.IR awk .
.TP
-.PD 0
-.B \-V
-.TP
-.PD
+.BR \-V ", "\c
.B \-\^\-version
Print version information for this particular copy of
.I gawk
on the standard output.
-This is useful mainly for knowing if the current copy of
-.I gawk
-on your system
-is up to date with respect to whatever the Free Software Foundation
-is distributing.
-This is also useful when reporting bugs.
-(Per the
+This is useful when reporting bugs.
+Per the
.IR "GNU Coding Standards" ,
-these options cause an immediate, successful exit.)
+these options cause an immediate, successful exit.
.TP
.B \-\^\-
Signal the end of options. This is useful to allow further arguments to the
\*(AK program itself to start with a \*(lq\-\*(rq.
-This provides consistency with the argument parsing convention used
-by most other \*(PX programs.
.PP
In compatibility mode,
any other options are flagged as invalid, but are otherwise ignored.
In normal operation, as long as program text has been supplied, unknown
options are passed on to the \*(AK program in the
.B ARGV
-array for processing. This is particularly useful for running \*(AK
-programs via the
-.B #!
-executable interpreter mechanism.
+array for processing.
.PP
For \*(PX compatibility, the
.B \-W
@@ -629,15 +411,12 @@ options may be used multiple times on the command line.
reads the program text as if all the
.IR program-file s
and command line source texts
-had been concatenated together. This is useful for building libraries
-of \*(AK functions, without having to include them in each new \*(AK
-program that uses them. It also provides the ability to mix library
-functions with command line programs.
+had been concatenated together.
.PP
In addition, lines beginning with
.B @include
-may be used to include other source files into your program,
-making library use even easier. This is equivalent
+may be used to include other source files into your program.
+This is equivalent
to using the
.B \-\^\-include
option.
@@ -708,11 +487,6 @@ will be assigned the value
(This happens after any
.B BEGIN
rule(s) have been run.)
-Command line variable assignment
-is most useful for dynamically assigning values to the variables
-\*(AK uses to control how input is broken into fields and records.
-It is also useful for controlling state if multiple passes are needed over
-a single data file.
.PP
If the value of a particular element of
.B ARGV
@@ -731,6 +505,7 @@ before processing the contents of the file. Similarly,
executes
the code associated with
.B ENDFILE
+rules
after processing the file.
.PP
For each record in the input,
@@ -758,7 +533,7 @@ of
.I awk
treat a directory on the command line as a fatal error.
.PP
-Starting with version 4.0 of
+For
.IR gawk ,
a directory on the command line
produces a warning, but is otherwise skipped. If either of the
@@ -779,36 +554,18 @@ Additionally,
allows variables to have regular-expression type.
\*(AK also has one dimensional
arrays; arrays with multiple dimensions may be simulated.
-.I Gawk
-provides true arrays of arrays; see
-.BR Arrays ,
-below.
+However,
+.I gawk
+provides true arrays of arrays.
Several pre-defined variables are set as a program
runs; these are described as needed and summarized below.
.SS Records
Normally, records are separated by newline characters. You can control how
records are separated by assigning values to the built-in variable
.BR RS .
-If
-.B RS
-is any single character, that character separates records.
-Otherwise,
-.B RS
-is a regular expression. Text in the input that matches this
-regular expression separates the record.
-However, in compatibility mode,
-only the first character of its string
-value is used for separating records.
-If
-.B RS
-is set to the null string, then records are separated by
-empty lines.
-When
-.B RS
-is set to the null string, the newline character always acts as
-a field separator, in addition to whatever value
-.B FS
-may have.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Records.html
+for the details.
.SS Fields
As each input record is read,
.I gawk
@@ -817,59 +574,13 @@ splits the record into
using the value of the
.B FS
variable as the field separator.
-If
-.B FS
-is a single character, fields are separated by that character.
-If
-.B FS
-is the null string, then each individual character becomes a
-separate field.
-Otherwise,
-.B FS
-is expected to be a full regular expression.
-In the special case that
-.B FS
-is a single space, fields are separated
-by runs of spaces and/or tabs and/or newlines.
-.BR NOTE :
-The value of
-.B IGNORECASE
-(see below) also affects how fields are split when
-.B FS
-is a regular expression, and how records are separated when
-.B RS
-is a regular expression.
-.PP
-If the
+Additionally,
.B FIELDWIDTHS
-variable is set to a space-separated list of numbers, each field is
-expected to have fixed width, and
-.I gawk
-splits up the record using the specified widths.
-Each field width may optionally be preceded by a colon-separated
-value specifying the number of characters to skip before the field starts.
-The value of
-.B FS
-is ignored.
-Assigning a new value to
-.B FS
-or
-.B FPAT
-overrides the use of
-.BR FIELDWIDTHS .
-.PP
-Similarly, if the
+and
.B FPAT
-variable is set to a string representing a regular expression,
-each field is made up of text that matches that regular expression. In
-this case, the regular expression describes the fields themselves,
-instead of the text that separates the fields.
-Assigning a new value to
-.B FS
-or
-.B FIELDWIDTHS
-overrides the use of
-.BR FPAT .
+may be used to control input field splitting.
+See the details, starting at
+.IR https://www.gnu.org/software/gawk/manual/html_node/Fields.html .
.PP
Each field in the input record may be referenced by its position:
.BR $1 ,
@@ -878,17 +589,6 @@ and so on.
.B $0
is the whole record,
including leading and trailing whitespace.
-Fields need not be referenced by constants:
-.RS
-.PP
-.ft B
-n = 5
-.br
-print $n
-.ft R
-.RE
-.PP
-prints the fifth field in the input record.
.PP
The variable
.B NF
@@ -924,12 +624,12 @@ causes the record to be resplit, creating new
values for the fields.
.SS Built-in Variables
.IR Gawk\^ "'s"
-built-in variables are:
+built-in variables are listed below.
+This list is purposely terse. For details, see
+.IR https://www.gnu.org/software/gawk/manual/html_node/Built_002din-Variables .
.TP "\w'\fBFIELDWIDTHS\fR'u+1n"
.B ARGC
-The number of command line arguments (does not include options to
-.IR gawk ,
-or the program source).
+The number of command line arguments.
.TP
.B ARGIND
The index in
@@ -941,19 +641,12 @@ Array of command line arguments. The array is indexed from
0 to
.B ARGC
\- 1.
-Dynamically changing the contents of
-.B ARGV
-can control the files used for data.
.TP
.B BINMODE
On non-POSIX systems, specifies use of \*(lqbinary\*(rq mode for all file I/O.
-Numeric values of 1, 2, or 3, specify that input files, output files, or
-all files, respectively, should use binary I/O.
-String values of \fB"r"\fR, or \fB"w"\fR specify that input files, or output files,
-respectively, should use binary I/O.
-String values of \fB"rw"\fR or \fB"wr"\fR specify that all files
-should use binary I/O.
-Any other string value is treated as \fB"rw"\fR, but generates a warning message.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/PC-Using.html
+for the details.
.TP
.B CONVFMT
The conversion format for numbers, \fB"%.6g"\fR, by default.
@@ -961,19 +654,7 @@ The conversion format for numbers, \fB"%.6g"\fR, by default.
.B ENVIRON
An array containing the values of the current environment.
The array is indexed by the environment variables, each element being
-the value of that variable (e.g., \fBENVIRON["HOME"]\fP might be
-\fB"/home/arnold"\fR).
-.sp
-In POSIX mode,
-changing this array does not affect the environment seen by programs which
-.I gawk
-spawns via redirection or the
-.B system()
-function.
-Otherwise,
-.I gawk
-updates its real environment so that programs it spawns see
-the changes.
+the value of that variable.
.TP
.B ERRNO
If a system error occurs either doing a redirection for
@@ -987,15 +668,6 @@ then
is set to
a string describing the error.
The value is subject to translation in non-English locales.
-If the string in
-.B ERRNO
-corresponds to a system error in the
-.IR errno (3)
-variable, then the numeric value can be found in
-.B PROCINFO["errno"].
-For non-system errors,
-.B PROCINFO["errno"]
-will be zero.
.TP
.B FIELDWIDTHS
A whitespace-separated list of field widths. When set,
@@ -1006,9 +678,6 @@ value of the
variable as the field separator.
Each field width may optionally be preceded by a colon-separated
value specifying the number of characters to skip before the field starts.
-See
-.BR Fields ,
-above.
.TP
.B FILENAME
The name of the current input file.
@@ -1036,14 +705,12 @@ regular expression, instead of using the
value of
.B FS
as the field separator.
-See
-.BR Fields ,
-above.
.TP
.B FS
-The input field separator, a space by default. See
-.BR Fields ,
-above.
+The input field separator, a space by default.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Field-Separators.html
+for the details.
.TP
.B FUNCTAB
An array whose indices and corresponding values
@@ -1058,66 +725,15 @@ array.
.TP
.B IGNORECASE
Controls the case-sensitivity of all regular expression
-and string operations. If
-.B IGNORECASE
-has a non-zero value, then string comparisons and
-pattern matching in rules,
-field splitting with
-.B FS
-and
-.BR FPAT ,
-record separating with
-.BR RS ,
-regular expression
-matching with
-.B ~
-and
-.BR !~ ,
-and the
-.BR gensub() ,
-.BR gsub() ,
-.BR index() ,
-.BR match() ,
-.BR patsplit() ,
-.BR split() ,
-and
-.B sub()
-built-in functions all ignore case when doing regular expression
-operations.
-.BR NOTE :
-Array subscripting is
-.I not
-affected.
-However, the
-.B asort()
-and
-.B asorti()
-functions are affected.
-.sp .5
-Thus, if
-.B IGNORECASE
-is not equal to zero,
-.B /aB/
-matches all of the strings \fB"ab"\fP, \fB"aB"\fP, \fB"Ab"\fP,
-and \fB"AB"\fP.
-As with all \*(AK variables, the initial value of
-.B IGNORECASE
-is zero, so all regular expression and string
-operations are normally case-sensitive.
+and string operations.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Case_002dsensitivity.html
+for details.
.TP
.B LINT
Provides dynamic control of the
.B \-\^\-lint
option from within an \*(AK program.
-When true,
-.I gawk
-prints lint warnings. When false, it does not.
-The values allowed for the
-.B \-\^\-lint
-option may also be assigned to
-.BR LINT ,
-with the same effects.
-Any other true value just prints warnings.
.TP
.B NF
The number of fields in the current input record.
@@ -1141,283 +757,16 @@ numbers, 53 by default.
.B PROCINFO
The elements of this array provide access to information about the
running \*(AK program.
-On some systems,
-there may be elements in the array, \fB"group1"\fP through
-\fB"group\fIn\fB"\fR for some
-.IR n ,
-which is the number of supplementary groups that the process has.
-Use the
-.B in
-operator to test for these elements.
-The following elements are guaranteed to be available:
-.RS
-.TP \w'\fBPROCINFO["strftime"]\fR'u+1n
-\fBPROCINFO["argv"]\fP
-The command line arguments as received by
-.I gawk
-at the C-language level.
-The subscripts start from zero.
-.TP
-\fBPROCINFO["egid"]\fP
-The value of the
-.IR getegid (2)
-system call.
-.TP
-\fBPROCINFO["errno"]\fP
-The value of
-.IR errno (3)
-when
-.B ERRNO
-is set to the associated error message.
-.TP
-\fBPROCINFO["euid"]\fP
-The value of the
-.IR geteuid (2)
-system call.
-.TP
-\fBPROCINFO["FS"]\fP
-\fB"FS"\fP if field splitting with
-.B FS
-is in effect,
-\fB"FPAT"\fP if field splitting with
-.B FPAT
-is in effect,
-\fB"FIELDWIDTHS"\fP if field splitting with
-.B FIELDWIDTHS
-is in effect,
-or \fB"API"\fP if API input parser field splitting
-is in effect.
-.TP
-\fBPROCINFO["gid"]\fP
-The value of the
-.IR getgid (2)
-system call.
-.TP
-\fBPROCINFO["identifiers"]\fP
-A subarray, indexed by the names of all identifiers used in the
-text of the AWK program.
-The values indicate what
-.I gawk
-knows about the identifiers after it has finished parsing the program; they are
-.I not
-updated while the program runs.
-For each identifier, the value of the element is one of the following:
-.RS
-.TP \w'\fB"extension"\fR'u+1n
-\fB"array"\fR
-The identifier is an array.
-.TP
-\fB"builtin"\fR
-The identifier is a built-in function.
-.TP
-\fB"extension"\fR
-The identifier is an extension function loaded via
-.B @load
-or
-.BR \-\^\-load .
-.TP
-\fB"scalar"\fR
-The identifier is a scalar.
-.TP
-\fB"untyped"\fR
-The identifier is untyped (could be used as a scalar or array,
-.I gawk
-doesn't know yet).
-.TP
-\fB"user"\fR
-The identifier is a user-defined function.
-.RE
-.TP
-\fBPROCINFO["pgrpid"]\fP
-The value of the
-.IR getpgrp (2)
-system call.
-.TP
-\fBPROCINFO["pid"]\fP
-The value of the
-.IR getpid (2)
-system call.
-.TP
-\fBPROCINFO["platform"]\fP
-A string indicating the platform for which
-.I gawk
-was compiled. It is one of:
-.RS
-.TP
-\fB"djgpp"\fR, \fB"mingw"\fR
-Microsoft Windows, using either DJGPP, or MinGW, respectively.
-.TP
-\fB"os2"\fR
-OS/2.
-.TP
-\fB"posix"\fR
-GNU/Linux, Cygwin, Mac OS X, and legacy Unix systems.
-.TP
-\fB"vms"\fR
-OpenVMS or Vax/VMS.
-.RE
-.TP
-\fBPROCINFO["ppid"]\fP
-The value of the
-.IR getppid (2)
-system call.
-.TP
-\fBPROCINFO["strftime"]\fP
-The default time format string for
-.BR strftime() .
-Changing its value affects how
-.B strftime()
-formats time values when called with no arguments.
-.TP
-\fBPROCINFO["uid"]\fP
-The value of the
-.IR getuid (2)
-system call.
-.TP
-\fBPROCINFO["version"]\fP
-The version of
-.IR gawk .
-.PP
-The following elements are present if loading dynamic
-extensions is available:
-.TP
-\fBPROCINFO["api_major"]\fP
-The major version of the extension API.
-.TP
-\fBPROCINFO["api_minor"]\fP
-The minor version of the extension API.
-.PP
-The following elements are available if MPFR support is
-compiled into
-.IR gawk\^ :
-.TP
-\fBPROCINFO["gmp_version"]\fP
-The version of the GNU GMP library used for arbitrary precision
-number support in
-.IR gawk .
-.TP
-\fBPROCINFO["mpfr_version"]\fP
-The version of the GNU MPFR library used for arbitrary precision
-number support in
-.IR gawk .
-.TP
-\fBPROCINFO["prec_max"]\fP
-The maximum precision supported by the GNU MPFR library for
-arbitrary precision floating-point numbers.
-.TP
-\fBPROCINFO["prec_min"]\fP
-The minimum precision allowed by the GNU MPFR library for
-arbitrary precision floating-point numbers.
-.PP
-The following elements may set by a program to
-change
-.IR gawk 's
-behavior:
-.TP
-\fBPROCINFO["NONFATAL"]\fR
-If this exists, then I/O errors for all redirections become nonfatal.
-.TP
-\fBPROCINFO["\fIname\fB", "NONFATAL"]\fR
-Make I/O errors for
-.I name
-be nonfatal.
-.TP
-\fBPROCINFO["\fIcommand\fB", "pty"]\fR
-Use a pseudo-tty for two-way communication with
-.I command
-instead of setting up two one-way pipes.
-.TP
-\fBPROCINFO["\fIinput\fB", "READ_TIMEOUT"]\fR
-The timeout in milliseconds for reading data from
-.IR input ,
-where
-.I input
-is a redirection string or a filename. A value of zero or
-less than zero means no timeout.
-.TP
-\fBPROCINFO["\fIinput\^\fB", "RETRY"]\fR
-If an I/O error that may be retried occurs when reading data from
-.IR input ,
-and this array entry exists, then
-.B getline
-returns \-2 instead of following the default behavior of returning \-1
-and configuring
-.I input
-to return no further data.
-An I/O error that may be retried is one where
-.IR errno (3)
-has the value EAGAIN, EWOULDBLOCK, EINTR, or ETIMEDOUT.
-This may be useful in conjunction with
-\fBPROCINFO["\fIinput\^\fB", "READ_TIMEOUT"]\fR
-or in situations where a file descriptor has been configured to behave in a
-non-blocking fashion.
-.TP
-\fBPROCINFO["sorted_in"]\fP
-If this element exists in
-.BR PROCINFO ,
-then its value controls the order in which array elements
-are traversed in
-.B for
-loops.
-Supported values are
-\fB"@ind_str_asc"\fR,
-\fB"@ind_num_asc"\fR,
-\fB"@val_type_asc"\fR,
-\fB"@val_str_asc"\fR,
-\fB"@val_num_asc"\fR,
-\fB"@ind_str_desc"\fR,
-\fB"@ind_num_desc"\fR,
-\fB"@val_type_desc"\fR,
-\fB"@val_str_desc"\fR,
-\fB"@val_num_desc"\fR,
-and
-\fB"@unsorted"\fR.
-The value can also be the name (as a
-.IR string )
-of any comparison function defined
-as follows:
-.sp
-.in +5m
-\fBfunction cmp_func(i1, v1, i2, v2)\fR
-.in -5m
-.sp
-where
-.I i1
-and
-.I i2
-are the indices, and
-.I v1
-and
-.I v2
-are the
-corresponding values of the two elements being compared.
-It should return a number less than, equal to, or greater than 0,
-depending on how the elements of the array are to be ordered.
-.RE
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset
+for the details.
.TP
.B ROUNDMODE
The rounding mode to use for arbitrary precision arithmetic on
numbers, by default \fB"N"\fR (IEEE-754 roundTiesToEven mode).
-The accepted values are:
-.RS
-.TP
-\fB"A"\fR or \fB"a"\fR
-for rounding away from zero.
-These are only available if your version of
-the GNU MPFR library supports rounding away from zero.
-.TP "\w'\fB\(dqD\(dq\fR or \fB\(dqd\(dq\fR'u+1n"
-\fB"D"\fR or \fB"d"\fR
-for roundTowardNegative.
-.TP
-\fB"N"\fR or \fB"n"\fR
-for roundTiesToEven.
-.TP
-\fB"U"\fR or \fB"u"\fR
-for roundTowardPositive.
-.TP
-\fB"Z"\fR or \fB"z"\fR
-for roundTowardZero.
-.RE
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Setting-the-rounding-mode
+for the details.
.TP
.B RS
The input record separator, by default a newline.
@@ -1435,7 +784,6 @@ specified by
The index of the first character matched by
.BR match() ;
0 if no match.
-(This implies that character indices start at one.)
.TP
.B RLENGTH
The length of the string matched by
@@ -1448,24 +796,7 @@ elements, by default \fB"\e034"\fR.
.TP
.B SYMTAB
An array whose indices are the names of all currently defined
-global variables and arrays in the program. The array may be used
-for indirect access to read or write the value of a variable:
-.sp
-.ft B
-.nf
-.in +5m
-foo = 5
-SYMTAB["foo"] = 4
-print foo # prints 4
-.fi
-.ft R
-.in -5m
-.sp
-The
-.B typeof()
-function may be used to test if an element in
-.B SYMTAB
-is an array.
+global variables and arrays in the program.
You may not use the
.B delete
statement with the
@@ -1541,29 +872,9 @@ just by specifying the array name without a subscript.
.I gawk
supports true multidimensional arrays. It does not require that
such arrays be ``rectangular'' as in C or C++.
-For example:
-.sp
-.RS
-.ft B
-.nf
-a[1] = 5
-a[2][1] = 6
-a[2][2] = 7
-.fi
-.ft
-.RE
-.PP
-.BR NOTE :
-You may need to tell
-.I gawk
-that an array element is really a subarray in order to use it where
-.I gawk
-expects an array (such as in the second argument to
-.BR split() ).
-You can do this by creating an element in the subarray and then
-deleting it with the
-.B delete
-statement.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Arrays
+for details.
.SS Namespaces
.I Gawk
provides a simple
@@ -1594,7 +905,8 @@ namespace names. The names of additional functions provided by
.I gawk
may be used as namespace names or as simple identifiers in other
namespaces.
-For more details, see \*(EP.
+For more details, see
+.IR https://www.gnu.org/software/gawk/manual/html_node/Namespaces.html#Namespaces .
.SS Variable Typing And Conversion
Variables and fields
may be (floating point) numbers, or strings, or both.
@@ -1620,32 +932,7 @@ with the numeric value of the variable as the argument.
However, even though all numbers in \*(AK are floating-point,
integral values are
.I always
-converted as integers. Thus, given
-.PP
-.RS
-.ft B
-.nf
-CONVFMT = "%2.2f"
-a = 12
-b = a ""
-.fi
-.ft R
-.RE
-.PP
-the variable
-.B b
-has a string value of \fB"12"\fR and not \fB"12.00"\fR.
-.PP
-.BR NOTE :
-When operating in POSIX mode (such as with the
-.B \-\^\-posix
-option),
-beware that locale settings may interfere with the way
-decimal numbers are treated: the decimal separator of the numbers you
-are feeding to
-.I gawk
-must conform to what your locale would expect, be it
-a comma (,) or a period (.).
+converted as integers.
.PP
.I Gawk
performs comparisons as follows:
@@ -1690,64 +977,16 @@ is equal to decimal 17.
String constants in \*(AK are sequences of characters enclosed
between double quotes (like \fB"value"\fR). Within strings, certain
.I "escape sequences"
-are recognized, as in C. These are:
-.TP "\w'\fB\e\^\fIddd\fR'u+1n"
-.B \e\e
-A literal backslash.
-.TP
-.B \ea
-The \*(lqalert\*(rq character; usually the \s-1ASCII\s+1 \s-1BEL\s+1 character.
-.TP
-.B \eb
-Backspace.
-.TP
-.B \ef
-Form-feed.
-.TP
-.B \en
-Newline.
-.TP
-.B \er
-Carriage return.
-.TP
-.B \et
-Horizontal tab.
-.TP
-.B \ev
-Vertical tab.
-.TP
-.BI \ex "\^hex digits"
-The character represented by the string of hexadecimal digits following
-the
-.BR \ex .
-Up to two
-following hexadecimal digits are considered part of
-the escape sequence.
-E.g., \fB"\ex1B"\fR is the \s-1ASCII\s+1 \s-1ESC\s+1 (escape) character.
-.TP
-.BI \e ddd
-The character represented by the 1-, 2-, or 3-digit sequence of octal
-digits.
-E.g., \fB"\e033"\fR is the \s-1ASCII\s+1 \s-1ESC\s+1 (escape) character.
-.TP
-.BI \e c
-The literal character
-.IR c\^ .
-.PP
-In compatibility mode, the characters represented by octal and
-hexadecimal escape sequences are treated literally when used in
-regular expression constants. Thus,
-.B /a\e52b/
-is equivalent to
-.BR /a\e*b/ .
+are recognized, as in C.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences
+for the details.
.SS Regexp Constants
A regular expression constant is a sequence of characters enclosed
between forward slashes (like
.BR /value/ ).
-Regular expression matching is described more fully below; see
-.BR "Regular Expressions" .
.PP
-The escape sequences described earlier may also be used inside
+The escape sequences described in the manual may also be used inside
constant regular expressions
(e.g.,
.B "/[\ \et\ef\en\er\ev]/"
@@ -1877,9 +1116,11 @@ For
.BI / "regular expression" /
patterns, the associated statement is executed for each input record that matches
the regular expression.
-Regular expressions are the same as those in
-.IR egrep (1),
-and are summarized below.
+Regular expressions are essentially the same as those in
+.IR egrep (1).
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Regexp.html
+for the details on regular expressions.
.PP
A
.I "relational expression"
@@ -1911,298 +1152,6 @@ It matches all input records starting with a record that matches
and continuing until a record that matches
.IR pattern2 ,
inclusive. It does not combine with any other sort of pattern expression.
-.SS Regular Expressions
-Regular expressions are the extended kind found in
-.IR egrep .
-They are composed of characters as follows:
-.TP "\w'\fB[^\fIabc.\|.\|.\fB]\fR'u+2n"
-.I c
-Matches the non-metacharacter
-.IR c .
-.TP
-.I \ec
-Matches the literal character
-.IR c .
-.TP
-.B .
-Matches any character
-.I including
-newline.
-.TP
-.B ^
-Matches the beginning of a string.
-.TP
-.B $
-Matches the end of a string.
-.TP
-.BI [ abc.\|.\|. ]
-A character list: matches any of the characters
-.IR abc.\|.\|.\& .
-You may include a range of characters by separating them with a dash.
-To include a literal dash in the list, put it first or last.
-.TP
-\fB[^\fIabc.\|.\|.\fB]\fR
-A negated character list: matches any character except
-.IR abc.\|.\|.\& .
-.TP
-.IB r1 | r2
-Alternation: matches either
-.I r1
-or
-.IR r2 .
-.TP
-.I r1r2
-Concatenation: matches
-.IR r1 ,
-and then
-.IR r2 .
-.TP
-.IB r\^ +
-Matches one or more
-.IR r\^ "'s."
-.TP
-.IB r *
-Matches zero or more
-.IR r\^ "'s."
-.TP
-.IB r\^ ?
-Matches zero or one
-.IR r\^ "'s."
-.TP
-.BI ( r )
-Grouping: matches
-.IR r .
-.TP
-.PD 0
-.IB r { n }
-.TP
-.PD 0
-.IB r { n ,}
-.TP
-.PD
-.IB r { n , m }
-One or two numbers inside braces denote an
-.IR "interval expression" .
-If there is one number in the braces, the preceding regular expression
-.I r
-is repeated
-.I n
-times. If there are two numbers separated by a comma,
-.I r
-is repeated
-.I n
-to
-.I m
-times.
-If there is one number followed by a comma, then
-.I r
-is repeated at least
-.I n
-times.
-.TP
-.B \ey
-Matches the empty string at either the beginning or the
-end of a word.
-.TP
-.B \eB
-Matches the empty string within a word.
-.TP
-.B \e<
-Matches the empty string at the beginning of a word.
-.TP
-.B \e>
-Matches the empty string at the end of a word.
-.TP
-.B \es
-Matches any whitespace character.
-.TP
-.B \eS
-Matches any nonwhitespace character.
-.TP
-.B \ew
-Matches any word-constituent character (letter, digit, or underscore).
-.TP
-.B \eW
-Matches any character that is not word-constituent.
-.TP
-.B \e`
-Matches the empty string at the beginning of a buffer (string).
-.TP
-.B \e'
-Matches the empty string at the end of a buffer.
-.PP
-The escape sequences that are valid in string constants (see
-.BR "String Constants" )
-are also valid in regular expressions.
-.PP
-.I "Character classes"
-are a feature introduced in the \*(PX standard.
-A character class is a special notation for describing
-lists of characters that have a specific attribute, but where the
-actual characters themselves can vary from country to country and/or
-from character set to character set. For example, the notion of what
-is an alphabetic character differs in the USA and in France.
-.PP
-A character class is only valid in a regular expression
-.I inside
-the brackets of a character list. Character classes consist of
-.BR [: ,
-a keyword denoting the class, and
-.BR :] .
-The character
-classes defined by the \*(PX standard are:
-.TP "\w'\fB[:alnum:]\fR'u+2n"
-.B [:alnum:]
-Alphanumeric characters.
-.TP
-.B [:alpha:]
-Alphabetic characters.
-.TP
-.B [:blank:]
-Space or tab characters.
-.TP
-.B [:cntrl:]
-Control characters.
-.TP
-.B [:digit:]
-Numeric characters.
-.TP
-.B [:graph:]
-Characters that are both printable and visible.
-(A space is printable, but not visible, while an
-.B a
-is both.)
-.TP
-.B [:lower:]
-Lowercase alphabetic characters.
-.TP
-.B [:print:]
-Printable characters (characters that are not control characters.)
-.TP
-.B [:punct:]
-Punctuation characters (characters that are not letter, digits,
-control characters, or space characters).
-.TP
-.B [:space:]
-Space characters (such as space, tab, and formfeed, to name a few).
-.TP
-.B [:upper:]
-Uppercase alphabetic characters.
-.TP
-.B [:xdigit:]
-Characters that are hexadecimal digits.
-.PP
-For example, before the \*(PX standard, to match alphanumeric
-characters, you would have had to write
-.BR /[A\-Za\-z0\-9]/ .
-If your character set had other alphabetic characters in it, this would not
-match them, and if your character set collated differently from
-\s-1ASCII\s+1, this might not even match the
-\s-1ASCII\s+1 alphanumeric characters.
-With the \*(PX character classes, you can write
-.BR /[[:alnum:]]/ ,
-and this matches
-the alphabetic and numeric characters in your character set,
-no matter what it is.
-.PP
-Two additional special sequences can appear in character lists.
-These apply to non-\s-1ASCII\s+1 character sets, which can have single symbols
-(called
-.IR "collating elements" )
-that are represented with more than one
-character, as well as several characters that are equivalent for
-.IR collating ,
-or sorting, purposes. (E.g., in French, a plain \*(lqe\*(rq
-and a grave-accented \*(lqe\h'-\w:e:u'\`\*(rq are equivalent.)
-.TP
-Collating Symbols
-A collating symbol is a multi-character collating element enclosed in
-.B [.
-and
-.BR .] .
-For example, if
-.B ch
-is a collating element, then
-.B [[.ch.]]
-is a regular expression that matches this collating element, while
-.B [ch]
-is a regular expression that matches either
-.B c
-or
-.BR h .
-.TP
-Equivalence Classes
-An equivalence class is a locale-specific name for a list of
-characters that are equivalent. The name is enclosed in
-.B [=
-and
-.BR =] .
-For example, the name
-.B e
-might be used to represent all of
-\*(lqe\*(rq, \*(lqe\h'-\w:e:u'\'\*(rq, and \*(lqe\h'-\w:e:u'\`\*(rq.
-In this case,
-.B [[=e=]]
-is a regular expression
-that matches any of
-.BR e ,
-.BR "e\h'-\w:e:u'\'" ,
-or
-.BR "e\h'-\w:e:u'\`" .
-.PP
-These features are very valuable in non-English speaking locales.
-The library functions that
-.I gawk
-uses for regular expression matching
-currently only recognize \*(PX character classes; they do not recognize
-collating symbols or equivalence classes.
-.PP
-The
-.BR \ey ,
-.BR \eB ,
-.BR \e< ,
-.BR \e> ,
-.BR \es ,
-.BR \eS ,
-.BR \ew ,
-.BR \eW ,
-.BR \e` ,
-and
-.B \e'
-operators are specific to
-.IR gawk ;
-they are extensions based on facilities in the \*(GN regular expression libraries.
-.PP
-The various command line options
-control how
-.I gawk
-interprets characters in regular expressions.
-.TP
-No options
-In the default case,
-.I gawk
-provides all the facilities of
-\*(PX regular expressions and the \*(GN regular expression operators described above.
-.TP
-.B \-\^\-posix
-Only \*(PX regular expressions are supported, the \*(GN operators are not special.
-(E.g.,
-.B \ew
-matches a literal
-.BR w ).
-.TP
-.B \-\^\-traditional
-Traditional \*(UX
-.I awk
-regular expressions are matched. The \*(GN operators
-are not special, and interval expressions are not available.
-Characters described by octal and hexadecimal escape sequences are
-treated literally, even if they represent regular expression metacharacters.
-.TP
-.B \-\^\-re\-interval
-Allow interval expressions in regular expressions, even if
-.B \-\^\-traditional
-has been provided.
.SS Actions
Action statements are enclosed in braces,
.B {
@@ -2225,8 +1174,7 @@ Field reference.
Increment and decrement, both prefix and postfix.
.TP
.B ^
-Exponentiation (\fB**\fR may also be used, and \fB**=\fR for
-the assignment operator).
+Exponentiation.
.TP
.B "+ \- !"
Unary plus, unary minus, and logical negation.
@@ -2252,19 +1200,6 @@ The regular relational operators.
.TP
.B "~ !~"
Regular expression match, negated match.
-.BR NOTE :
-Do not use a constant regular expression
-.RB ( /foo/ )
-on the left-hand side of a
-.B ~
-or
-.BR !~ .
-Only use one on the right-hand side. The expression
-.BI "/foo/ ~ " exp
-has the same meaning as \fB(($0 ~ /foo/) ~ \fIexp\fB)\fR.
-This is usually
-.I not
-what you want.
.TP
.B in
Array membership.
@@ -2323,7 +1258,7 @@ as follows:
The input/output statements are as follows:
.TP "\w'\fBprintf \fIfmt, expr-list\fR'u+1n"
\fBclose(\fIfile \fR[\fB, \fIhow\fR]\fB)\fR
-Close file, pipe or coprocess.
+Close an open file, pipe or coprocess.
The optional
.I how
should only be used when closing one end of a
@@ -2385,14 +1320,20 @@ or
.IR var ,
as above, and
.BR RT .
-Coprocesses are a
-.I gawk
-extension.
.RI "(The " command
can also be a socket. See the subsection
.BR "Special File Names" ,
below.)
.TP
+\&\fBfflush(\fR[\fIfile\^\fR]\fB)\fR
+Flush any buffers associated with the open output file or pipe
+.IR file .
+If
+.I file
+is missing or if it
+is the null string,
+then flush all open output files and pipes.
+.TP
.B next
Stop processing the current input record.
Read the next input record
@@ -2443,7 +1384,6 @@ The output record is terminated with the value of
.TP
.BI printf " fmt, expr-list"
Format and print.
-See \fBThe \fIprintf \fBStatement\fR, below.
.TP
.BI printf " fmt, expr-list" " >" file
Format and print on
@@ -2454,16 +1394,9 @@ Execute the command
.IR cmd-line ,
and return the exit status.
(This may not be available on non-\*(PX systems.)
-See \*(EP for the full details on the exit status.
-.TP
-\&\fBfflush(\fR[\fIfile\^\fR]\fB)\fR
-Flush any buffers associated with the open output file or pipe
-.IR file .
-If
-.I file
-is missing or if it
-is the null string,
-then flush all open output files and pipes.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/I_002fO-Functions.html#I_002fO-Functions
+for the full details on the exit status.
.PP
Additional output redirections are allowed for
.B print
@@ -2512,235 +1445,14 @@ use
to create new instances of the command or socket.
\*(AK does not automatically close pipes, sockets, or coprocesses when
they return EOF.
-.SS The \fIprintf\fP\^ Statement
+.PP
The \*(AK versions of the
.B printf
statement and
.B sprintf()
function
-(see below)
-accept the following conversion specification formats:
-.TP "\w'\fB%g\fR, \fB%G\fR'u+2n"
-.BR "%a" "," " %A"
-A floating point number of the form
-[\fB\-\fP]\fB0x\fIh\fB.\fIhhhh\fBp+\-\fIdd\fR
-(C99 hexadecimal floating point format).
-For
-.BR %A ,
-uppercase letters are used instead of lowercase ones.
-.TP
-.B %c
-A single character.
-If the argument used for
-.B %c
-is numeric, it is treated as a character and printed.
-Otherwise, the argument is assumed to be a string, and the only first
-character of that string is printed.
-.TP
-.BR "%d" "," " %i"
-A decimal number (the integer part).
-.TP
-.BR %e , " %E"
-A floating point number of the form
-[\fB\-\fP]\fId\fB.\fIdddddd\^\fBe\fR[\fB+\-\fR]\fIdd\fR.
-The
-.B %E
-format uses
-.B E
-instead of
-.BR e .
-.TP
-.BR %f , " %F"
-A floating point number of the form
-[\fB\-\fP]\fIddd\fB.\fIdddddd\fR.
-If the system library supports it,
-.B %F
-is available as well. This is like
-.BR %f ,
-but uses capital letters for special \*(lqnot a number\*(rq
-and \*(lqinfinity\*(rq values. If
-.B %F
-is not available,
-.I gawk
-uses
-.BR %f .
-.TP
-.BR %g , " %G"
-Use
-.B %e
-or
-.B %f
-conversion, whichever is shorter, with nonsignificant zeros suppressed.
-The
-.B %G
-format uses
-.B %E
-instead of
-.BR %e .
-.TP
-.B %o
-An unsigned octal number (also an integer).
-.TP
-.PD
-.B %u
-An unsigned decimal number (again, an integer).
-.TP
-.B %s
-A character string.
-.TP
-.BR %x , " %X"
-An unsigned hexadecimal number (an integer).
-The
-.B %X
-format uses
-.B ABCDEF
-instead of
-.BR abcdef .
-.TP
-.B %%
-A single
-.B %
-character; no argument is converted.
-.PP
-Optional, additional parameters may lie between the
-.B %
-and the control letter:
-.TP
-.IB count $
-Use the
-.IR count "'th"
-argument at this point in the formatting.
-This is called a
-.I "positional specifier"
-and
-is intended primarily for use in translated versions of
-format strings, not in the original text of an AWK program.
-It is a
-.I gawk
-extension.
-.TP
-.B \-
-The expression should be left-justified within its field.
-.TP
-.I space
-For numeric conversions, prefix positive values with a space, and
-negative values with a minus sign.
-.TP
-.B +
-The plus sign, used before the width modifier (see below),
-says to always supply a sign for numeric conversions, even if the data
-to be formatted is positive. The
-.B +
-overrides the space modifier.
-.TP
-.B #
-Use an \*(lqalternate form\*(rq for certain control letters.
-For
-.BR %o ,
-supply a leading zero.
-For
-.BR %x ,
-and
-.BR %X ,
-supply a leading
-.B 0x
-or
-.B 0X
-for
-a nonzero result.
-For
-.BR %e ,
-.BR %E ,
-.B %f
-and
-.BR %F ,
-the result always contains a
-decimal point.
-For
-.BR %g ,
-and
-.BR %G ,
-trailing zeros are not removed from the result.
-.TP
-.B 0
-A leading
-.B 0
-(zero) acts as a flag, indicating that output should be
-padded with zeroes instead of spaces.
-This applies only to the numeric output formats.
-This flag only has an effect when the field width is wider than the
-value to be printed.
-.TP
-.B '
-A single quote character instructs
-.I gawk
-to insert the locale's thousands-separator character
-into decimal numbers, and to also use the locale's
-decimal point character with floating point formats.
-This requires correct locale support in the C library
-and in the definition of the current locale.
-.TP
-.I width
-The field should be padded to this width. The field is normally padded
-with spaces. With the
-.B 0
-flag, it is padded with zeroes.
-.TP
-.BI \&.\& prec
-A number that specifies the precision to use when printing.
-For the
-.BR %e ,
-.BR %E ,
-.B %f
-and
-.BR %F ,
-formats, this specifies the
-number of digits you want printed to the right of the decimal point.
-For the
-.BR %g ,
-and
-.B %G
-formats, it specifies the maximum number
-of significant digits. For the
-.BR %d ,
-.BR %i ,
-.BR %o ,
-.BR %u ,
-.BR %x ,
-and
-.B %X
-formats, it specifies the minimum number of
-digits to print. For the
-.B %s
-format,
-it specifies the maximum number of
-characters from the string that should be printed.
-.PP
-The dynamic
-.I width
-and
-.I prec
-capabilities of the ISO C
-.B printf()
-routines are supported.
-A
-.B *
-in place of either the
-.I width
-or
-.I prec
-specifications causes their values to be taken from
-the argument list to
-.B printf
-or
-.BR sprintf() .
-To use a positional specifier with a dynamic width or precision,
-supply the
-.IB count $
-after the
-.B *
-in the format string.
-For example, \fB"%3$*2$.*1$s"\fP.
+are similar to those of C. For details, see
+.IR https://www.gnu.org/software/gawk/manual/html_node/Printf.html .
.SS Special File Names
When doing I/O redirection from either
.B print
@@ -2774,22 +1486,6 @@ The standard error output.
The file associated with the open file descriptor
.IR n .
.PP
-These are particularly useful for error messages. For example:
-.PP
-.RS
-.ft B
-print "You blew it!" > "/dev/stderr"
-.ft R
-.RE
-.PP
-whereas you would otherwise have to use
-.PP
-.RS
-.ft B
-print "You blew it!" | "cat 1>&2"
-.ft R
-.RE
-.PP
The following special filenames may be used with the
.B |&
coprocess operator for creating TCP/IP network connections:
@@ -2900,8 +1596,9 @@ Return the previous seed for the random
number generator.
.SS String Functions
.I Gawk
-has the following built-in string functions:
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIexpr-list\^\fB)\fR'u+1n"
+has the following built-in string functions; details are provided in
+.IR https://www.gnu.org/software/gawk/manual/html_node/String-Functions .
+.TP "\w'\fBsprintf(\fIfmt\^\fB, \fIexpr-list\^\fB)\fR'u+1n"
\fBasort(\fIs \fR[\fB, \fId\fR [\fB, \fIhow\fR] ]\fB)\fR
Return the number of elements in the source
array
@@ -2935,15 +1632,12 @@ controls the direction and the comparison mode.
Valid values for
.I how
are
-any of the strings valid for
-\fBPROCINFO["sorted_in"]\fR.
-It can also be the name of a user-defined
-comparison function as described in
-\fBPROCINFO["sorted_in"]\fR.
+described in
+.IR https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html#String-Functions .
.IR s " and " d
are allowed to be the same array; this only makes sense when
supplying the third argument as well.
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIexpr-list\^\fB)\fR'u+1n"
+.TP
\fBasorti(\fIs \fR[\fB, \fId\fR [\fB, \fIhow\fR] ]\fB)\fR
Return the number of elements in the source
array
@@ -2959,8 +1653,7 @@ The original values are lost; thus provide
a second array if you wish to preserve the original.
The purpose of the optional string
.I how
-is the same as described
-previously for
+is the same as for
.BR asort() .
Here too,
.IR s " and " d
@@ -3013,7 +1706,7 @@ the modified string is returned as the result of the function,
and the original target string is
.I not
changed.
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIexpr-list\^\fB)\fR'u+1n"
+.TP
\fBgsub(\fIr\fB, \fIs \fR[\fB, \fIt\fR]\fB)\fR
For each substring matching the regular expression
.I r
@@ -3033,8 +1726,8 @@ Use
.B \e&
to get a literal
.BR & .
-(This must be typed as \fB"\e\e&"\fP;
-see \*(EP
+(This must be typed as \fB"\e\e&"\fP; see
+.I https://www.gnu.org/software/gawk/manual/html_node/Gory-Details.html#Gory-Details
for a fuller discussion of the rules for ampersands
and backslashes in the replacement text of
.BR sub() ,
@@ -3051,8 +1744,6 @@ or zero if
.I t
is not present.
(This implies that character indices start at one.)
-It is a fatal error to use a regexp constant for
-.IR t .
.TP
\fBlength(\fR[\fIs\fR]\fB)
Return the length of the string
@@ -3062,7 +1753,7 @@ or the length of
if
.I s
is not supplied.
-As a non-standard extension, with an array argument,
+With an array argument,
.B length()
returns the number of elements in the array.
.TP
@@ -3083,30 +1774,11 @@ operator:
.IB str " ~"
.IR re .
.ft R
-If array
-.I a
-is provided,
-.I a
-is cleared and then elements 1 through
-.I n
-are filled with the portions of
-.I s
-that match the corresponding parenthesized
-subexpression in
-.IR r .
-The zero'th element of
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html#String-Functions
+for a description of how the array
.I a
-contains the portion
-of
-.I s
-matched by the entire regular expression
-.IR r .
-Subscripts
-\fBa[\fIn\^\fB, "start"]\fR,
-and
-\fBa[\fIn\^\fB, "length"]\fR
-provide the starting index in the string and length
-respectively, of each matching substring.
+is filled if it is provided.
.TP
\fBpatsplit(\fIs\fB, \fIa \fR[\fB, \fIr\fR [\fB, \fIseps\fR] ]\fB)\fR
Split the string
@@ -3140,8 +1812,7 @@ and
.I seps
are cleared first.
Splitting behaves identically to field splitting with
-.BR FPAT ,
-described above.
+.BR FPAT .
.TP
\fBsplit(\fIs\fB, \fIa \fR[\fB, \fIr\fR [\fB, \fIseps\fR] ]\fB)\fR
Split the string
@@ -3169,25 +1840,9 @@ between
.BI a[ i ]
and
.BI a[ i +1]\fR.
-If
-.I r
-is a single space, then leading whitespace in
-.I s
-goes into the extra array element
-.B seps[0]
-and trailing whitespace goes into the extra array element
-.BI seps[ n ]\fR,
-where
-.I n
-is the return value of
-.BI split( s ", " a ", " r ", " seps )\fR.
-Splitting behaves identically to field splitting, described above.
-In particular, if
-.I r
-is a single-character string, that string acts as the separator,
-even if it happens to be a regular expression metacharacter.
+Splitting behaves identically to field splitting.
.TP
-.BI sprintf( fmt , " expr-list" )
+.BI sprintf( fmt\^ , " expr-list\^" )
Print
.I expr-list
according to
@@ -3259,11 +1914,10 @@ and
.B match()
all work in terms of characters, not bytes.
.SS Time Functions
-Since one of the primary uses of \*(AK programs is processing log files
-that contain time stamp information,
-.I gawk
+.I Gawk
provides the following functions for obtaining time stamps and
-formatting them.
+formatting them. Details are provided in
+.IR https://www.gnu.org/software/gawk/manual/html_node/Time-Functions .
.TP "\w'\fBsystime()\fR'u+1n"
\fBmktime(\fIdatespec\fR [\fB, \fIutc-flag\fR]\fB)\fR
Turn
@@ -3271,42 +1925,21 @@ Turn
into a time stamp of the same form as returned by
.BR systime() ,
and return the result.
-The
-.I datespec
-is a string of the form
-.IR "YYYY MM DD HH MM SS[ DST]" .
-The contents of the string are six or seven numbers representing respectively
-the full year including century,
-the month from 1 to 12,
-the day of the month from 1 to 31,
-the hour of the day from 0 to 23,
-the minute from 0 to 59,
-the second from 0 to 60,
-and an optional daylight saving flag.
-The values of these numbers need not be within the ranges specified;
-for example, an hour of \-1 means 1 hour before midnight.
-The origin-zero Gregorian calendar is assumed,
-with year 0 preceding year 1 and year \-1 preceding year 0.
If
.I utc-flag
is present and is non-zero or non-null, the time is assumed to be in
the UTC time zone; otherwise, the
time is assumed to be in the local time zone.
-If the
-.I DST
-daylight saving flag is positive,
-the time is assumed to be daylight saving time;
-if zero, the time is assumed to be standard time;
-and if negative (the default),
-.B mktime()
-attempts to determine whether daylight saving time is in effect
-for the specified time.
If
.I datespec
does not contain enough elements or if the resulting time
is out of range,
.B mktime()
returns \-1.
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Time-Functions.html#Time-Functions
+for the details of
+.IR datespec .
.TP
\fBstrftime(\fR[\fIformat \fR[\fB, \fItimestamp\fR[\fB, \fIutc-flag\fR]]]\fB)\fR
Format
@@ -3347,8 +1980,6 @@ values to
.B uintmax_t
integers, doing the operation, and then converting the
result back to floating point.
-.PP
-.BR NOTE :
Passing negative operands to any of these functions causes
a fatal error.
.PP
@@ -3391,8 +2022,6 @@ their arguments.
Return true if
.I x
is an array, false otherwise.
-This function is mainly for use with the elements of multidimensional arrays
-and with function parameters.
.TP
\fBtypeof(\fIx\fB)\fR
Return a string indicating the type of
@@ -3409,7 +2038,8 @@ or
.SS Internationalization Functions
The following functions may be used from within your AWK program for
translating strings at run-time.
-For full details, see \*(EP.
+For full details, see
+.IR https://www.gnu.org/software/gawk/manual/html_node/I18N-Functions.html#I18N-Functions .
.TP
\fBbindtextdomain(\fIdirectory \fR[\fB, \fIdomain\fR]\fB)\fR
Specify the directory where
@@ -3417,8 +2047,7 @@ Specify the directory where
looks for the
.B \&.gmo
files, in case they
-will not or cannot be placed in the ``standard'' locations
-(e.g., during testing).
+will not or cannot be placed in the ``standard'' locations.
It returns the directory where
.I domain
is ``bound.''
@@ -3449,15 +2078,6 @@ is the current value of
The default value for
.I category
is \fB"LC_MESSAGES"\fR.
-.sp .5
-If you supply a value for
-.IR category ,
-it must be a string equal to
-one of the known locale categories described
-in \*(EP.
-You must also supply a text domain. Use
-.B TEXTDOMAIN
-if you want to use the current domain.
.TP
\fBdcngettext(\fIstring1\fB, \fIstring2\fB, \fInumber \fR[\fB, \fIdomain \fR[\fB, \fIcategory\fR]]\fB)\fR
Return the plural form used for
@@ -3478,15 +2098,16 @@ is the current value of
The default value for
.I category
is \fB"LC_MESSAGES"\fR.
-.sp .5
-If you supply a value for
-.IR category ,
-it must be a string equal to
-one of the known locale categories described
-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
@@ -3499,8 +2120,7 @@ in either patterns or actions. Actual parameters supplied in the function
call are used to instantiate the formal parameters declared in the function.
Arrays are passed by reference, other variables are passed by value.
.PP
-Since functions were not originally part of the \*(AK language, the provision
-for local variables is rather clumsy: They are declared as extra parameters
+Local variables are declared as extra parameters
in the parameter list. The convention is to separate local variables from
real parameters by extra spaces in the parameter list. For example:
.PP
@@ -3520,7 +2140,6 @@ function f(p, q, a, b) # a and b are local
The left parenthesis in a function call is required
to immediately follow the function name,
without any intervening whitespace.
-This avoids a syntactic ambiguity with the concatenation operator.
This restriction does not apply to the built-in functions listed above.
.PP
Functions may call each other and may be recursive.
@@ -3533,9 +2152,7 @@ to return a value from a function. The return value is undefined if no
value is provided, or if the function returns by \*(lqfalling off\*(rq the
end.
.PP
-As a
-.I gawk
-extension, functions may be called indirectly. To do this, assign
+Functions may be called indirectly. To do this, assign
the name of the function to be called, as a string, to a variable.
Then use the variable as if it were the name of a function, prefixed with an
.B @
@@ -3557,8 +2174,6 @@ function myfunc()
.fi
.ft R
.RE
-As of version 4.1.2, this works with user-defined functions,
-built-in functions, and extension functions.
.PP
If
.B \-\^\-lint
@@ -3567,12 +2182,6 @@ has been provided,
warns about calls to undefined functions at parse time,
instead of at run time.
Calling an undefined function at run time is a fatal error.
-.PP
-The word
-.B func
-may be used in place of
-.BR function ,
-although this is deprecated.
.SH DYNAMICALLY LOADING NEW FUNCTIONS
You can dynamically add new functions written in C or C++ to the running
.I gawk
@@ -3580,7 +2189,8 @@ interpreter with the
.B @load
statement.
The full details are beyond the scope of this manual page;
-see \*(EP.
+see
+.IR https://www.gnu.org/software/gawk/manual/html_node/Dynamic-Extensions.html#Dynamic-Extensions .
.SH SIGNALS
The
.I gawk
@@ -3622,166 +2232,17 @@ gawk 'BEGIN { print _"hello, world" }'
might print
.B "bonjour, monde"
in France.
-.PP
-There are several steps involved in producing and running a localizable
+See
+.I https://www.gnu.org/software/gawk/manual/html_node/Internationalization.html#Internationalization
+for the steps involved in producing and running a localizable
\*(AK program.
-.TP "\w'4.'u+2n"
-1.
-Add a
-.B BEGIN
-action to assign a value to the
-.B TEXTDOMAIN
-variable to set the text domain to a name associated with your program:
-.sp
-.in +5m
-.ft B
-BEGIN { TEXTDOMAIN = "myprog" }
-.ft R
-.in -5m
-.sp
-This allows
-.I gawk
-to find the
-.B \&.gmo
-file associated with your program.
-Without this step,
-.I gawk
-uses the
-.B messages
-text domain,
-which likely does not contain translations for your program.
-.TP
-2.
-Mark all strings that should be translated with leading underscores.
-.TP
-3.
-If necessary, use the
-.B dcgettext()
-and/or
-.B bindtextdomain()
-functions in your program, as appropriate.
-.TP
-4.
-Run
-.B "gawk \-\^\-gen\-pot \-f myprog.awk > myprog.pot"
-to generate a
-.B \&.pot
-file for your program.
-.TP
-5.
-Provide appropriate translations, and build and install the corresponding
-.B \&.gmo
-files.
-.PP
-The internationalization features are described in full detail in \*(EP.
-.SH POSIX COMPATIBILITY
-A primary goal for
-.I gawk
-is compatibility with the \*(PX standard, as well as with the
-latest version of Brian Kernighan's
-.IR awk .
-To this end,
-.I gawk
-incorporates the following user visible
-features which are not described in the \*(AK book,
-but are part of the Brian Kernighan's version of
-.IR awk ,
-and are in the \*(PX standard.
-.PP
-The book indicates that command line variable assignment happens when
-.I awk
-would otherwise open the argument as a file, which is after the
-.B BEGIN
-rule is executed. However, in earlier implementations, when such an
-assignment appeared before any file names, the assignment would happen
-.I before
-the
-.B BEGIN
-rule was run. Applications came to depend on this \*(lqfeature.\*(rq
-When
-.I awk
-was changed to match its documentation, the
-.B \-v
-option for assigning variables before program execution was added to
-accommodate applications that depended upon the old behavior.
-(This feature was agreed upon by both the Bell Laboratories developers
-and the \*(GN developers.)
-.PP
-When processing arguments,
-.I gawk
-uses the special option \*(lq\-\^\-\*(rq to signal the end of
-arguments.
-In compatibility mode, it warns about but otherwise ignores
-undefined options.
-In normal operation, such arguments are passed on to the \*(AK program for
-it to process.
-.PP
-The \*(AK book does not define the return value of
-.BR srand() .
-The \*(PX standard
-has it return the seed it was using, to allow keeping track
-of random number sequences. Therefore
-.B srand()
-in
-.I gawk
-also returns its current seed.
-.PP
-Other features are:
-The use of multiple
-.B \-f
-options (from MKS
-.IR awk );
-the
-.B ENVIRON
-array; the
-.BR \ea ,
-and
-.B \ev
-escape sequences (done originally in
-.I gawk
-and fed back into the Bell Laboratories version); the
-.B tolower()
-and
-.B toupper()
-built-in functions (from the Bell Laboratories version);
-and the ISO C conversion specifications in
-.B printf
-(done first in the Bell Laboratories version).
-.SH HISTORICAL FEATURES
-There is one feature of historical \*(AK implementations that
-.I gawk
-supports:
-It is possible to call the
-.B length()
-built-in function not only with no argument, but even without parentheses!
-Thus,
-.RS
-.PP
-.ft B
-a = length # Holy Algol 60, Batman!
-.ft R
-.RE
-.PP
-is the same as either of
-.RS
-.PP
-.ft B
-a = length()
-.br
-a = length($0)
-.ft R
-.RE
-.PP
-Using this feature is poor practice, and
-.I gawk
-issues a warning about its use if
-.B \-\^\-lint
-is specified on the command line.
.SH GNU EXTENSIONS
.I Gawk
has a too-large number of extensions to \*(PX
.IR awk .
-They are described in this section. All the extensions described here
+They are described in
+.IR https://www.gnu.org/software/gawk/manual/html_node/POSIX_002fGNU.html .
+All the extensions
can be disabled by
invoking
.I gawk
@@ -3790,246 +2251,6 @@ with the
or
.B \-\^\-posix
options.
-.PP
-The following features of
-.I gawk
-are not available in
-\*(PX
-.IR awk .
-.\" Environment vars and startup stuff
-.TP "\w'\(bu'u+1n"
-\(bu
-No path search is performed for files named via the
-.B \-f
-option. Therefore the
-.B AWKPATH
-environment variable is not special.
-.\" POSIX and language recognition issues
-.TP
-\(bu
-There is no facility for doing file inclusion
-.RI ( gawk 's
-.B @include
-mechanism).
-.TP
-\(bu
-There is no facility for dynamically adding new functions
-written in C
-.RI ( gawk 's
-.B @load
-mechanism).
-.TP
-\(bu
-The
-.B \ex
-escape sequence.
-.TP
-\(bu
-The ability to continue lines after
-.B ?
-and
-.BR : .
-.TP
-\(bu
-Octal and hexadecimal constants in AWK programs.
-.\" Special variables
-.TP
-\(bu
-The
-.BR ARGIND ,
-.BR BINMODE ,
-.BR ERRNO ,
-.BR LINT ,
-.BR PREC ,
-.BR ROUNDMODE ,
-.B RT
-and
-.B TEXTDOMAIN
-variables are not special.
-.TP
-\(bu
-The
-.B IGNORECASE
-variable and its side-effects are not available.
-.TP
-\(bu
-The
-.B FIELDWIDTHS
-variable and fixed-width field splitting.
-.TP
-\(bu
-The
-.B FPAT
-variable and field splitting based on field values.
-.TP
-\(bu
-The
-.BR FUNCTAB ,
-.BR SYMTAB ,
-and
-.B PROCINFO
-arrays are not available.
-.\" I/O stuff
-.TP
-\(bu
-The use of
-.B RS
-as a regular expression.
-.TP
-\(bu
-The special file names available for I/O redirection are not recognized.
-.TP
-\(bu
-The
-.B |&
-operator for creating coprocesses.
-.TP
-\(bu
-The
-.B BEGINFILE
-and
-.B ENDFILE
-special patterns are not available.
-.\" Changes to standard awk functions
-.TP
-\(bu
-The ability to split out individual characters using the null string
-as the value of
-.BR FS ,
-and as the third argument to
-.BR split() .
-.TP
-\(bu
-An optional fourth argument to
-.B split()
-to receive the separator texts.
-.TP
-\(bu
-The optional second argument to the
-.B close()
-function.
-.TP
-\(bu
-The optional third argument to the
-.B match()
-function.
-.TP
-\(bu
-The ability to use positional specifiers with
-.B printf
-and
-.BR sprintf() .
-.TP
-\(bu
-The ability to pass an array to
-.BR length() .
-.\" New keywords or changes to keywords
-.\" (As of 2012, these are in POSIX)
-.\" .TP
-.\" \(bu
-.\" The use of
-.\" .BI delete " array"
-.\" to delete the entire contents of an array.
-.\" .TP
-.\" \(bu
-.\" The use of
-.\" .B "nextfile"
-.\" to abandon processing of the current input file.
-.\" New functions
-.TP
-\(bu
-The
-.BR and() ,
-.BR asort() ,
-.BR asorti() ,
-.BR bindtextdomain() ,
-.BR compl() ,
-.BR dcgettext() ,
-.BR dcngettext() ,
-.BR gensub() ,
-.BR lshift() ,
-.BR mktime() ,
-.BR or() ,
-.BR patsplit() ,
-.BR rshift() ,
-.BR strftime() ,
-.BR strtonum() ,
-.B systime()
-and
-.B xor()
-functions.
-.\" I18N stuff
-.TP
-\(bu
-Localizable strings.
-.TP
-\(bu
-Non-fatal I/O.
-.TP
-\(bu
-Retryable I/O.
-.PP
-The \*(AK book does not define the return value of the
-.B close()
-function.
-.IR Gawk\^ "'s"
-.B close()
-returns the value from
-.IR fclose (3),
-or
-.IR pclose (3),
-when closing an output file or pipe, respectively.
-It returns the process's exit status when closing an input pipe.
-The return value is \-1 if the named file, pipe
-or coprocess was not opened with a redirection.
-.PP
-When
-.I gawk
-is invoked with the
-.B \-\^\-traditional
-option,
-if the
-.I fs
-argument to the
-.B \-F
-option is \*(lqt\*(rq, then
-.B FS
-is set to the tab character.
-Note that typing
-.B "gawk \-F\et \&.\|.\|."
-simply causes the shell to quote the \*(lqt,\*(rq and does not pass
-\*(lq\et\*(rq to the
-.B \-F
-option.
-Since this is a rather ugly special case, it is not the default behavior.
-This behavior also does not occur if
-.B \-\^\-posix
-has been specified.
-To really get a tab character as the field separator, it is best to use
-single quotes:
-.BR "gawk \-F'\et' \&.\|.\|." .
-.ig
-.PP
-If
-.I gawk
-was compiled for debugging, it
-accepts the following additional options:
-.TP
-.PD 0
-.B \-Y
-.TP
-.PD
-.B \-\^\-parsedebug
-Turn on
-.IR yacc (1)
-or
-.IR bison (1)
-debugging output during program parsing.
-This option should only be of interest to the
-.I gawk
-maintainers, and may not even be compiled into
-.IR gawk .
-..
.SH ENVIRONMENT VARIABLES
The
.B AWKPATH
@@ -4150,70 +2371,32 @@ and which ports are currently supported.
.SH BUG REPORTS
If you find a bug in
.IR gawk ,
-please send electronic mail to
-.BR \%bug-gawk@gnu.org .
-Please include your operating system and its revision, the version of
-.I gawk
-(from
-.BR "gawk \-\^\-version" ),
-which C compiler you used to compile it, and a test program
-and data that are as small as possible for reproducing the problem.
-.PP
-Before sending a bug report, please do the following things. First, verify that
-you have the latest version of
-.IR gawk .
-Many bugs (usually subtle ones) are fixed at each release, and if
-yours is out of date, the problem may already have been solved.
-Second, please see if setting the environment variable
-.B LC_ALL
-to
-.B LC_ALL=C
-causes things to behave as you expect. If so, it's a locale issue,
-and may or may not really be a bug.
-Finally, please read this man page and the reference manual carefully to
-be sure that what you think is a bug really is, instead of just a quirk
-in the language.
-.PP
-Whatever you do, do
-.B NOT
-post a bug report in
-.BR comp.lang.awk .
-While the
-.I gawk
-developers occasionally read this newsgroup, posting bug reports there
-is an unreliable way to report bugs.
-Similarly, do
-.B NOT
-use a web forum (such as Stack Overflow) for reporting bugs.
-Instead, please use the electronic mail
-addresses given above.
+please use the
+.IR gawkbug (1)
+program to report it.
+.PP
+Full instructions for reporting a bug are provided in
+.IR https://www.gnu.org/software/gawk/manual/html_node/Bugs.html .
+.I Please
+carefully read and follow the instructions given there.
+This will make bug reporting and resolution much easier for everyone involved.
Really.
-.PP
-If you're using a GNU/Linux or BSD-based system,
-you may wish to submit a bug report to the vendor of your distribution.
-That's fine, but please send a copy to the official email address as well,
-since there's no guarantee that the bug report will be forwarded to the
-.I gawk
-maintainer.
.SH BUGS
The
.B \-F
option is not necessary given the command line variable assignment feature;
it remains only for backwards compatibility.
+.PP
+This manual page is too long;
+.I gawk
+has too many features.
.SH SEE ALSO
.IR egrep (1),
.IR sed (1),
-.IR getpid (2),
-.IR getppid (2),
-.IR getpgrp (2),
-.IR getuid (2),
-.IR geteuid (2),
-.IR getgid (2),
-.IR getegid (2),
-.IR getgroups (2),
+.IR gawkbug (1),
.IR printf (3),
-.IR strftime (3),
-.IR usleep (3)
+and
+.IR strftime (3).
.PP
.IR "The AWK Programming Language" ,
Alfred V.\& Aho, Brian W.\& Kernighan, Peter J.\& Weinberger,
@@ -4224,12 +2407,12 @@ Edition 5.1, shipped with the
.I gawk
source.
The current version of this document is available online at
-.BR https://www.gnu.org/software/gawk/manual .
+.IR https://www.gnu.org/software/gawk/manual .
.PP
The GNU
.B gettext
documentation, available online at
-.BR https://www.gnu.org/software/gettext .
+.IR https://www.gnu.org/software/gettext .
.SH EXAMPLES
.nf
Print and sort the login names of all users:
@@ -4265,14 +2448,17 @@ Run an external command for particular lines of data:
awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }'
.ft R
.fi
+.ig
.SH ACKNOWLEDGEMENTS
Brian Kernighan
provided valuable assistance during testing and debugging.
We thank him.
+..
.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, 2021,
+2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
+2020, 2021, 2022
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
diff --git a/doc/gawk.info b/doc/gawk.info
index 516053f6..b0167ae0 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -382,6 +382,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()'.
@@ -491,6 +493,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"].
@@ -554,6 +557,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.
@@ -2817,8 +2821,7 @@ The following list describes options mandated by the POSIX standard:
'--re-interval'
Allow interval expressions (*note Regexp Operators::) in regexps.
This is now 'gawk''s default behavior. Nevertheless, this option
- remains (both for backward compatibility and for use in combination
- with '--traditional').
+ remains for backward compatibility.
'-s'
'--no-optimize'
@@ -3227,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
@@ -3987,9 +3992,8 @@ stand for themselves.
As mentioned, interval expressions were not traditionally available
in 'awk'. In March of 2019, BWK 'awk' (finally) acquired them.
-Nonetheless, because they were not available for so many decades, 'gawk'
-continues to not supply them when in compatibility mode (*note
-Options::).
+Starting with version 5.2, 'gawk''s '--traditional' option no longer
+disables interval expressions in regular expressions.
POSIX says that interval expressions containing repetition counts
greater than 255 produce unspecified results.
@@ -4330,16 +4334,15 @@ No options
'--traditional'
Match traditional Unix 'awk' regexps. The GNU operators are not
- special, and interval expressions are not available. Because BWK
- 'awk' supports them, the POSIX character classes ('[[:alnum:]]',
- etc.) are available. Characters described by octal and
+ special. Because BWK 'awk' supports them, the POSIX character
+ classes ('[[:alnum:]]', etc.) are available. So too, interval
+ expressions are allowed. Characters described by octal and
hexadecimal escape sequences are treated literally, even if they
represent regexp metacharacters.
'--re-interval'
- Allow interval expressions in regexps, if '--traditional' has been
- provided. Otherwise, interval expressions are available by
- default.
+ This option remains for backwards compatibility but no longer has
+ any real effect.

File: gawk.info, Node: Case-sensitivity, Next: Regexp Summary, Prev: GNU Regexp Operators, Up: Regexp
@@ -7024,8 +7027,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
@@ -12862,6 +12865,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
@@ -12874,7 +12878,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
--------------------------------
@@ -12918,9 +12922,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 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::.
-9.1.2 Numeric Functions
+
+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
@@ -12946,7 +12965,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()'
@@ -13044,7 +13063,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
@@ -13629,7 +13648,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.
@@ -13779,7 +13798,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
@@ -13997,7 +14016,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
@@ -14314,7 +14333,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.
@@ -14497,7 +14516,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
@@ -14521,6 +14540,9 @@ contexts.
'"number"'
X is a number.
+ '"number|bool"'
+ X is a Boolean typed value (*note Boolean Typed Values::).
+
'"string"'
X is a string.
@@ -14595,7 +14617,7 @@ different, they are automatically forced to be scalars. Consider:

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
@@ -15274,7 +15296,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
@@ -21036,6 +21058,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.
@@ -21045,7 +21068,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
===================================
@@ -21088,9 +21111,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.
-12.2 Controlling Array Traversal and Array Sorting
+ 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.3 Controlling Array Traversal and Array Sorting
==================================================
'gawk' lets you control the order in which a 'for (INDX in ARRAY)' loop
@@ -21109,7 +21176,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
@@ -21348,7 +21415,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
@@ -21502,7 +21569,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
@@ -21697,7 +21764,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':
@@ -21777,7 +21844,7 @@ 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
@@ -22039,7 +22106,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
@@ -22075,7 +22142,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
@@ -24434,18 +24501,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.
@@ -24505,11 +24564,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
@@ -24602,6 +24656,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
@@ -24666,7 +24721,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
..........................
@@ -24714,6 +24769,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
@@ -25673,7 +25786,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'.
@@ -25686,6 +25800,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
@@ -25701,6 +25816,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.
@@ -26011,6 +26127,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
@@ -26029,7 +26150,12 @@ example:
dynamically, but the MPFR and GMP libraries treat these objects as
values, the same way that you would pass an 'int' or a 'double' by
value. There is no way to "transfer ownership" of MPFR and GMP objects.
-Thus, code in an extension should look like this:
+
+ The final results of an MPFR or GMP calculation should be passed back
+to 'gawk', by value, as you would a string or a 'double'. 'gawk' will
+take care of freeing the storage.
+
+ Thus, code in an extension should look like this:
mpz_t part1, part2, answer; declare local values
@@ -26042,9 +26168,8 @@ Thus, code in an extension should look like this:
mpz_clear(part1); release intermediate values
mpz_clear(part2);
- mpz_clear(answer);
- return result;
+ return result; value in 'answer' managed by 'gawk'

File: gawk.info, Node: Registration Functions, Next: Printing Messages, Prev: API Ownership of MPFR and GMP Values, Up: Extension API Description
@@ -26737,16 +26862,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
@@ -29027,8 +29153,8 @@ File: gawk.info, Node: Extension Sample Read write array, Next: Extension Samp
17.7.9 Dumping and Restoring an Array
-------------------------------------
-The 'rwarray' extension adds two functions, named 'writea()' and
-'reada()', as follows:
+The 'rwarray' extension adds four functions, named 'writea()',
+'reada()', 'writeall()' and 'readall()', as follows:
'@load "rwarray"'
This is how you load the extension.
@@ -29045,6 +29171,20 @@ The 'rwarray' extension adds two functions, named 'writea()' and
argument. It clears the array first. Here too, the return value
is one on success, or zero upon failure.
+'ret = writeall(file)'
+ This function takes a string argument, which is the name of the
+ file to which to dump the state of all variables. Calling this
+ function is completely equivalent to calling 'writea(file,
+ SYMTAB)'. It returns one on success, or zero upon failure
+
+'ret = readall(file)'
+ This function takes a string argument, which is the name of the
+ file from which to read the contents of various global variables.
+ For each variable in the file, the data is loaded unless the
+ variable already exists. If the variable already exists, the data
+ for that variable in the file is ignored. It returns one on
+ success, or zero upon failure.
+
The array created by 'reada()' is identical to that written by
'writea()' in the sense that the contents are the same. However, due to
implementation issues, the array traversal order of the re-created array
@@ -29060,6 +29200,13 @@ written as native binary data. Thus, arrays containing only string data
can theoretically be dumped on systems with one byte order and restored
on systems with a different one, but this has not been tried.
+ Note that the 'writeall()' and 'readall()' functions provide a
+mechanism for maintaining persistent state across repeated invocations
+of a program. If, for example, a program calculates some statistics
+based on the data in a series of files, it could save state using
+'writeall()' after processing N files, and then reload the state using
+'readall()' when the N+1st file arrives to update the results.
+
Here is an example:
@load "rwarray"
@@ -29067,6 +29214,10 @@ on systems with a different one, but this has not been tried.
ret = writea("arraydump.bin", array)
...
ret = reada("arraydump.bin", array)
+ ...
+ ret = writeall("globalstate.bin")
+ ...
+ ret = readall("globalstate.bin")

File: gawk.info, Node: Extension Sample Readfile, Next: Extension Sample Time, Prev: Extension Sample Read write array, Up: Extension Samples
@@ -31734,39 +31885,34 @@ make both your life and the lives of the maintainers much easier.
5. Before reporting a bug or trying to fix it yourself, try to isolate
it to the smallest possible 'awk' program and input data file that
- reproduce the problem. Then send us:
+ reproduce the problem.
- * The program and data file.
+ 6. Use the 'gawkbug' program to submit the bug report. This program
+ sets up a bug report template and opens it in your editor. You
+ then need to edit it appropriately to include:
- * Some idea of what kind of Unix system you're using.
-
- * The compiler you used to compile 'gawk'.
+ * The program and data file.
* The exact results 'gawk' gave you. Also say what you expected
to occur; this helps us decide whether the problem is really
in the documentation.
- * The version number of 'gawk' you are using. You can get this
- information with the command 'gawk --version'.
+ * A fix if you have one.
- 6. Do _not_ send screenshots. Instead, use copy/paste to send text,
+ 7. Do _not_ send screenshots. Instead, use copy/paste to send text,
or send files.
- 7. Do send files as attachments, instead of inline. This avoids
- corruption by mailer programs out in the wilds of the Internet.
-
8. Please be sure to send all mail in _plain text_, not (or not
exclusively) in HTML.
9. _All email must be in English. This is the only language
understood in common by all the maintainers._
- Once you have a precise problem description, send email to
-<bug-gawk@gnu.org>.
+ The 'gawkbug' program sends email to <bug-gawk@gnu.org>.
The 'gawk' maintainers subscribe to this address, and thus they will
-receive your bug report. Although you can send mail to the maintainers
-directly, the bug reporting address is preferred because the email list
+receive your bug report. Do _not_ send mail to the maintainers
+directly; the bug reporting address is preferred because the email list
is archived at the GNU Project.
NOTE: Many distributions of GNU/Linux and the various BSD-based
@@ -33639,8 +33785,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
@@ -35178,7 +35324,7 @@ Index
* + (plus sign), += operator <1>: Precedence. (line 94)
* , (comma), in range patterns: Ranges. (line 6)
* - (hyphen), file names beginning with: Options. (line 63)
-* - (hyphen), -- end of options marker: Options. (line 348)
+* - (hyphen), -- end of options marker: Options. (line 347)
* - (hyphen), in bracket expressions: Bracket Expressions. (line 25)
* - (hyphen), -= operator: Assignment Ops. (line 129)
* - (hyphen), -- operator: Increment Ops. (line 48)
@@ -35214,9 +35360,9 @@ Index
* --include option: Options. (line 180)
* --lint option: Command Line. (line 20)
* --lint option <1>: Options. (line 215)
-* --lint-old option: Options. (line 338)
+* --lint-old option: Options. (line 337)
* --load option: Options. (line 203)
-* --no-optimize option: Options. (line 323)
+* --no-optimize option: Options. (line 322)
* --non-decimal-data option: Options. (line 248)
* --non-decimal-data option <1>: Nondecimal Data. (line 6)
* --non-decimal-data option, strtonum() function and: Nondecimal Data.
@@ -35228,7 +35374,7 @@ Index
* --profile option: Options. (line 283)
* --profile option <1>: Profiling. (line 12)
* --re-interval option: Options. (line 316)
-* --sandbox option: Options. (line 328)
+* --sandbox option: Options. (line 327)
* --sandbox option, input redirection with getline: Getline. (line 19)
* --sandbox option, output redirection with print, printf: Redirection.
(line 6)
@@ -35239,7 +35385,7 @@ Index
* --traditional option: Options. (line 85)
* --traditional option, --posix option and: Options. (line 310)
* --use-lc-numeric option: Options. (line 257)
-* --version option: Options. (line 343)
+* --version option: Options. (line 342)
* -b option: Options. (line 72)
* -c option: Options. (line 85)
* -C option: Options. (line 92)
@@ -35247,12 +35393,12 @@ Index
* -D option: Options. (line 111)
* -e option: Options. (line 120)
* -E option: Options. (line 146)
-* -e option <1>: Options. (line 384)
+* -e option <1>: Options. (line 383)
* -f option: Long. (line 12)
* -F option: Options. (line 21)
* -f option <1>: Options. (line 25)
-* -F option, -Ft sets FS to TAB: Options. (line 356)
-* -f option, multiple uses: Options. (line 361)
+* -F option, -Ft sets FS to TAB: Options. (line 355)
+* -f option, multiple uses: Options. (line 360)
* -F option, command-line: Command Line Field Separator.
(line 6)
* -g option: Options. (line 168)
@@ -35261,7 +35407,7 @@ Index
* -I option: Options. (line 197)
* -l option: Options. (line 203)
* -l option <1>: Options. (line 215)
-* -L option: Options. (line 338)
+* -L option: Options. (line 337)
* -M option: Options. (line 242)
* -n option: Options. (line 248)
* -N option: Options. (line 257)
@@ -35270,10 +35416,10 @@ Index
* -p option: Options. (line 283)
* -P option: Options. (line 295)
* -r option: Options. (line 316)
-* -s option: Options. (line 323)
-* -S option: Options. (line 328)
+* -s option: Options. (line 322)
+* -S option: Options. (line 327)
* -v option: Options. (line 36)
-* -V option: Options. (line 343)
+* -V option: Options. (line 342)
* -v option <1>: Assignment Options. (line 12)
* -W option: Options. (line 50)
* . (period), regexp operator: Regexp Operator Details.
@@ -35509,7 +35655,7 @@ Index
* arguments, command-line <1>: Auto-set. (line 15)
* arguments, command-line <2>: ARGC and ARGV. (line 6)
* arguments, processing: Getopt Function. (line 6)
-* ARGV array: Options. (line 328)
+* ARGV array: Options. (line 327)
* ARGV array, indexing into: Other Arguments. (line 21)
* arithmetic operators: Arithmetic Ops. (line 6)
* array manipulation in extensions: Array Manipulation. (line 6)
@@ -35798,6 +35944,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)
@@ -35875,11 +36022,13 @@ Index
* buffers, flushing: I/O Functions. (line 32)
* buffers, flushing <1>: I/O Functions. (line 168)
* bug reports, email address, <bug-gawk@gnu.org>: Bug address.
- (line 56)
-* <bug-gawk@gnu.org> bug reporting address: Bug address. (line 56)
+ (line 52)
+* <bug-gawk@gnu.org> bug reporting address: Bug address. (line 52)
* built-in functions: Functions. (line 6)
* built-in functions, evaluation order: Calling Built-in. (line 30)
* BusyBox Awk: Other Versions. (line 92)
+* BWK awk, interval expressions in: Interval Expressions.
+ (line 27)
* bytes, counting: Wc Program. (line 6)
* C library functions, assert(): Assert Function. (line 6)
* C library functions, getopt(): Getopt Function. (line 15)
@@ -36080,7 +36229,7 @@ Index
* cosine: Numeric Functions. (line 15)
* counting words, lines, characters, and bytes: Wc Program. (line 6)
* csh utility: Statements/Lines. (line 45)
-* csh utility, POSIXLY_CORRECT environment variable: Options. (line 405)
+* csh utility, POSIXLY_CORRECT environment variable: Options. (line 404)
* csh utility, |& operator, comparison with: Two-way I/O. (line 27)
* CSV (comma separated values) data, parsing with FPAT: Splitting By Content.
(line 20)
@@ -36154,7 +36303,7 @@ Index
* dark corner, length() function: String Functions. (line 200)
* dark corner, split() function: String Functions. (line 379)
* 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)
@@ -36462,7 +36611,7 @@ Index
* effective group ID of gawk user: Auto-set. (line 172)
* effective user ID of gawk user: Auto-set. (line 180)
* Eggert, Paul: Interval Expressions.
- (line 36)
+ (line 35)
* egrep utility: Bracket Expressions. (line 34)
* egrep utility <1>: Egrep Program. (line 6)
* egrep.awk program: Egrep Program. (line 76)
@@ -36474,7 +36623,7 @@ Index
(line 48)
* elements in arrays, deleting: Delete. (line 6)
* email address for bug reports, <bug-gawk@gnu.org>: Bug address.
- (line 56)
+ (line 52)
* empty array elements: Reference to Elements.
(line 18)
* empty pattern: Empty. (line 6)
@@ -36511,7 +36660,7 @@ Index
* endpwent() user-defined function: Passwd Functions. (line 210)
* English, Steve: Advanced Features. (line 6)
* ENVIRON array: Auto-set. (line 59)
-* environment variables, POSIXLY_CORRECT: Options. (line 390)
+* environment variables, POSIXLY_CORRECT: Options. (line 389)
* environment variables, used by gawk: Environment Variables.
(line 6)
* environment variables, AWKPATH: AWKPATH Variable. (line 6)
@@ -36880,7 +37029,7 @@ Index
* gawk, awk and <1>: This Manual. (line 14)
* gawk, newlines in: Statements/Lines. (line 12)
* gawk, extensions, disabling: Options. (line 295)
-* gawk, version of, printing information about: Options. (line 343)
+* gawk, version of, printing information about: Options. (line 342)
* gawk, ARGIND variable in: Other Arguments. (line 21)
* gawk, PROCINFO array in: Other Arguments. (line 21)
* gawk, escape sequences: Escape Sequences. (line 120)
@@ -36971,6 +37120,7 @@ Index
* gawk, implementation issues, debugging: Compatibility Mode. (line 6)
* gawk, features, adding: Adding Code. (line 6)
* gawk, coding style in: Adding Code. (line 37)
+* gawkbug utility: Bug address. (line 31)
* gawkextlib project: gawkextlib. (line 6)
* gawklibpath_append shell function: Shell Startup Files. (line 29)
* gawklibpath_default shell function: Shell Startup Files. (line 22)
@@ -37090,7 +37240,7 @@ Index
* Hughes, Phil: Acknowledgments. (line 43)
* HUP signal, for dynamic profiling: Profiling. (line 217)
* hyphen (-), file names beginning with: Options. (line 63)
-* hyphen (-), -- end of options marker: Options. (line 348)
+* hyphen (-), -- end of options marker: Options. (line 347)
* hyphen (-), in bracket expressions: Bracket Expressions. (line 25)
* hyphen (-), -= operator: Assignment Ops. (line 129)
* hyphen (-), -- operator: Increment Ops. (line 48)
@@ -37314,7 +37464,7 @@ Index
* lint checking, empty programs: Command Line. (line 16)
* lint checking, issuing warnings: Options. (line 215)
* lint checking, POSIXLY_CORRECT environment variable: Options.
- (line 390)
+ (line 389)
* lint checking: User-modified. (line 90)
* lint checking, array subscripts: Uninitialized Subscripts.
(line 43)
@@ -37395,6 +37545,7 @@ Index
* metacharacters, in regular expressions: Regexp Operators. (line 6)
* minimum precision required by MPFR library: Auto-set. (line 279)
* Minshall, Greg: Getopt Function. (line 105)
+* 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)
@@ -37659,7 +37810,7 @@ Index
* portability, #! (executable scripts): Executable Scripts. (line 29)
* portability, ARGV variable: Executable Scripts. (line 55)
* portability, backslash continuation and: Statements/Lines. (line 30)
-* portability, POSIXLY_CORRECT environment variable: Options. (line 410)
+* portability, POSIXLY_CORRECT environment variable: Options. (line 409)
* portability: Escape Sequences. (line 103)
* portability, backslash in escape sequences: Escape Sequences.
(line 108)
@@ -37736,7 +37887,7 @@ Index
* POSIX awk, function keyword in: Definition Syntax. (line 99)
* POSIX awk, changes in awk versions: POSIX. (line 6)
* POSIX mode: Options. (line 295)
-* POSIX mode <1>: Options. (line 390)
+* POSIX mode <1>: Options. (line 389)
* POSIX mode <2>: Regexp Operator Details.
(line 47)
* POSIX mode <3>: Input Summary. (line 69)
@@ -37756,7 +37907,7 @@ Index
* POSIX mode <12>: POSIX Floating Point Problems.
(line 83)
* POSIX mode <13>: Feature History. (line 315)
-* POSIXLY_CORRECT environment variable: Options. (line 390)
+* POSIXLY_CORRECT environment variable: Options. (line 389)
* PREC variable: User-modified. (line 126)
* precedence, regexp operators: Regexp Operator Details.
(line 137)
@@ -37895,6 +38046,8 @@ Index
(line 18)
* readable data files, checking: File Checking. (line 6)
* readable.awk program: File Checking. (line 11)
+* readall() extension function: Extension Sample Read write array.
+ (line 30)
* readdir extension: Extension Sample Readdir.
(line 9)
* readfile() extension function: Extension Sample Readfile.
@@ -38040,7 +38193,7 @@ Index
(line 68)
* sample debugging session: Sample Debugging Session.
(line 6)
-* sandbox mode: Options. (line 328)
+* sandbox mode: Options. (line 327)
* save debugger options: Debugger Info. (line 85)
* scalar or array: Type Functions. (line 11)
* scalar values: Basic Data Typing. (line 13)
@@ -38608,6 +38761,8 @@ Index
* words, usage counts, generating: Word Sorting. (line 6)
* writea() extension function: Extension Sample Read write array.
(line 12)
+* writeall() extension function: Extension Sample Read write array.
+ (line 24)
* xgettext utility: String Extraction. (line 13)
* xor: Bitwise Functions. (line 58)
* XOR bitwise operation: Bitwise Functions. (line 6)
@@ -38622,609 +38777,612 @@ Index

Tag Table:
Node: Top1200
-Node: Foreword345313
-Node: Foreword449755
-Node: Preface51287
-Ref: Preface-Footnote-154146
-Ref: Preface-Footnote-254255
-Ref: Preface-Footnote-354489
-Node: History54631
-Node: Names56983
-Ref: Names-Footnote-158087
-Node: This Manual58234
-Ref: This Manual-Footnote-164873
-Node: Conventions64973
-Node: Manual History67342
-Ref: Manual History-Footnote-170339
-Ref: Manual History-Footnote-270380
-Node: How To Contribute70454
-Node: Acknowledgments71380
-Node: Getting Started76317
-Node: Running gawk78756
-Node: One-shot79946
-Node: Read Terminal81209
-Node: Long83202
-Node: Executable Scripts84715
-Ref: Executable Scripts-Footnote-187348
-Node: Comments87451
-Node: Quoting89935
-Node: DOS Quoting95461
-Node: Sample Data Files97517
-Node: Very Simple100112
-Node: Two Rules106214
-Node: More Complex108099
-Node: Statements/Lines110431
-Ref: Statements/Lines-Footnote-1114915
-Node: Other Features115180
-Node: When116116
-Ref: When-Footnote-1117870
-Node: Intro Summary117935
-Node: Invoking Gawk118819
-Node: Command Line120333
-Node: Options121131
-Ref: Options-Footnote-1139045
-Ref: Options-Footnote-2139276
-Node: Other Arguments139301
-Node: Naming Standard Input143312
-Node: Environment Variables144522
-Node: AWKPATH Variable145080
-Ref: AWKPATH Variable-Footnote-1148492
-Ref: AWKPATH Variable-Footnote-2148526
-Node: AWKLIBPATH Variable148897
-Ref: AWKLIBPATH Variable-Footnote-1150594
-Node: Other Environment Variables150969
-Node: Exit Status154790
-Node: Include Files155467
-Node: Loading Shared Libraries159157
-Node: Obsolete160585
-Node: Undocumented161277
-Node: Invoking Summary161574
-Node: Regexp164415
-Node: Regexp Usage165869
-Node: Escape Sequences167906
-Node: Regexp Operators174147
-Node: Regexp Operator Details174632
-Ref: Regexp Operator Details-Footnote-1181996
-Node: Interval Expressions182143
-Ref: Interval Expressions-Footnote-1184343
-Node: Bracket Expressions184441
-Ref: table-char-classes186917
-Node: Leftmost Longest190244
-Node: Computed Regexps191547
-Node: GNU Regexp Operators194974
-Node: Case-sensitivity198711
-Ref: Case-sensitivity-Footnote-1201577
-Ref: Case-sensitivity-Footnote-2201812
-Node: Regexp Summary201920
-Node: Reading Files203386
-Node: Records205655
-Node: awk split records206730
-Node: gawk split records211430
-Ref: gawk split records-Footnote-1216504
-Node: Fields216541
-Node: Nonconstant Fields219282
-Ref: Nonconstant Fields-Footnote-1221518
-Node: Changing Fields221722
-Node: Field Separators227753
-Node: Default Field Splitting230451
-Node: Regexp Field Splitting231569
-Node: Single Character Fields235246
-Node: Command Line Field Separator236306
-Node: Full Line Fields239524
-Ref: Full Line Fields-Footnote-1241046
-Ref: Full Line Fields-Footnote-2241092
-Node: Field Splitting Summary241193
-Node: Constant Size243267
-Node: Fixed width data243999
-Node: Skipping intervening247466
-Node: Allowing trailing data248264
-Node: Fields with fixed data249301
-Node: Splitting By Content250819
-Ref: Splitting By Content-Footnote-1254655
-Node: More CSV254818
-Node: FS versus FPAT256433
-Node: Testing field creation257593
-Node: Multiple Line259218
-Node: Getline265495
-Node: Plain Getline267964
-Node: Getline/Variable270537
-Node: Getline/File271688
-Node: Getline/Variable/File273076
-Ref: Getline/Variable/File-Footnote-1274681
-Node: Getline/Pipe274769
-Node: Getline/Variable/Pipe277473
-Node: Getline/Coprocess278608
-Node: Getline/Variable/Coprocess279875
-Node: Getline Notes280617
-Node: Getline Summary283414
-Ref: table-getline-variants283838
-Node: Read Timeout284587
-Ref: Read Timeout-Footnote-1288493
-Node: Retrying Input288551
-Node: Command-line directories289750
-Node: Input Summary290656
-Node: Input Exercises293828
-Node: Printing294262
-Node: Print296096
-Node: Print Examples297553
-Node: Output Separators300333
-Node: OFMT302350
-Node: Printf303706
-Node: Basic Printf304491
-Node: Control Letters306065
-Node: Format Modifiers311229
-Node: Printf Examples317244
-Node: Redirection319730
-Node: Special FD326571
-Ref: Special FD-Footnote-1329739
-Node: Special Files329813
-Node: Other Inherited Files330430
-Node: Special Network331431
-Node: Special Caveats332291
-Node: Close Files And Pipes333240
-Ref: table-close-pipe-return-values340147
-Ref: Close Files And Pipes-Footnote-1340961
-Ref: Close Files And Pipes-Footnote-2341109
-Node: Nonfatal341261
-Node: Output Summary343599
-Node: Output Exercises344821
-Node: Expressions345500
-Node: Values346688
-Node: Constants347366
-Node: Scalar Constants348057
-Ref: Scalar Constants-Footnote-1350567
-Node: Nondecimal-numbers350817
-Node: Regexp Constants353818
-Node: Using Constant Regexps354344
-Node: Standard Regexp Constants354966
-Node: Strong Regexp Constants358154
-Node: Variables361869
-Node: Using Variables362526
-Node: Assignment Options364436
-Node: Conversion366907
-Node: Strings And Numbers367431
-Ref: Strings And Numbers-Footnote-1370494
-Node: Locale influences conversions370603
-Ref: table-locale-affects373361
-Node: All Operators373980
-Node: Arithmetic Ops374609
-Node: Concatenation377325
-Ref: Concatenation-Footnote-1380172
-Node: Assignment Ops380279
-Ref: table-assign-ops385270
-Node: Increment Ops386584
-Node: Truth Values and Conditions390044
-Node: Truth Values391118
-Node: Typing and Comparison392166
-Node: Variable Typing392986
-Ref: Variable Typing-Footnote-1399449
-Ref: Variable Typing-Footnote-2399521
-Node: Comparison Operators399598
-Ref: table-relational-ops400017
-Node: POSIX String Comparison403513
-Ref: POSIX String Comparison-Footnote-1405208
-Ref: POSIX String Comparison-Footnote-2405347
-Node: Boolean Ops405431
-Ref: Boolean Ops-Footnote-1409913
-Node: Conditional Exp410005
-Node: Function Calls411741
-Node: Precedence415618
-Node: Locales419277
-Node: Expressions Summary420909
-Node: Patterns and Actions423482
-Node: Pattern Overview424602
-Node: Regexp Patterns426279
-Node: Expression Patterns426821
-Node: Ranges430602
-Node: BEGIN/END433710
-Node: Using BEGIN/END434471
-Ref: Using BEGIN/END-Footnote-1437225
-Node: I/O And BEGIN/END437331
-Node: BEGINFILE/ENDFILE439644
-Node: Empty442875
-Node: Using Shell Variables443192
-Node: Action Overview445466
-Node: Statements447791
-Node: If Statement449639
-Node: While Statement451134
-Node: Do Statement453162
-Node: For Statement454310
-Node: Switch Statement457565
-Node: Break Statement460006
-Node: Continue Statement462098
-Node: Next Statement463925
-Node: Nextfile Statement466308
-Node: Exit Statement468997
-Node: Built-in Variables471400
-Node: User-modified472533
-Node: Auto-set480300
-Ref: Auto-set-Footnote-1497107
-Ref: Auto-set-Footnote-2497313
-Node: ARGC and ARGV497369
-Node: Pattern Action Summary501582
-Node: Arrays504012
-Node: Array Basics505341
-Node: Array Intro506185
-Ref: figure-array-elements508160
-Ref: Array Intro-Footnote-1510865
-Node: Reference to Elements510993
-Node: Assigning Elements513457
-Node: Array Example513948
-Node: Scanning an Array515707
-Node: Controlling Scanning518729
-Ref: Controlling Scanning-Footnote-1525185
-Node: Numeric Array Subscripts525501
-Node: Uninitialized Subscripts527685
-Node: Delete529304
-Ref: Delete-Footnote-1532056
-Node: Multidimensional532113
-Node: Multiscanning535208
-Node: Arrays of Arrays536799
-Node: Arrays Summary541567
-Node: Functions543660
-Node: Built-in544698
-Node: Calling Built-in545779
-Node: Numeric Functions547775
-Ref: Numeric Functions-Footnote-1551803
-Ref: Numeric Functions-Footnote-2552451
-Ref: Numeric Functions-Footnote-3552499
-Node: String Functions552771
-Ref: String Functions-Footnote-1577613
-Ref: String Functions-Footnote-2577741
-Ref: String Functions-Footnote-3577989
-Node: Gory Details578076
-Ref: table-sub-escapes579867
-Ref: table-sub-proposed581387
-Ref: table-posix-sub582751
-Ref: table-gensub-escapes584293
-Ref: Gory Details-Footnote-1585117
-Node: I/O Functions585271
-Ref: table-system-return-values591725
-Ref: I/O Functions-Footnote-1593806
-Ref: I/O Functions-Footnote-2593954
-Node: Time Functions594074
-Ref: Time Functions-Footnote-1604745
-Ref: Time Functions-Footnote-2604813
-Ref: Time Functions-Footnote-3604971
-Ref: Time Functions-Footnote-4605082
-Ref: Time Functions-Footnote-5605194
-Ref: Time Functions-Footnote-6605421
-Node: Bitwise Functions605687
-Ref: table-bitwise-ops606281
-Ref: Bitwise Functions-Footnote-1612345
-Ref: Bitwise Functions-Footnote-2612518
-Node: Type Functions612709
-Node: I18N Functions616038
-Node: User-defined617689
-Node: Definition Syntax618501
-Ref: Definition Syntax-Footnote-1624195
-Node: Function Example624266
-Ref: Function Example-Footnote-1627188
-Node: Function Calling627210
-Node: Calling A Function627798
-Node: Variable Scope628756
-Node: Pass By Value/Reference631750
-Node: Function Caveats634394
-Ref: Function Caveats-Footnote-1636441
-Node: Return Statement636561
-Node: Dynamic Typing639540
-Node: Indirect Calls640470
-Node: Functions Summary651394
-Node: Library Functions654099
-Ref: Library Functions-Footnote-1657706
-Ref: Library Functions-Footnote-2657849
-Node: Library Names658020
-Ref: Library Names-Footnote-1661687
-Ref: Library Names-Footnote-2661910
-Node: General Functions661996
-Node: Strtonum Function663178
-Node: Assert Function666200
-Node: Round Function669526
-Node: Cliff Random Function671066
-Node: Ordinal Functions672082
-Ref: Ordinal Functions-Footnote-1675145
-Ref: Ordinal Functions-Footnote-2675397
-Node: Join Function675607
-Ref: Join Function-Footnote-1677377
-Node: Getlocaltime Function677577
-Node: Readfile Function681319
-Node: Shell Quoting683296
-Node: Isnumeric Function684724
-Node: Data File Management686112
-Node: Filetrans Function686744
-Node: Rewind Function690840
-Node: File Checking692749
-Ref: File Checking-Footnote-1694083
-Node: Empty Files694284
-Node: Ignoring Assigns696263
-Node: Getopt Function697813
-Ref: Getopt Function-Footnote-1713110
-Node: Passwd Functions713310
-Ref: Passwd Functions-Footnote-1722149
-Node: Group Functions722237
-Ref: Group Functions-Footnote-1730135
-Node: Walking Arrays730342
-Node: Library Functions Summary733350
-Node: Library Exercises734756
-Node: Sample Programs735221
-Node: Running Examples735991
-Node: Clones736719
-Node: Cut Program737943
-Node: Egrep Program748083
-Node: Id Program757084
-Node: Split Program767019
-Ref: Split Program-Footnote-1776912
-Node: Tee Program777085
-Node: Uniq Program779875
-Node: Wc Program787463
-Node: Bytes vs. Characters787850
-Node: Using extensions789398
-Node: wc program790152
-Node: Miscellaneous Programs795017
-Node: Dupword Program796230
-Node: Alarm Program798260
-Node: Translate Program803115
-Ref: Translate Program-Footnote-1807680
-Node: Labels Program807950
-Ref: Labels Program-Footnote-1811301
-Node: Word Sorting811385
-Node: History Sorting815457
-Node: Extract Program817682
-Node: Simple Sed825695
-Node: Igawk Program828769
-Ref: Igawk Program-Footnote-1843100
-Ref: Igawk Program-Footnote-2843302
-Ref: Igawk Program-Footnote-3843424
-Node: Anagram Program843539
-Node: Signature Program846601
-Node: Programs Summary847848
-Node: Programs Exercises849062
-Ref: Programs Exercises-Footnote-1853192
-Node: Advanced Features853278
-Node: Nondecimal Data855345
-Node: Array Sorting856936
-Node: Controlling Array Traversal857636
-Ref: Controlling Array Traversal-Footnote-1866004
-Node: Array Sorting Functions866122
-Ref: Array Sorting Functions-Footnote-1872033
-Node: Two-way I/O872229
-Ref: Two-way I/O-Footnote-1879955
-Ref: Two-way I/O-Footnote-2880142
-Node: TCP/IP Networking880224
-Node: Profiling883300
-Node: Extension Philosophy892609
-Node: Advanced Features Summary894088
-Node: Internationalization896103
-Node: I18N and L10N897777
-Node: Explaining gettext898464
-Ref: Explaining gettext-Footnote-1904356
-Ref: Explaining gettext-Footnote-2904541
-Node: Programmer i18n904706
-Ref: Programmer i18n-Footnote-1909655
-Node: Translator i18n909704
-Node: String Extraction910498
-Ref: String Extraction-Footnote-1911630
-Node: Printf Ordering911716
-Ref: Printf Ordering-Footnote-1914502
-Node: I18N Portability914566
-Ref: I18N Portability-Footnote-1917022
-Node: I18N Example917085
-Ref: I18N Example-Footnote-1920360
-Ref: I18N Example-Footnote-2920433
-Node: Gawk I18N920542
-Node: I18N Summary921164
-Node: Debugger922505
-Node: Debugging923505
-Node: Debugging Concepts923946
-Node: Debugging Terms925755
-Node: Awk Debugging928330
-Ref: Awk Debugging-Footnote-1929275
-Node: Sample Debugging Session929407
-Node: Debugger Invocation929941
-Node: Finding The Bug931327
-Node: List of Debugger Commands937801
-Node: Breakpoint Control939134
-Node: Debugger Execution Control942828
-Node: Viewing And Changing Data946190
-Node: Execution Stack949731
-Node: Debugger Info951368
-Node: Miscellaneous Debugger Commands955439
-Node: Readline Support960501
-Node: Limitations961397
-Node: Debugging Summary963951
-Node: Namespaces965230
-Node: Global Namespace966341
-Node: Qualified Names967739
-Node: Default Namespace968738
-Node: Changing The Namespace969479
-Node: Naming Rules971093
-Node: Internal Name Management972941
-Node: Namespace Example973983
-Node: Namespace And Features976545
-Node: Namespace Summary977980
-Node: Arbitrary Precision Arithmetic979457
-Node: Computer Arithmetic980944
-Ref: table-numeric-ranges984710
-Ref: table-floating-point-ranges985204
-Ref: Computer Arithmetic-Footnote-1985863
-Node: Math Definitions985920
-Ref: table-ieee-formats989236
-Ref: Math Definitions-Footnote-1989840
-Node: MPFR features989945
-Node: FP Math Caution991663
-Ref: FP Math Caution-Footnote-1992735
-Node: Inexactness of computations993104
-Node: Inexact representation994064
-Node: Comparing FP Values995424
-Node: Errors accumulate996665
-Node: Getting Accuracy998098
-Node: Try To Round1000808
-Node: Setting precision1001707
-Ref: table-predefined-precision-strings1002404
-Node: Setting the rounding mode1004235
-Ref: table-gawk-rounding-modes1004609
-Ref: Setting the rounding mode-Footnote-11008541
-Node: Arbitrary Precision Integers1008720
-Ref: Arbitrary Precision Integers-Footnote-11011895
-Node: Checking for MPFR1012044
-Node: POSIX Floating Point Problems1013518
-Ref: POSIX Floating Point Problems-Footnote-11018171
-Node: Floating point summary1018209
-Node: Dynamic Extensions1020399
-Node: Extension Intro1021952
-Node: Plugin License1023218
-Node: Extension Mechanism Outline1024015
-Ref: figure-load-extension1024454
-Ref: figure-register-new-function1026020
-Ref: figure-call-new-function1027113
-Node: Extension API Description1029176
-Node: Extension API Functions Introduction1030889
-Ref: table-api-std-headers1032725
-Node: General Data Types1036975
-Ref: General Data Types-Footnote-11045605
-Node: Memory Allocation Functions1045904
-Ref: Memory Allocation Functions-Footnote-11050405
-Node: Constructor Functions1050504
-Node: API Ownership of MPFR and GMP Values1053970
-Node: Registration Functions1055283
-Node: Extension Functions1055983
-Node: Exit Callback Functions1061305
-Node: Extension Version String1062555
-Node: Input Parsers1063218
-Node: Output Wrappers1075939
-Node: Two-way processors1080451
-Node: Printing Messages1082716
-Ref: Printing Messages-Footnote-11083887
-Node: Updating ERRNO1084040
-Node: Requesting Values1084779
-Ref: table-value-types-returned1085516
-Node: Accessing Parameters1086453
-Node: Symbol Table Access1087690
-Node: Symbol table by name1088202
-Ref: Symbol table by name-Footnote-11091227
-Node: Symbol table by cookie1091355
-Ref: Symbol table by cookie-Footnote-11095540
-Node: Cached values1095604
-Ref: Cached values-Footnote-11099140
-Node: Array Manipulation1099293
-Ref: Array Manipulation-Footnote-11100384
-Node: Array Data Types1100421
-Ref: Array Data Types-Footnote-11103079
-Node: Array Functions1103171
-Node: Flattening Arrays1107669
-Node: Creating Arrays1114645
-Node: Redirection API1119412
-Node: Extension API Variables1122245
-Node: Extension Versioning1122956
-Ref: gawk-api-version1123385
-Node: Extension GMP/MPFR Versioning1125117
-Node: Extension API Informational Variables1126745
-Node: Extension API Boilerplate1127818
-Node: Changes from API V11131792
-Node: Finding Extensions1133364
-Node: Extension Example1133923
-Node: Internal File Description1134721
-Node: Internal File Ops1138801
-Ref: Internal File Ops-Footnote-11150151
-Node: Using Internal File Ops1150291
-Ref: Using Internal File Ops-Footnote-11152674
-Node: Extension Samples1152948
-Node: Extension Sample File Functions1154477
-Node: Extension Sample Fnmatch1162126
-Node: Extension Sample Fork1163613
-Node: Extension Sample Inplace1164831
-Node: Extension Sample Ord1168457
-Node: Extension Sample Readdir1169293
-Ref: table-readdir-file-types1170182
-Node: Extension Sample Revout1171250
-Node: Extension Sample Rev2way1171839
-Node: Extension Sample Read write array1172579
-Node: Extension Sample Readfile1174521
-Node: Extension Sample Time1175616
-Node: Extension Sample API Tests1177368
-Node: gawkextlib1177860
-Node: Extension summary1180778
-Node: Extension Exercises1184480
-Node: Language History1185722
-Node: V7/SVR3.11187378
-Node: SVR41189530
-Node: POSIX1190964
-Node: BTL1192345
-Node: POSIX/GNU1193074
-Node: Feature History1198852
-Node: Common Extensions1216027
-Node: Ranges and Locales1217310
-Ref: Ranges and Locales-Footnote-11221926
-Ref: Ranges and Locales-Footnote-21221953
-Ref: Ranges and Locales-Footnote-31222188
-Node: Contributors1222411
-Node: History summary1228408
-Node: Installation1229788
-Node: Gawk Distribution1230732
-Node: Getting1231216
-Node: Extracting1232179
-Node: Distribution contents1233817
-Node: Unix Installation1240878
-Node: Quick Installation1241682
-Node: Compiling with MPFR1244102
-Node: Shell Startup Files1244792
-Node: Additional Configuration Options1245881
-Node: Configuration Philosophy1248196
-Node: Compiling from Git1250592
-Node: Building the Documentation1251147
-Node: Non-Unix Installation1252531
-Node: PC Installation1252991
-Node: PC Binary Installation1253829
-Node: PC Compiling1254702
-Node: PC Using1255819
-Node: Cygwin1259372
-Node: MSYS1260596
-Node: VMS Installation1261198
-Node: VMS Compilation1261917
-Ref: VMS Compilation-Footnote-11263146
-Node: VMS Dynamic Extensions1263204
-Node: VMS Installation Details1264889
-Node: VMS Running1267151
-Node: VMS GNV1271430
-Node: Bugs1272144
-Node: Bug definition1273056
-Node: Bug address1275992
-Node: Usenet1279380
-Node: Performance bugs1280569
-Node: Asking for help1283490
-Node: Maintainers1285457
-Node: Other Versions1286651
-Node: Installation summary1294815
-Node: Notes1296179
-Node: Compatibility Mode1296973
-Node: Additions1297755
-Node: Accessing The Source1298680
-Node: Adding Code1300117
-Node: New Ports1306309
-Node: Derived Files1310684
-Ref: Derived Files-Footnote-11316344
-Ref: Derived Files-Footnote-21316379
-Ref: Derived Files-Footnote-31316977
-Node: Future Extensions1317091
-Node: Implementation Limitations1317749
-Node: Extension Design1318959
-Node: Old Extension Problems1320103
-Ref: Old Extension Problems-Footnote-11321621
-Node: Extension New Mechanism Goals1321678
-Ref: Extension New Mechanism Goals-Footnote-11325042
-Node: Extension Other Design Decisions1325231
-Node: Extension Future Growth1327344
-Node: Notes summary1327950
-Node: Basic Concepts1329108
-Node: Basic High Level1329789
-Ref: figure-general-flow1330071
-Ref: figure-process-flow1330757
-Ref: Basic High Level-Footnote-11334059
-Node: Basic Data Typing1334244
-Node: Glossary1337572
-Node: Copying1369457
-Node: GNU Free Documentation License1407000
-Node: Index1432120
+Node: Foreword345584
+Node: Foreword450026
+Node: Preface51558
+Ref: Preface-Footnote-154417
+Ref: Preface-Footnote-254526
+Ref: Preface-Footnote-354760
+Node: History54902
+Node: Names57254
+Ref: Names-Footnote-158358
+Node: This Manual58505
+Ref: This Manual-Footnote-165144
+Node: Conventions65244
+Node: Manual History67613
+Ref: Manual History-Footnote-170610
+Ref: Manual History-Footnote-270651
+Node: How To Contribute70725
+Node: Acknowledgments71651
+Node: Getting Started76588
+Node: Running gawk79027
+Node: One-shot80217
+Node: Read Terminal81480
+Node: Long83473
+Node: Executable Scripts84986
+Ref: Executable Scripts-Footnote-187619
+Node: Comments87722
+Node: Quoting90206
+Node: DOS Quoting95732
+Node: Sample Data Files97788
+Node: Very Simple100383
+Node: Two Rules106485
+Node: More Complex108370
+Node: Statements/Lines110702
+Ref: Statements/Lines-Footnote-1115186
+Node: Other Features115451
+Node: When116387
+Ref: When-Footnote-1118141
+Node: Intro Summary118206
+Node: Invoking Gawk119090
+Node: Command Line120604
+Node: Options121402
+Ref: Options-Footnote-1139256
+Ref: Options-Footnote-2139487
+Node: Other Arguments139512
+Node: Naming Standard Input143523
+Node: Environment Variables144733
+Node: AWKPATH Variable145291
+Ref: AWKPATH Variable-Footnote-1148703
+Ref: AWKPATH Variable-Footnote-2148737
+Node: AWKLIBPATH Variable149108
+Ref: AWKLIBPATH Variable-Footnote-1150805
+Node: Other Environment Variables151180
+Node: Exit Status155132
+Node: Include Files155809
+Node: Loading Shared Libraries159499
+Node: Obsolete160927
+Node: Undocumented161619
+Node: Invoking Summary161916
+Node: Regexp164757
+Node: Regexp Usage166211
+Node: Escape Sequences168248
+Node: Regexp Operators174489
+Node: Regexp Operator Details174974
+Ref: Regexp Operator Details-Footnote-1182338
+Node: Interval Expressions182485
+Ref: Interval Expressions-Footnote-1184660
+Node: Bracket Expressions184758
+Ref: table-char-classes187234
+Node: Leftmost Longest190561
+Node: Computed Regexps191864
+Node: GNU Regexp Operators195291
+Node: Case-sensitivity198969
+Ref: Case-sensitivity-Footnote-1201835
+Ref: Case-sensitivity-Footnote-2202070
+Node: Regexp Summary202178
+Node: Reading Files203644
+Node: Records205913
+Node: awk split records206988
+Node: gawk split records211688
+Ref: gawk split records-Footnote-1216762
+Node: Fields216799
+Node: Nonconstant Fields219540
+Ref: Nonconstant Fields-Footnote-1221776
+Node: Changing Fields221980
+Node: Field Separators228011
+Node: Default Field Splitting230709
+Node: Regexp Field Splitting231827
+Node: Single Character Fields235504
+Node: Command Line Field Separator236564
+Node: Full Line Fields239782
+Ref: Full Line Fields-Footnote-1241304
+Ref: Full Line Fields-Footnote-2241350
+Node: Field Splitting Summary241451
+Node: Constant Size243525
+Node: Fixed width data244257
+Node: Skipping intervening247724
+Node: Allowing trailing data248522
+Node: Fields with fixed data249559
+Node: Splitting By Content251077
+Ref: Splitting By Content-Footnote-1254913
+Node: More CSV255076
+Node: FS versus FPAT256691
+Node: Testing field creation257851
+Node: Multiple Line259476
+Node: Getline265753
+Node: Plain Getline268222
+Node: Getline/Variable270795
+Node: Getline/File271946
+Node: Getline/Variable/File273334
+Ref: Getline/Variable/File-Footnote-1274939
+Node: Getline/Pipe275027
+Node: Getline/Variable/Pipe277731
+Node: Getline/Coprocess278866
+Node: Getline/Variable/Coprocess280133
+Node: Getline Notes280875
+Node: Getline Summary283672
+Ref: table-getline-variants284096
+Node: Read Timeout284845
+Ref: Read Timeout-Footnote-1288751
+Node: Retrying Input288809
+Node: Command-line directories290008
+Node: Input Summary290914
+Node: Input Exercises294086
+Node: Printing294520
+Node: Print296354
+Node: Print Examples297811
+Node: Output Separators300591
+Node: OFMT302608
+Node: Printf303964
+Node: Basic Printf304749
+Node: Control Letters306323
+Node: Format Modifiers311485
+Node: Printf Examples317500
+Node: Redirection319986
+Node: Special FD326827
+Ref: Special FD-Footnote-1329995
+Node: Special Files330069
+Node: Other Inherited Files330686
+Node: Special Network331687
+Node: Special Caveats332547
+Node: Close Files And Pipes333496
+Ref: table-close-pipe-return-values340403
+Ref: Close Files And Pipes-Footnote-1341217
+Ref: Close Files And Pipes-Footnote-2341365
+Node: Nonfatal341517
+Node: Output Summary343855
+Node: Output Exercises345077
+Node: Expressions345756
+Node: Values346944
+Node: Constants347622
+Node: Scalar Constants348313
+Ref: Scalar Constants-Footnote-1350823
+Node: Nondecimal-numbers351073
+Node: Regexp Constants354074
+Node: Using Constant Regexps354600
+Node: Standard Regexp Constants355222
+Node: Strong Regexp Constants358410
+Node: Variables362125
+Node: Using Variables362782
+Node: Assignment Options364692
+Node: Conversion367163
+Node: Strings And Numbers367687
+Ref: Strings And Numbers-Footnote-1370750
+Node: Locale influences conversions370859
+Ref: table-locale-affects373617
+Node: All Operators374236
+Node: Arithmetic Ops374865
+Node: Concatenation377581
+Ref: Concatenation-Footnote-1380428
+Node: Assignment Ops380535
+Ref: table-assign-ops385526
+Node: Increment Ops386840
+Node: Truth Values and Conditions390300
+Node: Truth Values391374
+Node: Typing and Comparison392422
+Node: Variable Typing393242
+Ref: Variable Typing-Footnote-1399705
+Ref: Variable Typing-Footnote-2399777
+Node: Comparison Operators399854
+Ref: table-relational-ops400273
+Node: POSIX String Comparison403769
+Ref: POSIX String Comparison-Footnote-1405464
+Ref: POSIX String Comparison-Footnote-2405603
+Node: Boolean Ops405687
+Ref: Boolean Ops-Footnote-1410169
+Node: Conditional Exp410261
+Node: Function Calls411997
+Node: Precedence415874
+Node: Locales419533
+Node: Expressions Summary421165
+Node: Patterns and Actions423738
+Node: Pattern Overview424858
+Node: Regexp Patterns426535
+Node: Expression Patterns427077
+Node: Ranges430858
+Node: BEGIN/END433966
+Node: Using BEGIN/END434727
+Ref: Using BEGIN/END-Footnote-1437481
+Node: I/O And BEGIN/END437587
+Node: BEGINFILE/ENDFILE439900
+Node: Empty443131
+Node: Using Shell Variables443448
+Node: Action Overview445722
+Node: Statements448047
+Node: If Statement449895
+Node: While Statement451390
+Node: Do Statement453418
+Node: For Statement454566
+Node: Switch Statement457821
+Node: Break Statement460262
+Node: Continue Statement462354
+Node: Next Statement464181
+Node: Nextfile Statement466564
+Node: Exit Statement469253
+Node: Built-in Variables471656
+Node: User-modified472789
+Node: Auto-set480556
+Ref: Auto-set-Footnote-1497363
+Ref: Auto-set-Footnote-2497569
+Node: ARGC and ARGV497625
+Node: Pattern Action Summary501838
+Node: Arrays504268
+Node: Array Basics505597
+Node: Array Intro506441
+Ref: figure-array-elements508416
+Ref: Array Intro-Footnote-1511121
+Node: Reference to Elements511249
+Node: Assigning Elements513713
+Node: Array Example514204
+Node: Scanning an Array515963
+Node: Controlling Scanning518985
+Ref: Controlling Scanning-Footnote-1525441
+Node: Numeric Array Subscripts525757
+Node: Uninitialized Subscripts527941
+Node: Delete529560
+Ref: Delete-Footnote-1532312
+Node: Multidimensional532369
+Node: Multiscanning535464
+Node: Arrays of Arrays537055
+Node: Arrays Summary541823
+Node: Functions543916
+Node: Built-in544954
+Node: Calling Built-in546107
+Node: Boolean Functions548103
+Node: Numeric Functions548657
+Ref: Numeric Functions-Footnote-1552684
+Ref: Numeric Functions-Footnote-2553332
+Ref: Numeric Functions-Footnote-3553380
+Node: String Functions553652
+Ref: String Functions-Footnote-1578494
+Ref: String Functions-Footnote-2578622
+Ref: String Functions-Footnote-3578870
+Node: Gory Details578957
+Ref: table-sub-escapes580748
+Ref: table-sub-proposed582268
+Ref: table-posix-sub583632
+Ref: table-gensub-escapes585174
+Ref: Gory Details-Footnote-1585998
+Node: I/O Functions586152
+Ref: table-system-return-values592606
+Ref: I/O Functions-Footnote-1594687
+Ref: I/O Functions-Footnote-2594835
+Node: Time Functions594955
+Ref: Time Functions-Footnote-1605626
+Ref: Time Functions-Footnote-2605694
+Ref: Time Functions-Footnote-3605852
+Ref: Time Functions-Footnote-4605963
+Ref: Time Functions-Footnote-5606075
+Ref: Time Functions-Footnote-6606302
+Node: Bitwise Functions606568
+Ref: table-bitwise-ops607162
+Ref: Bitwise Functions-Footnote-1613226
+Ref: Bitwise Functions-Footnote-2613399
+Node: Type Functions613590
+Node: I18N Functions617010
+Node: User-defined618661
+Node: Definition Syntax619473
+Ref: Definition Syntax-Footnote-1625167
+Node: Function Example625238
+Ref: Function Example-Footnote-1628160
+Node: Function Calling628182
+Node: Calling A Function628770
+Node: Variable Scope629728
+Node: Pass By Value/Reference632722
+Node: Function Caveats635366
+Ref: Function Caveats-Footnote-1637413
+Node: Return Statement637533
+Node: Dynamic Typing640512
+Node: Indirect Calls641442
+Node: Functions Summary652369
+Node: Library Functions655074
+Ref: Library Functions-Footnote-1658681
+Ref: Library Functions-Footnote-2658824
+Node: Library Names658995
+Ref: Library Names-Footnote-1662662
+Ref: Library Names-Footnote-2662885
+Node: General Functions662971
+Node: Strtonum Function664153
+Node: Assert Function667175
+Node: Round Function670501
+Node: Cliff Random Function672041
+Node: Ordinal Functions673057
+Ref: Ordinal Functions-Footnote-1676120
+Ref: Ordinal Functions-Footnote-2676372
+Node: Join Function676582
+Ref: Join Function-Footnote-1678352
+Node: Getlocaltime Function678552
+Node: Readfile Function682294
+Node: Shell Quoting684271
+Node: Isnumeric Function685699
+Node: Data File Management687087
+Node: Filetrans Function687719
+Node: Rewind Function691815
+Node: File Checking693724
+Ref: File Checking-Footnote-1695058
+Node: Empty Files695259
+Node: Ignoring Assigns697238
+Node: Getopt Function698788
+Ref: Getopt Function-Footnote-1714085
+Node: Passwd Functions714285
+Ref: Passwd Functions-Footnote-1723124
+Node: Group Functions723212
+Ref: Group Functions-Footnote-1731110
+Node: Walking Arrays731317
+Node: Library Functions Summary734325
+Node: Library Exercises735731
+Node: Sample Programs736196
+Node: Running Examples736966
+Node: Clones737694
+Node: Cut Program738918
+Node: Egrep Program749058
+Node: Id Program758059
+Node: Split Program767994
+Ref: Split Program-Footnote-1777887
+Node: Tee Program778060
+Node: Uniq Program780850
+Node: Wc Program788438
+Node: Bytes vs. Characters788825
+Node: Using extensions790373
+Node: wc program791127
+Node: Miscellaneous Programs795992
+Node: Dupword Program797205
+Node: Alarm Program799235
+Node: Translate Program804090
+Ref: Translate Program-Footnote-1808655
+Node: Labels Program808925
+Ref: Labels Program-Footnote-1812276
+Node: Word Sorting812360
+Node: History Sorting816432
+Node: Extract Program818657
+Node: Simple Sed826670
+Node: Igawk Program829744
+Ref: Igawk Program-Footnote-1844075
+Ref: Igawk Program-Footnote-2844277
+Ref: Igawk Program-Footnote-3844399
+Node: Anagram Program844514
+Node: Signature Program847576
+Node: Programs Summary848823
+Node: Programs Exercises850037
+Ref: Programs Exercises-Footnote-1854167
+Node: Advanced Features854253
+Node: Nondecimal Data856384
+Node: Boolean Typed Values857982
+Node: Array Sorting859863
+Node: Controlling Array Traversal860568
+Ref: Controlling Array Traversal-Footnote-1868936
+Node: Array Sorting Functions869054
+Ref: Array Sorting Functions-Footnote-1874965
+Node: Two-way I/O875161
+Ref: Two-way I/O-Footnote-1882887
+Ref: Two-way I/O-Footnote-2883074
+Node: TCP/IP Networking883156
+Node: Profiling886232
+Node: Extension Philosophy895541
+Node: Advanced Features Summary897020
+Node: Internationalization899035
+Node: I18N and L10N900709
+Node: Explaining gettext901396
+Ref: Explaining gettext-Footnote-1907288
+Ref: Explaining gettext-Footnote-2907473
+Node: Programmer i18n907638
+Ref: Programmer i18n-Footnote-1912587
+Node: Translator i18n912636
+Node: String Extraction913430
+Ref: String Extraction-Footnote-1914562
+Node: Printf Ordering914648
+Ref: Printf Ordering-Footnote-1917434
+Node: I18N Portability917498
+Ref: I18N Portability-Footnote-1919954
+Node: I18N Example920017
+Ref: I18N Example-Footnote-1923292
+Ref: I18N Example-Footnote-2923365
+Node: Gawk I18N923474
+Node: I18N Summary924096
+Node: Debugger925437
+Node: Debugging926437
+Node: Debugging Concepts926878
+Node: Debugging Terms928687
+Node: Awk Debugging931262
+Ref: Awk Debugging-Footnote-1932207
+Node: Sample Debugging Session932339
+Node: Debugger Invocation932873
+Node: Finding The Bug934259
+Node: List of Debugger Commands940733
+Node: Breakpoint Control942066
+Node: Debugger Execution Control945760
+Node: Viewing And Changing Data949122
+Node: Execution Stack952663
+Node: Debugger Info954300
+Node: Miscellaneous Debugger Commands958371
+Node: Readline Support963433
+Node: Limitations964329
+Node: Debugging Summary966883
+Node: Namespaces968162
+Node: Global Namespace969273
+Node: Qualified Names970671
+Node: Default Namespace971670
+Node: Changing The Namespace972411
+Node: Naming Rules974025
+Node: Internal Name Management975873
+Node: Namespace Example976915
+Node: Namespace And Features979477
+Node: Namespace Summary980912
+Node: Arbitrary Precision Arithmetic982389
+Node: Computer Arithmetic983876
+Ref: table-numeric-ranges987642
+Ref: table-floating-point-ranges988136
+Ref: Computer Arithmetic-Footnote-1988795
+Node: Math Definitions988852
+Ref: table-ieee-formats991828
+Node: MPFR features992396
+Node: FP Math Caution994114
+Ref: FP Math Caution-Footnote-1995186
+Node: Inexactness of computations995555
+Node: Inexact representation996586
+Node: Comparing FP Values997946
+Node: Errors accumulate999187
+Node: Strange values1000643
+Ref: Strange values-Footnote-11003231
+Node: Getting Accuracy1003336
+Node: Try To Round1006046
+Node: Setting precision1006945
+Ref: table-predefined-precision-strings1007642
+Node: Setting the rounding mode1009473
+Ref: table-gawk-rounding-modes1009847
+Ref: Setting the rounding mode-Footnote-11013779
+Node: Arbitrary Precision Integers1013958
+Ref: Arbitrary Precision Integers-Footnote-11017133
+Node: Checking for MPFR1017282
+Node: POSIX Floating Point Problems1018756
+Ref: POSIX Floating Point Problems-Footnote-11023409
+Node: Floating point summary1023447
+Node: Dynamic Extensions1025637
+Node: Extension Intro1027190
+Node: Plugin License1028456
+Node: Extension Mechanism Outline1029253
+Ref: figure-load-extension1029692
+Ref: figure-register-new-function1031258
+Ref: figure-call-new-function1032351
+Node: Extension API Description1034414
+Node: Extension API Functions Introduction1036127
+Ref: table-api-std-headers1037963
+Node: General Data Types1042213
+Ref: General Data Types-Footnote-11050919
+Node: Memory Allocation Functions1051218
+Ref: Memory Allocation Functions-Footnote-11055719
+Node: Constructor Functions1055818
+Node: API Ownership of MPFR and GMP Values1059471
+Node: Registration Functions1061004
+Node: Extension Functions1061704
+Node: Exit Callback Functions1067026
+Node: Extension Version String1068276
+Node: Input Parsers1068939
+Node: Output Wrappers1081660
+Node: Two-way processors1086172
+Node: Printing Messages1088437
+Ref: Printing Messages-Footnote-11089608
+Node: Updating ERRNO1089761
+Node: Requesting Values1090500
+Ref: table-value-types-returned1091237
+Node: Accessing Parameters1092346
+Node: Symbol Table Access1093583
+Node: Symbol table by name1094095
+Ref: Symbol table by name-Footnote-11097120
+Node: Symbol table by cookie1097248
+Ref: Symbol table by cookie-Footnote-11101433
+Node: Cached values1101497
+Ref: Cached values-Footnote-11105033
+Node: Array Manipulation1105186
+Ref: Array Manipulation-Footnote-11106277
+Node: Array Data Types1106314
+Ref: Array Data Types-Footnote-11108972
+Node: Array Functions1109064
+Node: Flattening Arrays1113562
+Node: Creating Arrays1120538
+Node: Redirection API1125305
+Node: Extension API Variables1128138
+Node: Extension Versioning1128849
+Ref: gawk-api-version1129278
+Node: Extension GMP/MPFR Versioning1131010
+Node: Extension API Informational Variables1132638
+Node: Extension API Boilerplate1133711
+Node: Changes from API V11137685
+Node: Finding Extensions1139257
+Node: Extension Example1139816
+Node: Internal File Description1140614
+Node: Internal File Ops1144694
+Ref: Internal File Ops-Footnote-11156044
+Node: Using Internal File Ops1156184
+Ref: Using Internal File Ops-Footnote-11158567
+Node: Extension Samples1158841
+Node: Extension Sample File Functions1160370
+Node: Extension Sample Fnmatch1168019
+Node: Extension Sample Fork1169506
+Node: Extension Sample Inplace1170724
+Node: Extension Sample Ord1174350
+Node: Extension Sample Readdir1175186
+Ref: table-readdir-file-types1176075
+Node: Extension Sample Revout1177143
+Node: Extension Sample Rev2way1177732
+Node: Extension Sample Read write array1178472
+Node: Extension Sample Readfile1181637
+Node: Extension Sample Time1182732
+Node: Extension Sample API Tests1184484
+Node: gawkextlib1184976
+Node: Extension summary1187894
+Node: Extension Exercises1191596
+Node: Language History1192838
+Node: V7/SVR3.11194494
+Node: SVR41196646
+Node: POSIX1198080
+Node: BTL1199461
+Node: POSIX/GNU1200190
+Node: Feature History1205968
+Node: Common Extensions1223143
+Node: Ranges and Locales1224426
+Ref: Ranges and Locales-Footnote-11229042
+Ref: Ranges and Locales-Footnote-21229069
+Ref: Ranges and Locales-Footnote-31229304
+Node: Contributors1229527
+Node: History summary1235524
+Node: Installation1236904
+Node: Gawk Distribution1237848
+Node: Getting1238332
+Node: Extracting1239295
+Node: Distribution contents1240933
+Node: Unix Installation1247994
+Node: Quick Installation1248798
+Node: Compiling with MPFR1251218
+Node: Shell Startup Files1251908
+Node: Additional Configuration Options1252997
+Node: Configuration Philosophy1255312
+Node: Compiling from Git1257708
+Node: Building the Documentation1258263
+Node: Non-Unix Installation1259647
+Node: PC Installation1260107
+Node: PC Binary Installation1260945
+Node: PC Compiling1261818
+Node: PC Using1262935
+Node: Cygwin1266488
+Node: MSYS1267712
+Node: VMS Installation1268314
+Node: VMS Compilation1269033
+Ref: VMS Compilation-Footnote-11270262
+Node: VMS Dynamic Extensions1270320
+Node: VMS Installation Details1272005
+Node: VMS Running1274267
+Node: VMS GNV1278546
+Node: Bugs1279260
+Node: Bug definition1280172
+Node: Bug address1283108
+Node: Usenet1286296
+Node: Performance bugs1287485
+Node: Asking for help1290406
+Node: Maintainers1292373
+Node: Other Versions1293567
+Node: Installation summary1301731
+Node: Notes1303095
+Node: Compatibility Mode1303889
+Node: Additions1304671
+Node: Accessing The Source1305596
+Node: Adding Code1307033
+Node: New Ports1313225
+Node: Derived Files1317600
+Ref: Derived Files-Footnote-11323260
+Ref: Derived Files-Footnote-21323295
+Ref: Derived Files-Footnote-31323893
+Node: Future Extensions1324007
+Node: Implementation Limitations1324665
+Node: Extension Design1325875
+Node: Old Extension Problems1327019
+Ref: Old Extension Problems-Footnote-11328537
+Node: Extension New Mechanism Goals1328594
+Ref: Extension New Mechanism Goals-Footnote-11331958
+Node: Extension Other Design Decisions1332147
+Node: Extension Future Growth1334260
+Node: Notes summary1334866
+Node: Basic Concepts1336024
+Node: Basic High Level1336705
+Ref: figure-general-flow1336987
+Ref: figure-process-flow1337673
+Ref: Basic High Level-Footnote-11340975
+Node: Basic Data Typing1341160
+Node: Glossary1344488
+Node: Copying1376375
+Node: GNU Free Documentation License1413918
+Node: Index1439038

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 6b9cbbe5..68b52536 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -756,6 +756,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()}.
@@ -865,6 +867,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"].
@@ -928,6 +931,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.
@@ -3149,11 +3153,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
@@ -4316,8 +4321,7 @@ Allow interval expressions
(@pxref{Regexp Operators})
in regexps.
This is now @command{gawk}'s default behavior.
-Nevertheless, this option remains (both for backward compatibility
-and for use in combination with @option{--traditional}).
+Nevertheless, this option remains for backward compatibility.
@item @option{-s}
@itemx @option{--no-optimize}
@@ -4853,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
@@ -6102,11 +6109,12 @@ When @samp{@{} and @samp{@}} appear in regexp constants
in a way that cannot be interpreted as an interval expression
(such as @code{/q@{a@}/}), then they stand for themselves.
+@cindex BWK @command{awk} @subentry interval expressions in
As mentioned, interval expressions were not traditionally available
in @command{awk}. In March of 2019, BWK @command{awk} (finally) acquired them.
-Nonetheless, because they were not available for
-so many decades, @command{gawk} continues to not supply them
-when in compatibility mode (@pxref{Options}).
+Starting with @value{PVERSION} 5.2, @command{gawk}'s
+@option{--traditional} option no longer disables interval
+expressions in regular expressions.
POSIX says that interval expressions containing repetition counts greater
than 255 produce unspecified results.
@@ -6670,16 +6678,15 @@ are allowed.
@cindex Brian Kernighan's @command{awk}
@item @option{--traditional}
Match traditional Unix @command{awk} regexps. The GNU operators
-are not special, and interval expressions are not available.
-Because BWK @command{awk} supports them,
+are not special. Because BWK @command{awk} supports them,
the POSIX character classes (@samp{[[:alnum:]]}, etc.) are available.
+So too, interval expressions are allowed.
Characters described by octal and hexadecimal escape sequences are
treated literally, even if they represent regexp metacharacters.
@item @option{--re-interval}
-Allow interval expressions in regexps, if @option{--traditional}
-has been provided.
-Otherwise, interval expressions are available by default.
+This option remains for backwards compatibility but no longer has any
+real effect.
@end table
@node Case-sensitivity
@@ -10251,7 +10258,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
@@ -18385,6 +18392,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
@@ -18454,6 +18462,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
@@ -18518,7 +18545,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.
@@ -20993,6 +21020,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.
@@ -21894,7 +21924,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
@@ -29559,6 +29589,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.
@@ -29625,6 +29656,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
@@ -33989,21 +34063,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
@@ -34172,6 +34234,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
@@ -34293,6 +34356,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
@@ -35572,7 +35871,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}.
@@ -35585,6 +35885,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.''
@@ -35600,6 +35901,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.
@@ -35927,6 +36229,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
@@ -35947,8 +36254,13 @@ p = NULL; @ii{now} q @ii{``owns'' it}
MPFR and GMP objects are indeed allocated on the stack or dynamically,
but the MPFR and GMP libraries treat these objects as values, the same way that
you would pass an @code{int} or a @code{double} by value. There is no
-way to ``transfer ownership'' of MPFR and GMP objects. Thus, code in
-an extension should look like this:
+way to ``transfer ownership'' of MPFR and GMP objects.
+
+The final results of an MPFR or GMP calculation should be passed back
+to @command{gawk}, by value, as you would a string or a @code{double}.
+@command{gawk} will take care of freeing the storage.
+
+Thus, code in an extension should look like this:
@example
mpz_t part1, part2, answer; @ii{declare local values}
@@ -35962,9 +36274,8 @@ make_number_mpz(answer, & result); @ii{set it with final GMP value}
mpz_clear(part1); @ii{release intermediate values}
mpz_clear(part2);
-mpz_clear(answer);
-return result;
+return result; @ii{value in @code{answer} managed by @code{gawk}}
@end example
@node Registration Functions
@@ -36727,7 +37038,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>
@@ -36737,6 +37049,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>
@@ -36749,6 +37062,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>
@@ -36761,6 +37075,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>
@@ -36769,6 +37084,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>
@@ -36777,6 +37093,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>
@@ -36784,11 +37101,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>
@@ -36799,6 +37128,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>
@@ -36809,6 +37139,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>
@@ -36821,6 +37152,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>
@@ -36837,43 +37169,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
@@ -39428,8 +39763,9 @@ is:
@node Extension Sample Read write array
@subsection Dumping and Restoring an Array
-The @code{rwarray} extension adds two functions,
-named @code{writea()} and @code{reada()}, as follows:
+The @code{rwarray} extension adds four functions,
+named @code{writea()}, @code{reada()},
+@code{writeall()} and @code{readall()}, as follows:
@table @code
@item @@load "rwarray"
@@ -39448,6 +39784,24 @@ success, or zero upon failure.
it reads the file named as its first argument, filling in
the array named as the second argument. It clears the array first.
Here too, the return value is one on success, or zero upon failure.
+
+@cindex @code{writeall()} extension function
+@item ret = writeall(file)
+This function takes a string argument, which is the name of the file
+to which to dump the state of all variables.
+Calling this function
+is completely equivalent to calling
+@code{writea(file, SYMTAB)}.
+It returns one on success, or zero upon failure
+
+@cindex @code{readall()} extension function
+@item ret = readall(file)
+This function takes a string argument, which is the name of the
+file from which to read the contents of various global variables.
+For each variable in the file, the data is loaded unless the variable
+already exists. If the variable already exists, the data for that variable
+in the file is ignored.
+It returns one on success, or zero upon failure.
@end table
The array created by @code{reada()} is identical to that written by
@@ -39465,6 +39819,13 @@ as native binary data. Thus, arrays containing only string data can
theoretically be dumped on systems with one byte order and restored on
systems with a different one, but this has not been tried.
+Note that the @code{writeall()} and @code{readall()} functions provide
+a mechanism for maintaining persistent state across repeated invocations of a
+program. If, for example, a program calculates some statistics based on the
+data in a series of files, it could save state using @code{writeall()} after
+processing N files, and then reload the state using @code{readall()} when
+the N+1st file arrives to update the results.
+
Here is an example:
@example
@@ -39473,6 +39834,10 @@ Here is an example:
ret = writea("arraydump.bin", array)
@dots{}
ret = reada("arraydump.bin", array)
+@dots{}
+ret = writeall("globalstate.bin")
+@dots{}
+ret = readall("globalstate.bin")
@end example
@node Extension Sample Readfile
@@ -43105,17 +43470,17 @@ to do something or not, report that too; it's a bug in the documentation!
@item
Before reporting a bug or trying to fix it yourself, try to isolate it
to the smallest possible @command{awk} program and input @value{DF} that
-reproduce the problem. Then send us:
-
-@itemize @bullet
-@item
-The program and @value{DF}.
+reproduce the problem.
@item
-Some idea of what kind of Unix system you're using.
+@cindex @command{gawkbug} utility
+Use the @command{gawkbug} program to submit the bug report. This
+program sets up a bug report template and opens it in your editor.
+You then need to edit it appropriately to include:
+@itemize @bullet
@item
-The compiler you used to compile @command{gawk}.
+The program and @value{DF}.
@item
The exact results
@@ -43123,17 +43488,16 @@ The exact results
us decide whether the problem is really in the documentation.
@item
-The version number of @command{gawk} you are using.
-You can get this information with the command @samp{gawk --version}.
+A fix if you have one.
@end itemize
@item
Do @emph{not} send screenshots. Instead, use copy/paste to send text, or
send files.
-@item
-Do send files as attachments, instead of inline. This avoids corruption
-by mailer programs out in the wilds of the Internet.
+@c @item
+@c Do send files as attachments, instead of inline. This avoids corruption
+@c by mailer programs out in the wilds of the Internet.
@item
Please be sure to send all mail in @emph{plain text},
@@ -43147,12 +43511,12 @@ understood in common by all the maintainers.}
@cindex @email{bug-gawk@@gnu.org} bug reporting address
@cindex email address for bug reports, @email{bug-gawk@@gnu.org}
@cindex bug reports, email address, @email{bug-gawk@@gnu.org}
-Once you have a precise problem description, send email to
+The @command{gawkbug} program sends email to
@EMAIL{bug-gawk@@gnu.org,bug dash gawk at gnu dot org}.
The @command{gawk} maintainers subscribe to this address, and
thus they will receive your bug report.
-Although you can send mail to the maintainers directly,
+Do @emph{not} send mail to the maintainers directly;
the bug reporting address is preferred because the
email list is archived at the GNU Project.
@@ -45560,8 +45924,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/gawkbug.1 b/doc/gawkbug.1
new file mode 100644
index 00000000..eb6889e7
--- /dev/null
+++ b/doc/gawkbug.1
@@ -0,0 +1,72 @@
+.\"
+.\" MAN PAGE COMMENTS to
+.\"
+.\" Arnold Robbins
+.\" bug-gawk@gnu.org
+.\"
+.\" Last Change: Sat Feb 26 22:38:19 IST 2022
+.\"
+.TH GAWKBUG 1 "2022 Feb 26" "GNU Awk 5.2"
+.SH NAME
+gawkbug \- report a bug in gawk
+.SH SYNOPSIS
+\fBgawkbug\fP [\fI--version\fP] [\fI--help\fP] [\fIemail-address\fP]
+.SH DESCRIPTION
+.B gawkbug
+is a shell script to help the user compose and mail bug reports
+concerning gawk in a standard format.
+.B gawkbug
+invokes the editor specified by the environment variable
+.SM
+.B EDITOR
+on a temporary copy of the bug report format outline. The user must
+fill in the appropriate fields and exit the editor.
+.B gawkbug
+then mails the completed report to \fIbug-gawk@gnu.org\fP, or
+\fIemail-address\fP. If the report cannot be mailed, it is saved in the
+file \fIdead.gawkbug\fP in the invoking user's home directory.
+.PP
+The bug report format outline consists of several sections. The first
+section provides information about the machine, operating system, the
+gawk version, and the compilation environment. The second section
+should be filled in with a description of the bug. The third section
+should be a description of how to reproduce the bug. The optional
+fourth section is for a proposed fix. Fixes are encouraged.
+.SH ENVIRONMENT
+.B gawkbug
+will utilize the following environment variables if they exist:
+.TP
+.B EDITOR
+Specifies the preferred editor. If
+.SM
+.B EDITOR
+is not set,
+.B gawkbug
+attempts to locate a number of alternative editors, including
+.BR vim ,
+and if must,
+.BR emacs .
+If
+.B gawkbug
+cannot locate any of the alternative editors, it attempts to execute \fBvi\fP.
+.TP
+.B HOME
+Directory in which the failed bug report is saved if the mail fails.
+.TP
+.B TMPDIR
+Directory in which to create temporary files and directories.
+.SH "SEE ALSO"
+.TP
+\fIgawk\fP(1)
+.SH AUTHORS
+Brian Fox, Free Software Foundation
+.br
+bfox@gnu.org
+.PP
+Chet Ramey, Case Western Reserve University
+.br
+chet@po.cwru.edu
+.PP
+Arnold Robbins
+.br
+bug-gawk@gnu.org
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 06d800a2..bfefda24 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -751,6 +751,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()}.
@@ -860,6 +862,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"].
@@ -923,6 +926,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.
@@ -3059,11 +3063,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
@@ -4226,8 +4231,7 @@ Allow interval expressions
(@pxref{Regexp Operators})
in regexps.
This is now @command{gawk}'s default behavior.
-Nevertheless, this option remains (both for backward compatibility
-and for use in combination with @option{--traditional}).
+Nevertheless, this option remains for backward compatibility.
@item @option{-s}
@itemx @option{--no-optimize}
@@ -4719,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
@@ -5830,11 +5837,12 @@ When @samp{@{} and @samp{@}} appear in regexp constants
in a way that cannot be interpreted as an interval expression
(such as @code{/q@{a@}/}), then they stand for themselves.
+@cindex BWK @command{awk} @subentry interval expressions in
As mentioned, interval expressions were not traditionally available
in @command{awk}. In March of 2019, BWK @command{awk} (finally) acquired them.
-Nonetheless, because they were not available for
-so many decades, @command{gawk} continues to not supply them
-when in compatibility mode (@pxref{Options}).
+Starting with @value{PVERSION} 5.2, @command{gawk}'s
+@option{--traditional} option no longer disables interval
+expressions in regular expressions.
POSIX says that interval expressions containing repetition counts greater
than 255 produce unspecified results.
@@ -6354,16 +6362,15 @@ are allowed.
@cindex Brian Kernighan's @command{awk}
@item @option{--traditional}
Match traditional Unix @command{awk} regexps. The GNU operators
-are not special, and interval expressions are not available.
-Because BWK @command{awk} supports them,
+are not special. Because BWK @command{awk} supports them,
the POSIX character classes (@samp{[[:alnum:]]}, etc.) are available.
+So too, interval expressions are allowed.
Characters described by octal and hexadecimal escape sequences are
treated literally, even if they represent regexp metacharacters.
@item @option{--re-interval}
-Allow interval expressions in regexps, if @option{--traditional}
-has been provided.
-Otherwise, interval expressions are available by default.
+This option remains for backwards compatibility but no longer has any
+real effect.
@end table
@node Case-sensitivity
@@ -9720,7 +9727,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
@@ -17526,6 +17533,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
@@ -17595,6 +17603,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
@@ -17659,7 +17686,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.
@@ -19905,6 +19932,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.
@@ -20806,7 +20836,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
@@ -28441,6 +28471,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.
@@ -28507,6 +28538,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
@@ -32871,21 +32945,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
@@ -33054,6 +33116,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
@@ -33175,6 +33238,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
@@ -34415,7 +34714,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}.
@@ -34428,6 +34728,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.''
@@ -34443,6 +34744,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.
@@ -34770,6 +35072,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
@@ -34790,8 +35097,13 @@ p = NULL; @ii{now} q @ii{``owns'' it}
MPFR and GMP objects are indeed allocated on the stack or dynamically,
but the MPFR and GMP libraries treat these objects as values, the same way that
you would pass an @code{int} or a @code{double} by value. There is no
-way to ``transfer ownership'' of MPFR and GMP objects. Thus, code in
-an extension should look like this:
+way to ``transfer ownership'' of MPFR and GMP objects.
+
+The final results of an MPFR or GMP calculation should be passed back
+to @command{gawk}, by value, as you would a string or a @code{double}.
+@command{gawk} will take care of freeing the storage.
+
+Thus, code in an extension should look like this:
@example
mpz_t part1, part2, answer; @ii{declare local values}
@@ -34805,9 +35117,8 @@ make_number_mpz(answer, & result); @ii{set it with final GMP value}
mpz_clear(part1); @ii{release intermediate values}
mpz_clear(part2);
-mpz_clear(answer);
-return result;
+return result; @ii{value in @code{answer} managed by @code{gawk}}
@end example
@node Registration Functions
@@ -35570,7 +35881,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>
@@ -35580,6 +35892,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>
@@ -35592,6 +35905,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>
@@ -35604,6 +35918,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>
@@ -35612,6 +35927,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>
@@ -35620,6 +35936,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>
@@ -35627,11 +35944,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>
@@ -35642,6 +35971,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>
@@ -35652,6 +35982,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>
@@ -35664,6 +35995,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>
@@ -35680,43 +36012,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
@@ -38271,8 +38606,9 @@ is:
@node Extension Sample Read write array
@subsection Dumping and Restoring an Array
-The @code{rwarray} extension adds two functions,
-named @code{writea()} and @code{reada()}, as follows:
+The @code{rwarray} extension adds four functions,
+named @code{writea()}, @code{reada()},
+@code{writeall()} and @code{readall()}, as follows:
@table @code
@item @@load "rwarray"
@@ -38291,6 +38627,24 @@ success, or zero upon failure.
it reads the file named as its first argument, filling in
the array named as the second argument. It clears the array first.
Here too, the return value is one on success, or zero upon failure.
+
+@cindex @code{writeall()} extension function
+@item ret = writeall(file)
+This function takes a string argument, which is the name of the file
+to which to dump the state of all variables.
+Calling this function
+is completely equivalent to calling
+@code{writea(file, SYMTAB)}.
+It returns one on success, or zero upon failure
+
+@cindex @code{readall()} extension function
+@item ret = readall(file)
+This function takes a string argument, which is the name of the
+file from which to read the contents of various global variables.
+For each variable in the file, the data is loaded unless the variable
+already exists. If the variable already exists, the data for that variable
+in the file is ignored.
+It returns one on success, or zero upon failure.
@end table
The array created by @code{reada()} is identical to that written by
@@ -38308,6 +38662,13 @@ as native binary data. Thus, arrays containing only string data can
theoretically be dumped on systems with one byte order and restored on
systems with a different one, but this has not been tried.
+Note that the @code{writeall()} and @code{readall()} functions provide
+a mechanism for maintaining persistent state across repeated invocations of a
+program. If, for example, a program calculates some statistics based on the
+data in a series of files, it could save state using @code{writeall()} after
+processing N files, and then reload the state using @code{readall()} when
+the N+1st file arrives to update the results.
+
Here is an example:
@example
@@ -38316,6 +38677,10 @@ Here is an example:
ret = writea("arraydump.bin", array)
@dots{}
ret = reada("arraydump.bin", array)
+@dots{}
+ret = writeall("globalstate.bin")
+@dots{}
+ret = readall("globalstate.bin")
@end example
@node Extension Sample Readfile
@@ -41948,17 +42313,17 @@ to do something or not, report that too; it's a bug in the documentation!
@item
Before reporting a bug or trying to fix it yourself, try to isolate it
to the smallest possible @command{awk} program and input @value{DF} that
-reproduce the problem. Then send us:
-
-@itemize @bullet
-@item
-The program and @value{DF}.
+reproduce the problem.
@item
-Some idea of what kind of Unix system you're using.
+@cindex @command{gawkbug} utility
+Use the @command{gawkbug} program to submit the bug report. This
+program sets up a bug report template and opens it in your editor.
+You then need to edit it appropriately to include:
+@itemize @bullet
@item
-The compiler you used to compile @command{gawk}.
+The program and @value{DF}.
@item
The exact results
@@ -41966,17 +42331,16 @@ The exact results
us decide whether the problem is really in the documentation.
@item
-The version number of @command{gawk} you are using.
-You can get this information with the command @samp{gawk --version}.
+A fix if you have one.
@end itemize
@item
Do @emph{not} send screenshots. Instead, use copy/paste to send text, or
send files.
-@item
-Do send files as attachments, instead of inline. This avoids corruption
-by mailer programs out in the wilds of the Internet.
+@c @item
+@c Do send files as attachments, instead of inline. This avoids corruption
+@c by mailer programs out in the wilds of the Internet.
@item
Please be sure to send all mail in @emph{plain text},
@@ -41990,12 +42354,12 @@ understood in common by all the maintainers.}
@cindex @email{bug-gawk@@gnu.org} bug reporting address
@cindex email address for bug reports, @email{bug-gawk@@gnu.org}
@cindex bug reports, email address, @email{bug-gawk@@gnu.org}
-Once you have a precise problem description, send email to
+The @command{gawkbug} program sends email to
@EMAIL{bug-gawk@@gnu.org,bug dash gawk at gnu dot org}.
The @command{gawk} maintainers subscribe to this address, and
thus they will receive your bug report.
-Although you can send mail to the maintainers directly,
+Do @emph{not} send mail to the maintainers directly;
the bug reporting address is preferred because the
email list is archived at the GNU Project.
@@ -44403,8 +44767,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 0f0560a7..e1ef9178 100644
--- a/doc/it/ChangeLog
+++ b/doc/it/ChangeLog
@@ -1,7 +1,174 @@
+2022-03-17 Antonio Giovanni Colombo <azc100@gmail.com>
+ Marco Curreli <marcocurreli@tiscali.it>
+
+ * gawk.1: Updated.
+ * gawkbug.1: Added.
+
+2022-03-10 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawk.1: Updated
+
+2022-03-09 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawk.1: Updated and passed to utf-8
+
+2022-02-25 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * README.txt: Added.
+ * gawktexi.in: Updated.
+
+2022-02-23 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2022-02-10 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-12-11 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2021-12-08 Marco Curreli <marcocurreli@tiscali.it>
+
+ * gawktexi.in: Updated.
+
+2021-11-26 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-11-05 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
2021-10-27 Arnold D. Robbins <arnold@skeeve.com>
* 5.1.1: Release tar ball made.
+2021-10-21 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-10-11 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-10-03 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-10-03 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-10-02 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-09-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+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/README.txt b/doc/it/README.txt
new file mode 100644
index 00000000..53930cfe
--- /dev/null
+++ b/doc/it/README.txt
@@ -0,0 +1,33 @@
+I file contenuti in questa directory permettono di generare
+(in ambiente Linux/Unix/WSL) la versione italiana
+del libro di Arnold GAWK: Programmare efficacemente in AWK,
+SE (e solo se) il software necessario è disponibile nel
+computer in cui si scarica la distribuzione di gawk.
+
+Se la sola cosa che interessa è avere un copia del libro
+in formato PDF, questa può semplicemente essere scaricata
+dal sito:
+
+https://sites.google.com/view/gawkdoc-it/home-page
+
+Per generare il libro localmente, sono disponibili due shell
+script:
+
+compila_originale.sh
+
+compila_smallprint.sh
+
+La sola differenza è la dimensione della pagina stampata,
+che è più piccola usando il secondo script.
+
+Un terzo script:
+
+genera_formati.sh
+
+genera il manuale in vari formati, fra cui i formati
+testo, html e info.
+
+Per eventuali problemi con la traduzione italiana del
+libro Gawk, fare riferimento agli indirizzi email
+dei traduttori, inseriti all'inizio della versione PDF del
+libro stesso.
diff --git a/doc/it/gawk.1 b/doc/it/gawk.1
index c5c76023..4210c8d8 100644
--- a/doc/it/gawk.1
+++ b/doc/it/gawk.1
@@ -14,6 +14,9 @@
.\"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
+.\"Aggiornam. a gawk-5.1.1 di A.G. Colombo - Marzo 2022
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
@@ -30,7 +33,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Aug 31 2020" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Marzo 01 2022" "Free Software Foundation" "Utility Commands"
.SH NOME
gawk \- linguaggio per il riconoscimento e il trattamento di espressioni
regolari
@@ -52,21 +55,21 @@ regolari
file .\|.\|.
.SH DESCRIZIONE
.I Gawk
-è l'implementazione nell'ambito del Progetto \*(GN del linguaggio di
+è l'implementazione nell'ambito del Progetto \*(GN del linguaggio di
programmazione \*(AK . Si attiene alla definizione del linguaggio descritta
nello standard \*(PX 1003.1.
-Questa versione è basata a sua volta sulla descrizione contenuta in
+Questa versione è basata a sua volta sulla descrizione contenuta in
.IR "The AWK Programming Language" ,
di Aho, Kernighan e Weinberger.
.I Gawk
-fornisce le funzionalità aggiuntive presenti nella versione corrente
+fornisce le funzionalità aggiuntive presenti nella versione corrente
di
.I awk
di Brian Kernighan e numerose estensioni specifiche di \*(GN.
.PP
La riga di comando contiene opzioni per
.I gawk
-stesso, il testo del programma \*(AK (se non è stato fornito con le opzioni
+stesso, il testo del programma \*(AK (se non è stato fornito con le opzioni
.B \-f
o
.BR \-\^\-include ),
@@ -75,36 +78,13 @@ nelle variabili \*(AK predefinite
.B ARGC
e
.BR ARGV .
-.PP
-Quando
-.I gawk
-è invocato con l'opzione
-.BR \-\^\-profile ,
-inizia a raccogliere statistiche sul comportamento del programma
-durante l'esecuzione.
-.I Gawk
-in questa modalità è più lento, e produce automaticamente un profilo di
-esecuzione nel file
-.B awkprof.out
-alla fine dell'esecuzione.
-Si veda l'opzione
-.B \-\^\-profile
-più avanti.
-.PP
-.I Gawk
-ha anche una capacità integrata di debugging. Una sessione interattiva di
-analisi degli errori (debug) può essere iniziata fornendo l'opzione
-.B \-\^\-debug
-sulla riga di comando. In questa modalità di esecuzione,
-.I gawk
-carica il
-codice sorgente di AWK e poi richiede l'inserimento di comandi di debug.
-.I Gawk
-può analizzare solo il sorgente di un programma AWK fornito tramite l'opzione
-.B \-f
-e
-.BR \-\^\-include .
-Il debugger è documentato in \*(EP.
+.SH PREMESSA
+Questa pagina di manuale è intenzionalmente il più possibile concisa.
+La documentazione completa è disponibile in \*(EP, ed è là che si
+dovrebbe andare a cercare la descrizione completa di ogni singola
+funzionalità.
+Quando possibile, sono forniti dei link alla versione online del
+manuale.
.SH FORMATO DELLE OPZIONI
.PP
Le opzioni di
@@ -112,7 +92,7 @@ Le opzioni di
possono essere sia nella tradizionale forma a una lettera di \*(PX,
sia nella forma estesa tipica di \*(GN. Le opzioni \*(PX cominciano con un
\*(lq\-\*(rq singolo, quelle in forma lunga cominciano con \*(lq\-\^\-\*(rq.
-Sono disponibili opzioni in forma lunga sia per le funzionalità specifiche
+Sono disponibili opzioni in forma lunga sia per le funzionalità specifiche
di \*(GN, sia per quelle previste da \*(PX.
.PP
Le opzioni specifiche di
@@ -127,7 +107,7 @@ Le opzioni lunghe possono essere abbreviate, sempre che l'abbreviazione
rimanga univoca.
.PP
In aggiunta, ogni opzione lunga ha una corrispondente opzione corta, in modo
-che la funzionalità dell'opzione possa essere usata all'interno di script
+che la funzionalità dell'opzione possa essere usata all'interno di script
.B #!
eseguibili.
.SH OPZIONI
@@ -139,37 +119,24 @@ estensioni
.IR gawk ,
elencate nell'ordine alfabetico delle opzioni corte.
.TP
-.PD 0
.BI \-f " file_di_programma"
-.TP
-.PD
.BI \-\^\-file " file_di_programma"
Legge il sorgente del programma \*(AK dal file
.IR file_di_programma ,
invece che dal primo argomento della riga di comando.
-Si possono specificare più opzioni
+Si possono specificare più opzioni
.B \-f
-(o
-.BR \-\^\-file ).
I file letti come specificato da
.B \-f
sono trattati come se iniziassero con la direttiva implicita \fB@namespace "awk"\fR.
.TP
-.PD 0
.BI \-F " fs"
-.TP
-.PD
.BI \-\^\-separatore_di_campo " fs"
Usa
.I fs
come separatore di campo in input (il valore della variabile predefinita
.BR FS ).
-.TP
-.PD 0
-\fB\-v\fI var\fB\^=\^\fIval\fR
-.TP
-.PD
-\fB\-\^\-assign \fIvar\fB\^=\^\fIval\fR
+\fB\-v\fI var\fB\^=\^\fIval\fR, \fB\-\^\-assign \fIvar\fB\^=\^\fIval\fR
Assegna il valore
.I val
alla variabile
@@ -178,80 +145,38 @@ prima che inizi l'esecuzione del programma.
Questi valori delle variabili sono messi a disposizione della regola
.B BEGIN
di un programma \*(AK.
-.TP
-.PD 0
-.B \-b
-.TP
-.PD
+.BR \-b ", "\c
.B \-\^\-characters\-as\-bytes
-Tratta tutti i dati in input come caratteri costituiti da un solo byte. In
-altre parole, non presta alcuna attenzione alle informazioni sulla
-localizzazione quando tenta di elaborare stringhe come caratteri multibyte.
+Tratta tutti i dati in input come caratteri costituiti da un solo byte.
L'opzione
.B "\-\^\-posix"
ignora questo comportamento.
-.bp
-.TP
-.PD 0
-.B \-c
.TP
-.PD
+.BR \-c ", "\c
.B \-\^\-traditional
-Viene eseguito in modalità
+Viene eseguito in modalità
.IR compatibile .
-In questa modalità,
+In questa modalità,
.I gawk
si comporta esattamente come
.I awk
di Brian Kernighan;
non viene riconosciuta nessuna delle estensioni specifiche di \*(GN.
-.\" L'uso di
-.\" .B \-\^\-traditional
-.\" è da preferirsi alle altre forme di questa opzione.
-Si veda
-.BR "ESTENSIONI GNU" ,
-più avanti, per maggiori informazioni.
.TP
-.PD 0
-.B \-C
-.TP
-.PD
+.BR \-C ", "\c
.B \-\^\-copyright
Stampa sullo standard output la versione sintetica del messaggio di
informazione sul copyright \*(GN ed esce senza segnalare errori.
.TP
-.PD 0
-\fB\-d\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-dump-variables\fR[\fB=\fIfile\fR]
+\fB\-d\fR[\fIfile\fR], \fB\-\^\-dump-variables\fR[\fB=\fIfile\fR]
Stampa un lista ordinata di variabili globali, specificandone il tipo e il valore
finale in
.IR file .
-Se
-.I file
-non viene specificato,
-.I gawk
-usa un file chiamato
+If file di default è
.B awkvars.out
nella directory corrente.
-.sp .5
-Avere una lista di tutte le variabili globali è un buon modo per cercare
-errori tipografici nei programmi.
-Quest'opzione potrebbe essere usata anche se si ha un grosso programma con
-tantissime funzioni, e ci si vuole assicurare che le funzioni non usino
-inavvertitamente variabili globali che sono supposte essere locali
-(è facile commettere questo errore quando si usano nomi di variabili
-semplici come
-.BR i ,
-.BR j ,
-e così via).
.TP
-.PD 0
-\fB\-D\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-debug\fR[\fB=\fIfile\fR]
+\fB\-D\fR[\fIfile\fR], \fB\-\^\-debug\fR[\fB=\fIfile\fR]
Abilita il debugging di programmi \*(AK.
Per default, l'analizzatore di errori [debugger] legge i comandi
in maniera interattiva dalla tastiera (standard input).
@@ -259,102 +184,77 @@ L'argomento opzionale
.I file
specifica un file contenente un elenco di comandi
per il debugger da eseguire in maniera non interattiva.
+.sp .5
+In questo modo di esecuzione,
+.I gawk
+carica il codice sorgente
+AWK e quindi chiede di immettere comandi di debug.
+.I Gawk
+può solo fare il debug di programmi sorgenti AWK specificati tramite le opzioni
+.B \-f
+e
+.B \-\^\-include .
+Il debugger è documentato in \*(EP; vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/Debugger.html#Debugger .
.TP
-.PD 0
-.BI "\-e " testo_del_programma
-.TP
-.PD
+.BI "\-e " testo_del_programma\fR, \fP"\c
.BI \-\^\-source " testo_del_programma"
Usa
.I testo_del_programma
come codice sorgente del programma \*(AK.
-Quest'opzione permette di combinare in modo semplice funzioni di libreria
-(usate attraverso i file indicati dalle opzioni
-.B \-f
-e
-.BR \-\^\-include )
-con codice sorgente immesso sulla riga di comando.
-È rivolta principalmente a programmi \*(AK di media e grande dimensione
-usati all'interno di script di shell.
Ogni argomento specificato da
.B \-e
-è trattato come se iniziasse con la direttiva implicita \fB@namespace "awk"\fR.
-.TP
-.PD 0
-.BI "\-E " file
+è trattato come se iniziasse con la direttiva implicita \fB@namespace "awk"\fR.
.TP
-.PD
-.BI \-\^\-exec " file"
+\fB\-E \fIfile\fR, \fB\-\^\-exec \fIfile\fR
Simile a
.BR \-f ,
-comunque, quest'opzione è l'ultima ad essere elaborata.
+comunque, quest'opzione è l'ultima ad essere elaborata.
Dovrebbe essere usata con script
-.BR #! ,
+.B #! ,
specialmente per applicazioni CGI [Common Gateway Interface], per evitare
di passare opzioni o codice (!) sulla riga di comando
da un URL.
Quest'opzione disabilita gli assegnamenti di variabile da riga di comando.
-.TP
-.PD 0
-.B \-g
-.TP
-.PD
+.BR \-g ", "\c
.B \-\^\-gen\-pot
Esamina e analizza il programma \*(AK, e genera un file in formato \*(GN
.B \&.pot
(Portable Object Template)
sullo standard output con elementi relativi a tutte le stringhe localizzabili
-nel programma. Il programma in sé non viene eseguito.
-Si veda la distribuzione \*(GN
-.I gettext
-per maggiori informazioni sui file
-.BR \&.pot .
-.TP
-.PD 0
-.B \-h
+nel programma. Il programma in sé non viene eseguito.
.TP
-.PD
+.BR \-h ", "\c
.B \-\^\-help
Scrive sullo standard output un riassunto abbastanza breve delle
opzioni disponibili.
-(In linea con le convenzioni di codifica
+In linea con le convenzioni di codifica
.IR "GNU Coding Standards" ,
queste opzioni provocano un'uscita immediata e senza segnalazione di errore.
.TP
-.PD 0
-.BI "\-i " include-file
-.TP
-.PD
-.BI \-\^\-include " include-file"
+\fB\-i \fIinclude-file\fR, \fB\-\^\-include \fIinclude-file\fR
Carica una libreria di sorgenti awk.
Cerca la libreria usando la variabile d'ambiente
.BR AWKPATH .
Se la ricerca iniziale non va a buon fine, viene
fatto un altro tentativo dopo aver aggiunto il suffisso
.BR \&.awk .
-Il file verrà caricato solo una volta
-(cioè vengono ignorati i duplicati), e il codice non costituisce
+Il file verrà caricato solo una volta
+(cioè vengono ignorati i duplicati), e il codice non costituisce
il sorgente del programma principale.
I file letti come specificato da
.B \-\^\-include
sono trattati come se iniziassero con la direttiva implicita \fB@namespace "awk"\fR.
.TP
-.PD 0
-.BI \-I
-.TP
-.PD
+.BR \-I ", "\c
.B \-\^\-trace
Stampa i nomi del codice-byte generato internamente, nell'ordine
in cui sono incontrati durante l'esecuzione del programma.
-Questa trace è stampata sullo standard error.
-Ogni ``codice operativo'' è preceduto da un segno
+Questa trace è stampata sullo standard error.
+Ogni ``codice operativo'' è preceduto da un segno
.B +
nell'output.
-.TP
-.PD 0
-.BI "\-l " lib
-.TP
-.PD
+.BI \-l " lib\fR, "\c
.BI \-\^\-load " lib"
Carica un'estensione
.I gawk
@@ -368,250 +268,136 @@ condivisa predefinita per la piattaforma.
La procedura di inizializzazione della libreria si suppone avere come nome
.BR dl_load() .
.TP
-.PD 0
-.BR "\-L " [ \fIvalore\fR ]
-.TP
-.PD
-.BR \-\^\-lint [ =\fIvalore\fR ]
+\fB\-L \fR[\fIvalore\fR], \fB\-\^\-lint\fR[\fB=\fIvalore\fR]
Emette messaggi d'avvertimento relativi a costrutti dubbi o non portabili
su altre implementazioni di \*(AK.
Con l'argomento opzionale
-.BR fatal ,
-gli avvertimenti lint sono considerati come errori fatali.
-Questo può essere drastico, ma incoraggerà sicuramente
-lo sviluppo di programmi \*(AK più corretti.
-Con l'argomento opzionale
-.BR invalid ,
-vengono emessi solo gli avvertimenti relativi a quello che è
-effettivamente non valido (funzionalità non ancora completamente implementata).
-Specificando l'argomento facoltativo
-.BR no-ext ,
-gli avvertimenti riguardo alle estensioni
-.I gawk
-sono disabilitati.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Options.html#Options
+per la lista di valori possibili per
+.IR valore .
.TP
-.PD 0
-.B \-M
-.TP
-.PD
+.BR \-M ", "\c
.B \-\^\-bignum
Forza il calcolo con precisione arbitraria sui numeri. Quest'opzione
non ha effetto se
.I gawk
-non è compilato per utilizzare le librerie GNU MPFR e GMP.
+non è compilato per utilizzare le librerie GNU MPFR e GMP.
(In tal caso,
.I gawk
invia un messaggio di avvertimento.)
.TP
-.PD 0
-.B \-n
-.TP
-.PD
-.B "\-\^\-non\-decimal\-data"
+.BR \-n ", "\c
+.B \-\^\-non\-decimal\-data
Riconosce valori ottali ed esadecimali nei dati in input.
.I "Usare quest'opzione con molta cautela!"
.TP
-.PD 0
-.B \-N
-.TP
-.PD
+.BR \-N ", "\c
.B \-\^\-use\-lc\-numeric
Forza
.I gawk
a usare il carattere di separazione decimale della localizzazione quando
-analizza i dati in input. Sebbene lo standard POSIX richieda questo
-comportamento, e
-.I gawk
-faccia questo quando l'opzione
-.B \-\^\-posix
-è attiva, il comportamento predefinito è quello tradizionale di usare
-il punto come separatore decimale, anche per le localizzazioni in cui
-il carattere di separazione non è il punto. Quest'opzione ignora il
-comportamento predefinito, senza il rigore draconiano dell'opzione
-.BR \-\^\-posix .
+analizza i dati in input.
.ig
-.\" Quest'opzione è lasciata intenzionalmente non documentata.
-.TP
-.PD 0
-.B "\-W nostalgia"
-.TP
-.PD
+.\" Quest'opzione è lasciata intenzionalmente non documentata.
+.BR "\-W nostalgia" ", "\c
.B \-\^\-nostalgia
Fornisce momenti di nostalgia per gli utenti di
.I awk
di vecchia data.
..
.TP
-.PD 0
-\fB\-o\fR[\fIfile\fR]
-.TP
-.PD
-\fB\-\^\-pretty-print\fR[\fB=\fIfile\fR]
+\fB\-o\fR[\fIfile\fR], \fB\-\^\-pretty-print\fR[\fB=\fIfile\fR]
Stampa una versione formattata graziosamente del programma su
.IR file .
-Se non viene indicato un
-.IR file ,
-.I gawk
-usa un file di nome
+Il file di default è
.B awkprof.out
nella directory corrente.
Quest'opzione attiva anche l'opzione
.BR \-\^\-no\-optimize .
.TP
-.PD 0
-.B \-O
-.TP
-.PD
+.BR \-O ", "\c
.B \-\^\-optimize
Abilita le ottimizzazioni predefinite di
.IR gawk
nella rappresentazione interna del programma.
-Attualmente, questo comprende il semplice calcolo delle costanti.
-Quest'opzione è attiva in modo predefinito.
-.TP
-.PD 0
-\fB\-p\fR[\fIprof-file\fR]
+Quest'opzione è attiva in modo predefinito.
.TP
-.PD
-\fB\-\^\-profile\fR[\fB=\fIprof-file\fR]
+\fB\-p\fR[\fIprof-file\fR], \fB\-\^\-profile\fR[\fB=\fIprof-file\fR]
Inizia una sessione di "profiling", e invia i dati tracciati al file
.IR prof-file .
-Quello predefinito è
-.BR awkprof.out .
+Quello predefinito è
+.B awkprof.out .
Il profilo contiene il numero di esecuzioni di ogni istruzione sul margine
sinistro e il conteggio delle chiamate di funzione per ogni funzione definita
dall'utente.
+.I Gawk
+viene eseguito più lentamente in questo modo.
Quest'opzione attiva anche l'opzione
.BR \-\^\-no\-optimize .
.TP
-.PD 0
-.B \-P
-.TP
-.PD
+.BR \-P ", "\c
.B \-\^\-posix
-Quest'opzione attiva la modalità di
-.IR compatibilità ,
-con le seguenti restrizioni aggiuntive:
-.RS
-.TP "\w'\(bu'u+1n"
-\(bu
-Le sequenze di protezione
-.B \ex
-non vengono riconosciute.
-.TP
-\(bu
-Non è possibile continuare le righe dopo
-.B ?
-e
-.BR : .
-.TP
-\(bu
-Non viene riconosciuto il sinonimo
-.B func
-per la parola chiave
-.BR function .
-.TP
-\(bu
-Non si possono usare gli operatori
-.B **
-e
-.B **=
-al posto di
-.B ^
-e
-.BR ^= .
-.RE
+Quest'opzione attiva la modalità di
+.IR compatibilità ,
+e disabilita un certo numero di estensioni comuni.
.TP
-.PD 0
-.B \-r
-.TP
-.PD
+.BR \-r ", "\c
.B \-\^\-re\-interval
Abilita l'uso di
.I "espressioni di intervallo"
-nelle espressioni regolari
-(vedere
-.BR "Espressioni regolari" ,
-più avanti).
-Nel linguaggio \*(AK le espressioni di intervallo non sono
-mai state disponibili. Lo standard \*(PX le ha aggiunte, per rendere
-.I awk
-ed
-.I egrep
-coerenti tra di loro. Sono abilitate in modalità predefinita, però quest'opzione
-rimane per essere usata insieme all'opzione
-.BR \-\^\-traditional .
+nelle espressioni regolari.
+Le espressioni di intervallo
+sono rese disponibili per default, ma quest'opzione
+viene lasciata per compatibilità all'indietro.
.TP
-.PD 0
-.B \-s
-.TP
-.PD
+.BR \-s ", "\c
.B \-\^\-no\-optimize
Disabilita le ottimizzazioni predefinite di
.I gawk
nella rappresentazione interna del programma.
.TP
-.PD 0
-.B \-S
-.TP
-.PD
+.BR \-S ", "\c
.B \-\^\-sandbox
Esegue
.I gawk
-in modalità "sandbox", disabilitando la funzione
+in modalità "sandbox", disabilitando la funzione
.BR system() ,
la ridirezione dell'input con
.BR getline ,
la ridirezione sull'output con
.BR print " e " printf ,
e il caricamento delle estensioni dinamiche.
-L'esecuzione di comandi (tramite pipeline) è anch'essa disabilitata.
-Questo impedisce completamente l'accesso di uno script alle risorse locali,
-tranne che per i file specificati nella riga di comando.
-.TP
-.PD 0
-.B \-t
+L'esecuzione di comandi (tramite pipeline) è anch'essa disabilitata.
.TP
-.PD
+.BR \-t ", "\c
.B \-\^\-lint\-old
Emette messaggi d'avvertimento relativi a costrutti non portabili
sulla versione originale di
.I awk
per \*(UX.
.TP
-.PD 0
-.B \-V
-.TP
-.PD
+.BR \-V ", "\c
.B \-\^\-version
Scrive sullo standard output la versione di questa particolare copia di
.IR gawk .
-È utile principalmente per sapere se la copia di
-.I gawk
-attualmente installata è aggiornata
-rispetto a ciò che Free Software Foundation sta distribuendo.
-È utile anche quando si devono segnalare degli errori.
-(In linea con le convenzioni di codifica
+È utile principalmente per segnalare bug.
+In linea con le convenzioni di codifica
.IR "GNU Coding Standards" ,
-queste opzioni provocano un'uscita immediata e senza segnalazione
-di errore.)
+queste opzioni provocano un'uscita immediata e senza segnalazione di errore.
.TP
.B \-\^\-
-Segnala la fine delle opzioni. È utile perché permette di passare al programma
+Segnala la fine delle opzioni. È utile perché permette di passare al programma
\*(AK ulteriori argomenti [nomi di file] che iniziano con \*(lq\-\*(rq.
-Questo assicura una coerenza con le convenzioni di esame degli argomenti
-usato dalla maggior parte dei programmi \*(PX .
.PP
-In modalità compatibile, qualsiasi altra opzione è contrassegnata come non
+In modalità compatibile, qualsiasi altra opzione è contrassegnata come non
valida e viene ignorata. Nell'uso normale, sempre che sia stato
fornito il testo del programma, le opzioni sconosciute sono passate al programma
\*(AK nel vettore
.B ARGV
-per l'elaborazione. Questo è particolarmente utile per eseguire i programmi
-\*(AK attraverso il meccanismo dell'interprete eseguibile
-.BR #! .
+per l'elaborazione.
.PP
-Per compatibilità con \*(PX, si può usare l'opzione
+Per compatibilità con \*(PX, si può usare l'opzione
.BR \-W ,
seguita dal nome di un'opzione lunga.
.SH ESECUZIONE DEL PROGRAMMA AWK
@@ -644,25 +430,21 @@ Le opzioni
.B \-f
e
.B \-\^\-source
-possono essere usate più volte nella riga di comando.
+possono essere usate più volte nella riga di comando.
.I Gawk
legge il testo del programma come se tutti i
.I file_di_programma
-e i testi sorgenti della riga di comando fossero concatenati. Questo permette
-di realizzare librerie di funzioni \*(AK senza bisogno di includerle in ogni
-nuovo programma \*(AK che le usi; inoltre si possono combinare funzioni di
-libreria con programmi provenienti dalla riga di comando.
+e i testi sorgenti della riga di comando fossero concatenati.
.PP
-Oltre a ciò, le righe che iniziano con
+Oltre a ciò, le righe che iniziano con
.B @include
-possono essere usate per includere altri file sorgenti nel programma,
-rendendo l'uso della libreria ancora più facile. Questo è equivalente
-all'uso dell'opzione
+possono essere usate per includere altri file sorgenti nel vostro programma.
+Ciò equivale a usare l'opzione
.BR \-\^\-include .
.PP
Le righe che iniziano con
.B @load
-possono essere usate per caricare funzioni di estensione nel programma. Questo è
+possono essere usate per caricare funzioni di estensione nel programma. Questo è
equivalente all'uso dell'opzione
.BR \-\^\-load .
.PP
@@ -673,11 +455,11 @@ indicati con le opzioni
.B \-f
e
.BR \-\^\-include .
-Se questa variabile non esiste, il percorso predefinito è
+Se questa variabile non esiste, il percorso predefinito è
\fB"/usr/local/share/awk"\fR
-(la directory in questione può variare a seconda di come
+(la directory in questione può variare a seconda di come
.I gawk
-è stato compilato e installato).
+è stato compilato e installato).
Se un nome di file dato con l'opzione
.B \-f
contiene un carattere \*(lq/\*(rq, non viene eseguita nessuna ricerca
@@ -688,11 +470,11 @@ La variabile d'ambiente
specifica il percorso lungo il quale cercare i file sorgenti
indicati con l'opzione
.BR \-\^\-load .
-Se questa variabile non esiste, il percorso predefinito è
+Se questa variabile non esiste, il percorso predefinito è
\fB"/usr/local/lib/gawk"\fR
-(la directory in questione può variare a seconda di come
+(la directory in questione può variare a seconda di come
.I gawk
-è stato compilato e installato).
+è stato compilato e installato).
.PP
.I Gawk
esegue i programmi \*(AK nell'ordine seguente.
@@ -717,22 +499,17 @@ legge dallo standard input.
.PP
Se un nome di file nella riga di comando ha la forma
.IB var = val,
-è trattato come un assegnamento di variabile. Alla variabile
+è trattato come un assegnamento di variabile. Alla variabile
.I var
-sarà assegnato il valore
+sarà assegnato il valore
.I val
(questo accade dopo che ogni regola
.B BEGIN
-è stata eseguita).
-L'assegnamento di variabili da riga di comando
-è utilissima per assegnare dinamicamente valori alle variabili
-che \*(AK usa per controllare come l'input è organizzato in campi e record.
-È utile inoltre per controllare variabili di stato
-quando siano necessari più passi di elaborazione su un singolo file di dati.
+è stata eseguita).
.PP
Se il valore di un particolare elemento di
.B ARGV
-è la stringa vuota (\fB""\fR),
+è la stringa vuota (\fB""\fR),
.I gawk
lo salta.
.PP
@@ -744,13 +521,13 @@ esegue il codice associato
prima di elaborare il contenuto del file. Similarmente,
.I gawk
esegue
-il codice associato a
+il codice associato a regole
.B ENDFILE
dopo l'elaborazione del file.
.PP
Per ogni record in input,
.I gawk
-controlla se c'è corrispondenza con qualche
+controlla se c'è corrispondenza con qualche
.I "criterio di ricerca"
specificato nel programma \*(AK.
Per ogni criterio di ricerca a cui un record corrisponde,
@@ -769,12 +546,12 @@ esegue il codice nelle regola/e
Secondo POSIX, i file indicati sulla riga di comando di
.I awk
devono essere file di testo.
-Se non lo sono il comportamento è ``indefinito''. La maggior parte delle
+Se non lo sono il comportamento è ``undefined''. La maggior parte delle
versioni di
.I awk
considerano una directory sulla riga di comando come un errore fatale.
.PP
-A partire dalla versione 4.0 di
+Per
.IR gawk ,
una directory sulla riga di comando produce solo un messaggio di avvertimento,
senza conseguenze. Se sono date le opzioni
@@ -793,130 +570,53 @@ consente di avere variabili di tipo "espressione regolare".
\*(AK ha anche vettori monodimensionali; i vettori multidimensionali
possono essere simulati [da vettori monodimensionali].
.I Gawk
-fornisce veri vettori di vettori; vedere
-.BR Vettori ,
-più avanti. Al momento dell'esecuzione del programma sono impostate parecchie
-variabili predefinite; saranno descritte di volta in volta quando sarà
-necessario, ed elencate più avanti.
+fornisce veri vettori di vettori.
+All'inizio dell'esecuzione del programma vengono impostate parecchie
+variabili predefinite; saranno descritte di volta in volta quando sarà
+necessario, ed elencate più avanti.
.SS Record
-Normalmente i record sono separati dal carattere newline. Si può controllare il
+Normalmente i record sono separati dal carattere newline. Si può controllare il
modo in cui i record sono separati assegnando valori alla variabile predefinita
.BR RS .
-Se
-.B RS
-contiene un qualsiasi carattere singolo, tale carattere separa i record.
-Altrimenti, se
-.B RS
-è un'espressione regolare, il testo nell'input che corrisponde a questa
-espressione regolare sarà il separatore di record.
-Tuttavia, nella modalità compatibile
-è preso in considerazione solo il primo carattere della stringa risultante,
-come separatore.
-Se
-.B RS
-contiene la stringa nulla, i record sono separati da righe vuote.
-Quando
-.B RS
-contiene la stringa nulla, il carattere newline ha sempre la funzione
-di separatore di campo in aggiunta a quello indicato dalla variabile
-.BR FS ,
-quale che esso sia.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Records.html
+per i dettagli.
.SS Campi
-.PP
-Ogni volta che
+Ogni record letto in input è diviso da
.I gawk
-legge un record lo spezza in
+in
.IR campi ,
usando il valore della variabile
.B FS
come separatore di campo.
-Se
-.B FS
-è un carattere singolo, i campi sono separati da quel carattere.
-Se
-.B FS
-è la stringa nulla, ogni singolo carattere diventa un
-campo a sé.
-Diversamente, si presume che
-.B FS
-sia un'espressione regolare
-completa.
-Nel caso particolare in cui
-.B FS
-sia un singolo spazio, i campi sono separati da sequenze di spazi, caratteri di
-tabulazione o newline.
-.BR NOTA :
-Il valore di
-.B IGNORECASE
-(vedi più avanti) influenza anche il modo in cui i campi sono spezzati quando
-.B FS
-è un'espressione regolare, e come i record vengano separati quando
-.B RS
-è un'espressione regolare.
-.PP
-Se alla variabile
+Inoltre, le variabile
.B FIELDWIDTHS
-è assegnata una lista di numeri separati da spazi,
-ogni campo è considerato di larghezza fissa, e
-.I gawk
-spezza il record secondo le larghezze specificate.
-Ogni larghezza di campo può opzionalmente essere preceduta da
-un valore, separato da una virgola, che specifica il numero di
-caratteri da saltare prima di posizionarsi all'inizio del campo.
-Il valore di
-.B FS
-è ignorato.
-Assegnando un nuovo valore a
-.B FS
-o a
-.B FPAT
-si annulla l'effetto di
-.BR FIELDWIDTHS .
-.PP
-Similmente, se alla variabile
-.B FPAT
-è assegnata una stringa che rappresenta un'espressione regolare,
-ogni campo è composto di testo che corrisponde a quella espressione regolare.
-In questo caso, l'espressione regolare descrive i campi stessi, invece che il
-testo che separa i campi.
-Assegnando un nuovo valore a
-.B FS
-o a
-.B FIELDWIDTHS
-si annulla l'effetto di
-.BR FPAT .
+e
+.B PATH
+possono essere usate per controllare la divisione in campi dell'input.
+Vedere i dettagli, a partire da
+.IR https://www.gnu.org/software/gawk/manual/html_node/Fields.html .
.PP
-Ogni campo nel record in input può essere individuato dalla sua posizione:
+Ogni campo nel record in input può essere individuato dalla sua posizione:
.BR $1 ,
.BR $2 ,
-e così via.
+e così via.
.B $0
-è l'intero record,
+è l'intero record,
compresi eventuali spazi bianchi iniziali e finali.
-Non è necessario che i campi siano indicati da costanti:
-.RS
-.PP
-.ft B
-n = 5
-.br
-print $n
-.ft R
-.RE
-.PP
-stampa il quinto campo del record in input.
.PP
La variabile
.B NF
contiene il numero di campi nel record in input.
.PP
-Riferimenti a campi inesistenti (cioè campi dopo
+Riferimenti a campi inesistenti (cioè campi dopo
.BR $NF )
producono la stringa vuota. Tuttavia, l'assegnamento ad un campo inesistente
(per esempio
.BR "$(NF+2) = 5" )
provoca l'incremento del valore di
.BR NF ,
-crea tutti i campi intermedi assegnando loro la stringa nulla, e fa sì
+crea tutti i campi intermedi assegnando loro la stringa nulla, e fa sì
che il valore di
.B $0
sia ricalcolato utilizzando
@@ -924,7 +624,7 @@ sia ricalcolato utilizzando
per separare i campi. Riferimenti a campi con indice negativo producono un
errore fatale. Il decremento di
.B NF
-provoca la perdita dei campi di indice superiore al valore impostato, ed il
+provoca la perdita dei campi di indice superiore al valore impostato, e il
ricalcolo di
.BR $0 ,
utilizzando
@@ -940,12 +640,13 @@ provoca una nuova divisione del record, creando nuovi
valori per i suoi campi.
.SS Variabili predefinite
Le variabili predefinite di
-.IR gawk " sono:
+.IR gawk "
+sono listate qui sotto.
+La lista è volutamente concisa. Per dettagli, vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/Built_002din-Variables .
.TP "\w'\fBFIELDWIDTHS\fR'u+1n"
.B ARGC
-Il numero di argomenti da riga di comando (non include le opzioni di
-.I gawk
-o il sorgente del programma).
+Il numero di argomenti da riga di comando
.TP
.B ARGIND
L'indice in
@@ -953,43 +654,24 @@ L'indice in
del file correntemente in elaborazione.
.TP
.B ARGV
-Vettore degli argomenti della riga di comando. Il vettore è indicizzato da
+Vettore degli argomenti della riga di comando. Il vettore è indicizzato da
0 ad
.B ARGC
\- 1.
-La modifica dinamica del contenuto di
-.B ARGV
-può controllare i file usati per i dati.
.TP
.B BINMODE
-Su sistemi non-POSIX, specifica l'uso della modalità \*(lqbinaria\*(rq per tutti
-i file I/O. I valori numerici 1, 2 e 3 specificano che i file di input, i file
-di output e tutti i file, rispettivamente, dovrebbero usare I/O binari. I
-valori di stringa \fB"r"\fR e \fB"w"\fR specificano che i file di input e i file
-di output, rispettivamente, dovrebbero usare I/O binari. I valori di stringa
-\fB"rw"\fR e \fB"wr"\fR specificano che tutti i file dovrebbero usare I/O
-binari. Qualsiasi altro valore di stringa è trattato come \fB"rw"\fR, ma genera
-un messaggio di avvertimento.
+Su sistemi non-POSIX, specifica l'uso della modalità \*(lqbinaria\*(rq per tutto
+l'I/O da e verso i file.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/PC-Using.html
+per i dettagli.
.TP
.B CONVFMT
-Il formato di conversione dei numeri, quello predefinito è \fB"%.6g"\fR.
+Il formato di conversione dei numeri, quello predefinito è \fB"%.6g"\fR.
.TP
.B ENVIRON
-Un vettore contenente i valori dell'ambiente corrente. Il vettore è indicizzato
-dalle variabili d'ambiente, e ogni elemento è il valore di quella variabile
-(per esempio, \fBENVIRON["HOME"]\fP potrebbe essere
-\fB"/home/arnold"\fR).
-.sp
-In modalità POSIX,
-la modifica di questo vettore non ha effetto sull'ambiente ereditato dai
-programmi che
-.I gawk
-esegue per ridirezione o tramite la funzione
-.BR system() .
-Altrimenti,
-.I gawk
-aggiorna il suo ambiente reale in modo che i programmi che eredita vedano
-le modifiche.
+Un vettore contenente i valori dell'ambiente corrente. Il vettore è indicizzato
+dalle variabili d'ambiente, e ogni elemento è il valore di quella variabile.
.TP
.B ERRNO
Se ha luogo un errore di sistema durante una ridirezione per una
@@ -1001,39 +683,27 @@ oppure in una
.B ERRNO
viene impostato a
una stringa che descrive l'errore.
-Il valore è passibile di traduzione nelle localizzazioni diverse dall'inglese.
-Se la stringa in
-.B ERRNO
-corrisponde a un errore di sistema descritto nella variabile
-.IR errno (3) ,
-il corrispondente valore numerico può essere trovato in
-.B PROCINFO["errno"].
-Per errori non di sistema, l'elemento
-.B PROCINFO["errno"]
-varrà zero.
+Il valore è passibile di traduzione nelle localizzazioni diverse dall'inglese.
.TP
.B FIELDWIDTHS
Una lista di dimensioni di campo separate da spazi. Se impostato,
.I gawk
-suddivide l'input secondo campi di larghezza fissa, anziché usare il valore
+suddivide l'input secondo campi di larghezza fissa, anziché usare il valore
della variabile
.B FS
come separatore di campo.
-Ogni larghezza di campo può opzionalmente essere preceduta da
+Ogni larghezza di campo può opzionalmente essere preceduta da
un valore, separato da una virgola, che specifica il numero di
caratteri da saltare prima di posizionarsi all'inizio del campo.
-Si veda
-.BR Campi ,
-più sopra.
.TP
.B FILENAME
Il nome del file di input corrente.
Se non sono specificati file nella riga di comando, il valore di
.B FILENAME
-è \*(lq\-\*(rq.
+è \*(lq\-\*(rq.
Tuttavia,
.B FILENAME
-è indefinito all'interno della regola
+è indefinito all'interno della regola
.B BEGIN
(a meno che non sia impostato da
.BR getline ).
@@ -1051,86 +721,34 @@ all'espressione regolare, invece di usare il
valore di
.B FS
come separatore di campo.
-Si veda
-.BR Campi ,
-più sopra.
.TP
.B FS
-Il separatore di campo, quello predefinito è uno spazio. Si veda
-.BR Campi ,
-più sopra.
+Il separatore di campo, quello predefinito è uno spazio.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Field-Separators.html
+per i dettagli.
.TP
.B FUNCTAB
Un vettore i cui indici e i corrispondenti valori
sono i nomi di tutte le funzioni definite dall'utente
o funzioni di estensione presenti nel programma.
.BR NOTA :
-Si può non usare l'istruzione
+Si può non usare l'istruzione
.B delete
applicandola al vettore
.BR FUNCTAB .
.TP
.B IGNORECASE
-Controlla la sensibilità alla distinzione tra maiuscole e minuscole
-in tutte le espressioni regolari e nelle operazioni sulle stringhe. Se
-.B IGNORECASE
-ha un valore diverso da zero, il confronto di stringhe e
-la ricerca di corrispondenze nei criteri di ricerca,
-la separazione di campi tramite
-.B FS
-e
-.BR FPAT ,
-la separazione di record tramite
-.BR RS ,
-la ricerca di corrispondenze nelle espressioni regolari
-con
-.B ~
-e
-.BR !~ ,
-e le funzioni predefinite
-.BR gensub() ,
-.BR gsub() ,
-.BR index() ,
-.BR match() ,
-.BR patsplit() ,
-.BR split() ,
-e
-.B sub()
-ignoreranno tutti la differenza tra maiuscole e minuscole nelle
-operazioni con le espressioni regolari.
-.BR NOTA :
-.I Non
-ha effetto sugli indici dei vettori.
-Tuttavia, sulle funzioni
-.B asort()
-e
-.B asorti()
-ha effetto.
-.sp .5
-Così, se
-.B IGNORECASE
-è diverso da zero,
-.B /aB/
-corrisponde a tutte queste stringhe : \fB"ab"\fP, \fB"aB"\fP, \fB"Ab"\fP,
-e \fB"AB"\fP.
-Come per tutte le variabili di \*(AK, il valore iniziale di
-.B IGNORECASE
-è zero, cosicché tutte le operazioni sulle espressioni regolari
-e su stringhe normalmente distinguono tra maiuscole e minuscole.
+Controlla la sensibilità alla distinzione tra maiuscole e minuscole
+in tutte le espressioni regolari e nelle operazioni sulle stringhe.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Case_002dsensitivity.html
+per i dettagli.
.TP
.B LINT
Fornisce un controllo dinamico dell'opzione
.B \-\^\-lint
dall'interno di un programma \*(AK.
-Quando il valore è "vero",
-.I gawk
-stampa avvertimenti lint. Quando è "falso", no.
-I valori specificabili con l'opzione
-.B \-\^\-lint
-possono anche essere assegnati alla variabile d'ambiente
-.BR LINT ,
-e hanno gli stessi effetti.
-Qualsiasi altro valore "vero" stampa solo avvertimenti.
.TP
.B NF
Il numero di campi nel record corrente.
@@ -1139,10 +757,10 @@ Il numero di campi nel record corrente.
Il numero totale di record incontrati finora.
.TP
.B OFMT
-Il formato d'uscita per i numeri, quello predefinito è \fB"%.6g"\fR.
+Il formato d'uscita per i numeri, quello predefinito è \fB"%.6g"\fR.
.TP
.B OFS
-Il separatore di campi in uscita, normalmente è uno spazio.
+Il separatore di campi in uscita, normalmente è uno spazio.
.TP
.B ORS
Il separatore di record in uscita, normalmente
@@ -1150,284 +768,24 @@ la sequenza di fine linea ("\fInewline\fR").
.TP
.B PREC
La precisione di lavoro di numeri a virgola mobile con precisione arbitraria,
-53 [bit] è il valore predefinito.
+53 [bit] è il valore predefinito.
.TP
.B PROCINFO
Gli elementi di questo vettore forniscono accesso alle informazioni
sul programma \*(AK in esecuzione.
-Su alcuni sistemi,
-ci possono essere elementi nel vettore, da \fB"gruppo1"\fP a
-\fB"gruppo\fIn\fB"\fR per qualsiasi
-.IR n ,
-che è il numero di gruppi supplementari che ha il processo.
-Usare l'operatore
-.B in
-per verificare la presenza di questi elementi.
-I seguenti elementi sono sicuramente disponibili:
-.RS
-.TP \w'\fBPROCINFO["strftime"]\fR'u+1n
-\fBPROCINFO["argv"]\fP
-Gli argomenti sulla riga di comando come sono visti da
-.I gawk
-a livello di linguaggio C.
-Gli indici partono dallo zero.
-.TP
-\fBPROCINFO["egid"]\fP
-Il valore della chiamata di sistema
-.IR getegid (2).
-.TP
-\fBPROCINFO["errno"]\fP
-Il valore di
-.IR errno (3)
-quando
-.B ERRNO
-è impostato al messaggio di errore associato.
-.TP
-\fBPROCINFO["euid"]\fP
-Il valore della chiamata di sistema
-.IR geteuid (2).
-.TP
-\fBPROCINFO["FS"]\fP
-\fB"FS"\fP se la separazione in campi con
-.B FS
-è attiva,
-\fB"FPAT"\fP se la separazione in campi con
-.B FPAT
-è attiva,
-\fB"FIELDWIDTHS"\fP se la separazione in campi con
-.B FIELDWIDTHS
-è attiva,
-o \fB"API"\fP se la separazione in campi con l'analizzatore di input API
-è attiva.
-.TP
-\fBPROCINFO["gid"]\fP
-Il valore della chiamata di sistema
-.IR getgid (2).
-.TP
-\fBPROCINFO["identifiers"]\fP
-Un sottovettore, avente come indici i nomi di tutti gli identificatori usati
-nel testo del programma AWK.
-I valori indicano quello che
-.I gawk
-conosce degli identificatori dopo aver finito di analizzare il programma;
-essi
-.I non
-sono aggiornati durante l'esecuzione del programma.
-Per ogni identificatore, il valore dell'elemento è uno fra questi:
-.RS
-.TP \w'\fB"extension"\fR'u+1n
-\fB"array"\fR
-L'identificatore è un vettore.
-.TP
-\fB"builtin"\fR
-L'identificatore è una funzione predefinita.
-.TP
-\fB"extension"\fR
-L'identificatore è una funzione di estensione caricata con
-.B @load
-o
-.BR \-\^\-load .
-.TP
-\fB"scalar"\fR
-L'identificatore è uno scalare.
-.TP
-\fB"untyped"\fR
-L'identificatore non è classificato (potrebbe essere usato come scalare
-o come vettore,
-.I gawk
-ancora non lo sa).
-.TP
-\fB"user"\fR
-L'identificatore è una funzione definita dall'utente.
-.RE
-.TP
-\fBPROCINFO["pgrpid"]\fP
-Il valore dalla chiamata di sistema
-.IR getpgrp (2).
-.TP
-\fBPROCINFO["pid"]\fP
-Il valore dalla chiamata di sistema
-.IR getpid (2).
-.TP
-\fBPROCINFO["platform"]\fP
-Una stringa che indica la piattaforma sulla quale
-.I gawk
-è stato compilato. Può essere una delle alternative seguenti:
-.RS
-.TP
-\fB"djgpp"\fR, \fB"mingw"\fR
-Microsoft Windows, compilato tramite DJGPP o MinGW, rispettivamente.
-.TP
-\fB"os2"\fR
-OS/2.
-.TP
-\fB"posix"\fR
-GNU/Linux, Cygwin, Mac OS X, e i sistemi Unix precedenti.
-.TP
-\fB"vms"\fR
-OpenVMS o Vax/VMS.
-.RE
-.TP
-\fBPROCINFO["ppid"]\fP
-Il valore della chiamata di sistema
-.IR getppid (2).
-.TP
-\fBPROCINFO["strftime"]\fP
-La stringa di formato data/ora predefinita per
-.BR strftime() .
-Cambiandone il valore cambia anche il modo con cui
-.B strftime()
-visualizza i valori di data e ora se chiamata senza specificare argomenti.
-.TP
-\fBPROCINFO["uid"]\fP
-Il valore della chiamata di sistema
-.IR getuid (2).
-.TP
-\fBPROCINFO["version"]\fP
-La versione di
-.IR gawk .
-.PP
-I seguenti elementi sono presenti se è disponibile il caricamento delle
-estensioni dinamiche.
-.TP
-\fBPROCINFO["api_major"]\fP
-La versione principale dell'estensione API.
-.TP
-\fBPROCINFO["api_minor"]\fP
-La versione secondaria dell'estensione API.
-.PP
-I seguenti elementi sono disponibili se il supporto MPFR è stato
-compilato in
-.IR gawk\^ :
-.TP
-\fBPROCINFO["gmp_version"]\fP
-La versione della libreria GNU GMP usata per il supporto ai numeri
-con precisione arbitraria in
-.IR gawk .
-.TP
-\fBPROCINFO["mpfr_version"]\fP
-La versione della libreria GNU MPFR usata per il supporto ai numeri
-con precisione arbitraria in
-.IR gawk .
-.TP
-\fBPROCINFO["prec_max"]\fP
-La massima precisione supportata dalla libreria GNU MPFR per i
-numeri a virgola mobile con precisione arbitraria.
-.TP
-\fBPROCINFO["prec_min"]\fP
-La minima precisione supportata dalla libreria GNU MPFR per i
-numeri a virgola mobile con precisione arbitraria.
-.PP
-I seguenti elementi possono essere impostati da un programma per
-cambiare il comportamento di
-.IR gawk :
-.TP
-\fBPROCINFO["NONFATAL"]\fR
-Se presente, gli errori di I/O per tutte le ridirezioni
-diventano non fatali.
-.TP
-\fBPROCINFO["\fInome\fB", "NONFATAL"]\fR
-Rende gli errori relativi a
-.I nome
-non fatali.
-.TP
-\fBPROCINFO["\fIcomando\fB", "pty"]\fR
-Usa una pseudo-tty per una comunicazione bidirezionale con
-.I comando
-invece di impostare due "pipe" unidirezionali.
-.TP
-\fBPROCINFO["\fIinput\fB", "READ_TIMEOUT"]\fR
-Il tempo massimo a disposizione in millisecondi per leggere i dati da
-.IR input ,
-dove
-.I input
-è una stringa di ridirezione o un nome di file. Un valore di zero o
-o minore di zero significa nessun limite di tempo.
-.TP
-\fBPROCINFO["\fIinput\^\fB", "RETRY"]\fR
-Se un errore di I/O non fatale si verifica leggendo dati da un file di
-.IR input ,
-e questo elemento di vettore esiste,
-.B getline
-restituisce \-2 invece di restituire il valore previsto di \-1
-e di configurare
-.I l'input
-in modo da non fornire ulteriori dati.
-Un errore di I/O non fatale si verifica quando
-.IR errno (3)
-ha il valore EAGAIN, EWOULDBLOCK, EINTR o ETIMEDOUT.
-Questo può tornare utile nel caso si utilizzi
-\fBPROCINFO["\fIinput\^\fB", "READ_TIMEOUT"]\fR
-o in situazioni in cui un descrittore di file è stato configurato in modo
-da non bloccarsi in caso di errore.
-.TP
-\fBPROCINFO["sorted_in"]\fP
-Se questo elemento esiste in
-.BR PROCINFO ,
-il suo valore controlla l'ordine in cui gli elementi del vettore
-sono attraversati nei cicli
-.BR for .
-I valori supportati sono
-\fB"@ind_str_asc"\fR,
-\fB"@ind_num_asc"\fR,
-\fB"@val_type_asc"\fR,
-\fB"@val_str_asc"\fR,
-\fB"@val_num_asc"\fR,
-\fB"@ind_str_desc"\fR,
-\fB"@ind_num_desc"\fR,
-\fB"@val_type_desc"\fR,
-\fB"@val_str_desc"\fR,
-\fB"@val_num_desc"\fR,
-e
-\fB"@unsorted"\fR.
-Il valore può essere anche il nome (come
-.IR stringa )
-di una qualsiasi funzione di confronto
-definita nel seguente modo:
-.sp
-.in +5m
-\fBfunction cmp_func(i1, v1, i2, v2)\fR
-.in -5m
-.sp
-dove
-.I i1
-e
-.I i2
-sono gli indici, e
-.I v1
-e
-.I v2
-sono i valori corrispondenti dei due elementi che si stanno confrontando.
-Dovrebbe restituire un numero minore, uguale o maggiore di 0, a seconda di come
-devono essere ordinati gli elementi del vettore.
-.TP
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset
+per i dettagli.
.TP
.B ROUNDMODE
-La modalità di arrotondamento da usare per operazioni sui numeri con precisione
-arbitraria, quella predefinita è \fB"N"\fR (IEEE-754 roundTiesToEven mode).
-Sono accettati i valori:
-.RS
-.TP
-\fB"A"\fR o \fB"a"\fR
-per arrotondamento lontano da zero (per eccesso).
-Questi valori sono disponibili solo se la versione della libreria GNU MPFR
-supporta gli arrotondamenti lontano da zero.
-.TP "\w'\fB\(dqD\(dq\fR o \fB\(dqd\(dq\fR'u+1n"
-\fB"D"\fR o \fB"d"\fR
-per roundTowardNegative.
-.TP
-\fB"N"\fR o \fB"n"\fR
-per roundTiesToEven.
-.TP
-\fB"U"\fR o \fB"u"\fR
-per roundTowardPositive.
-.TP
-\fB"Z"\fR o \fB"z"\fR
-per roundTowardZero.
-.RE
+La modalità di arrotondamento da usare per operazioni sui numeri con precisione
+arbitraria, quella predefinita è \fB"N"\fR (IEEE-754 roundTiesToEven mode).
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Setting-the-rounding-mode
+per i dettagli.
.TP
.B RS
-Il separatore di record in input (se non specificato è "newline").
+Il separatore di record in input, per default "newline".
.TP
.B RT
Il terminatore di record.
@@ -1442,7 +800,6 @@ regolare indicati in
L'indice del primo carattere trovato da
.BR match() ,
oppure 0 se non ci sono corrispondenze
-(questo implica che gli indici dei caratteri inizino da uno).
.TP
.B RLENGTH
La lunghezza della stringa trovata da
@@ -1451,30 +808,12 @@ oppure \-1 se non ci sono corrispondenze.
.TP
.B SUBSEP
La stringa usata per separare indici multipli negli elementi di un vettore,
-quella predefinita è \fB"\e034"\fR.
+quella predefinita è \fB"\e034"\fR.
.TP
.B SYMTAB
Un vettore i cui indici sono i nomi di tutti i vettori e le variabili
-globali attualmente definite presenti nel programma. Il vettore può essere
-usato per l'accesso indiretto in lettura e scrittura del valore di una
-variabile:
-.sp
-.ft B
-.nf
-.in +5m
-foo = 5
-SYMTAB["foo"] = 4
-print foo # stampa 4
-.fi
-.ft R
-.in -5m
-.sp
-La funzione
-.B typeof()
-può essere usata per controllare se un elemento in
-.B SYMTAB
-è un vettore.
-Non è possibile usare l'istruzione
+globali attualmente definite presenti nel programma.
+Non è possibile usare l'istruzione
.B delete
per il vettore
.B SYMTAB
@@ -1487,13 +826,13 @@ localizzate delle stringhe del programma.
.SS Vettori
I vettori hanno per indice un'espressione tra parentesi quadre
.RB ( [ " e " ] ).
-Se l'espressione è formata da una lista di espressioni
+Se l'espressione è formata da una lista di espressioni
.RI ( expr ", " expr " .\|.\|.)"
-l'indice del vettore è una stringa ottenuta concatenando
+l'indice del vettore è una stringa ottenuta concatenando
i valori (stringa) di ogni espressione, separati dal valore della
variabile
.BR SUBSEP .
-Questa modalità è usata per simulare vettori multidimensionali.
+Questa modalità è usata per simulare vettori multidimensionali.
Per esempio:
.PP
.RS
@@ -1506,12 +845,12 @@ x[i, j, k] = "hello, world\en"
.PP
assegna la stringa \fB"hello,\ world\en"\fR all'elemento del vettore
.B x
-che è indicizzato dalla stringa \fB"A\e034B\e034C"\fR. In \*(AK, tutti i
-vettori sono associativi, cioè indicizzati da valori di tipo stringa.
+che è indicizzato dalla stringa \fB"A\e034B\e034C"\fR. In \*(AK, tutti i
+vettori sono associativi, cioè indicizzati da valori di tipo stringa.
.PP
L'operatore speciale
.B in
-può essere usato per controllare se un vettore contiene un certo valore
+può essere usato per controllare se un vettore contiene un certo valore
come indice.
.PP
.RS
@@ -1528,7 +867,7 @@ Se il vettore ha indici multipli, si usi
.PP
Il costrutto
.B in
-può anche essere usato in un ciclo
+può anche essere usato in un ciclo
.B for
per iterare su tutti gli elementi di un vettore.
Comunque, il costrutto
@@ -1536,41 +875,22 @@ Comunque, il costrutto
funziona solo nelle verifiche, non nei cicli
.BR for .
.PP
-Un elemento di un vettore può essere cancellato con l'istruzione
+Un elemento di un vettore può essere cancellato con l'istruzione
.BR delete .
L'istruzione
.B delete
-può anche essere usata per cancellare l'intero contenuto di un vettore,
+può anche essere usata per cancellare l'intero contenuto di un vettore,
basta specificare il nome del vettore stesso senza indici.
.PP
.I gawk
supporta veri vettori multidimensionali. Non richiede che
tali vettori siano ``rettangolare'' come in C or C++.
-Per esempio:
-.sp
-.RS
-.ft B
-.nf
-a[1] = 5
-a[2][1] = 6
-a[2][2] = 7
-.fi
-.ft
-.RE
-.PP
-.BR NOTA :
-Si potrebbe aver necessità di dire a
-.I gawk
-che un elemento di un vettore è in realtà un sottovettore per usarlo dove
-.I gawk
-si aspetta di trovare un vettore (come nel secondo argomento di
-.BR split() ).
-Si può fare questo creando un elemento nel sottovettore e cancellandolo
-poi con l'istruzione
-.BR delete .
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Arrays
+per i dettagli.
.SS Spazi-dei-nomi
.I Gawk
-fornisce una semplice funzionalità,
+fornisce una semplice funzionalità,
.IR namespace ,
(spazio-dei-nomi) per ovviare al fatto che tutte le variabili in
AWK sono globali.
@@ -1580,16 +900,16 @@ Un
consiste di due identificativi semplici, congiunti da una coppia di due punti
.RB ( :: ).
Il primo dei due identificativi designa lo spazio-dei-nomi (namespace)
-mentre il secondo è il nome della variabile al suo interno.
+mentre il secondo è il nome della variabile al suo interno.
Tutti i nomi semplici (non qualificati) sono considerati come appartenenti
allo spazio-dei-nomi ``corrente''; lo spazio-dei-nomi predefinito ha nome
.BR awk .
Comunque, gli identificativi i cui nomi sono composti solo da lettere
maiuscole, vengono sempre considerati come facenti parte dello spazio-dei-nomi
.BR awk ,
-anche se lo spazio-dei-nomi corrente è diverso da quello predefinito.
+anche se lo spazio-dei-nomi corrente è diverso da quello predefinito.
.PP
-Si può cambiare lo spazio-dei-nomi corrente tramite la direttiva
+Si può cambiare lo spazio-dei-nomi corrente tramite la direttiva
\fB@namespace "\fInome\^\fB"\fR.
.PP
I nomi delle funzioni interne predefinite non possono essere usati come
@@ -1597,14 +917,15 @@ nomi di uno spazio-dei-nomi. I nomi di ulteriori funzioni, fornite da
.I gawk
possono essere usati come nomi di uno spazio-dei-nomi o come semplici
identificativi in altri spazi-dei-nomi.
-Per ulteriori dettagli, vedere \*(EP.
+Per ulteriori dettagli, vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/Namespaces.html#Namespaces .
.SS Notazione e conversione delle variabili
Le variabili e i campi
possono essere numeri (in virgola mobile), stringhe, o entrambe le cose.
Possono anche essere espressioni regolari.
Come sia interpretato il valore di una variabile dipende dal contesto.
-In un'espressione numerica, sarà trattato come un numero; usato come
-stringa, sarà trattato come tale.
+In un'espressione numerica, sarà trattato come un numero; usato come
+stringa, sarà trattato come tale.
.PP
Per far trattare una variabile come numero, le si sommi zero; per ottenere
che venga trattata come come stringa, le si concateni la stringa nulla.
@@ -1613,51 +934,27 @@ Le variabili non inizializzate hanno sia il valore numerico zero che il
valore di stringa "" (la stringa nulla, o vuota).
.PP
Quando una stringa deve essere convertita in un numero, la conversione
-è compiuta con
+è compiuta con
.IR strtod (3).
I numeri sono convertiti a stringhe usando
.IR sprintf (3)
col valore di
.B CONVFMT
come stringa di formato
-ed il valore numerico della variabile come argomento.
+e il valore numerico della variabile come argomento.
Tuttavia, anche se tutti i numeri in \*(AK sono in virgola mobile ("float"),
i valori privi di decimali sono
.I sempre
-convertiti in numeri interi. Così, dati
-.PP
-.RS
-.ft B
-.nf
-CONVFMT = "%2.2f"
-a = 12
-b = a ""
-.fi
-.ft R
-.RE
-.PP
-la variabile
-.B b
-ha un valore di tipo stringa di \fB"12"\fR e non \fB"12.00"\fR.
+convertiti in numeri interi.
.PP
-.BR NOTA :
-Quando si opera in modalità POSIX (come con l'opzione
-.BR \-\^\-posix ),
-bisogna fare attenzione che le impostazioni per la localizzazione possono
-interferire col modo in cui sono trattati i numeri decimali: il separatore
-decimale dei numeri che si forniscono a
-.I gawk
-deve essere conforme a quello che si aspetta la localizzazione in uso, che sia
-un punto (.) o una virgola (,).
-
.I Gawk
esegue i confronti nel modo seguente:
Se due variabili sono numeriche, sono confrontate numericamente.
-Se una è numerica e l'altra è una stringa interpretabile come
+Se una è numerica e l'altra è una stringa interpretabile come
\*(lqstringa numerica,\*(rq
sono pure confrontate numericamente.
Negli altri casi, gli eventuali valori numerici sono convertiti in stringhe,
-ed è eseguito un confronto tra stringhe.
+ed è eseguito un confronto tra stringhe.
Ovviamente, due stringhe sono confrontate come stringhe.
.PP
Si noti che le costanti stringa, come \fB"57"\fP,
@@ -1672,12 +969,12 @@ agli elementi di
.B ARGV
di
.BR ENVIRON ,
-ed agli elementi di un vettore creato da
+e agli elementi di un vettore creato da
.B split()
o da
.B patsplit()
che abbiano le caratteristiche di una stringa numerica.
-L'idea fondamentale è che i dati
+L'idea fondamentale è che i dati
.IR "immessi dall'utente" ,
e solo essi, se risultano essere numerici,
saranno trattati come numeri.
@@ -1686,73 +983,25 @@ Nel codice sorgente del programma si possono usare costanti ottali ed
esadecimali in stile C.
Per esempio, il valore ottale
.B 011
-è uguale al decimale
+è uguale al decimale
.BR 9 ,
e il valore esadecimale
.B 0x11
-è uguale al decimale 17.
+è uguale al decimale 17.
.SS Costanti di tipo stringa
Le costanti stringa in \*(AK sono sequenze di caratteri racchiusi tra
doppi apici (come \fB"valore"\fR). All'interno delle stringhe, sono riconosciute alcune
.IR "sequenze di protezione" ,
-come in in C. Queste sono:
-.TP "\w'\fB\e\^\fIddd\fR'u+1n"
-.B \e\e
-Una barra inversa letterale.
-.TP
-.B \ea
-Il carattere \*(lqalert\*(rq; in genere il carattere \s-1ASCII\s+1 \s-1BEL\s+1.
-.TP
-.B \eb
-Tasto di cancellazione all'indietro (backspace).
-.TP
-.B \ef
-Salto pagina (form-feed).
-.TP
-.B \en
-Nuova riga (newline).
-.TP
-.B \er
-Ritorno carrello (CR).
-.TP
-.B \et
-Tabulazione orizzontale.
-.TP
-.B \ev
-Tabulazione verticale.
-.TP
-.BI \ex "\^cifre_esa"
-Il carattere rappresentato dalla stringa di cifre esadecimali
-dopo la
-.BR \ex .
-Fino a due
-cifre esadecimali che seguono sono considerate parte
-della sequenza di protezione.
-Per esempio, \fB"\ex1B"\fR è il carattere \s-1ASCII\s+1 \s-1ESC\s+1 (escape).
-.TP
-.BI \e ddd
-Il carattere rappresentato da una sequenza di 3 cifre ottali.
-Per esempio, \fB"\e033"\fR è il carattere \s-1ASCII\s+1 \s-1ESC\s+1 (escape).
-.TP
-.BI \e c
-Il carattere letterale
-.IR c\^ .
-.PP
-In modalità compatibile, i caratteri rappresentati da sequenze di protezione
-ottali ed esadecimali sono trattati letteralmente, se usati in costanti
-costituite da espressioni regolari. Così,
-.B /a\e52b/
-è equivalente a
-.BR /a\e*b/ .
+come in C.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Escape-Sequences
+per i dettagli.
.SS Costanti di tipo Regexp
-Una costante di tipo espressione regolare è una sequenza di caratteri
+Una costante di tipo espressione regolare è una sequenza di caratteri
racchiusa tra barre (come
.BR /valore/ ).
-Come stabilire una corrispondenza con un'espressione regolare è
-descritto in maniera più dettagliata più avanti; vedere
-.BR "Espressioni regolari" .
.PP
-Le sequenze di protezione descritte sopra si possono usare anche
+Le sequenze di protezione descritte nel manuale si possono usare anche
all'interno di costanti che sono espressioni regolari
(p.es.,
.B "/[\ \et\ef\en\er\ev]/"
@@ -1763,20 +1012,20 @@ consente anche di usare costanti formate da espressioni regolari
.IR "fortemente tipizzate" .
I nome di tali costanti sono preceduti da un simbolo
.B @
-(così:
+(così:
.BR @/valore/ ).
Queste costanti possono essere assegnare a scalari (variabili,
elementi di un vettore) e passate a funzione definite dall'utente.
-Le variabili il cui valore è stato assegnato in questo modo
+Le variabili il cui valore è stato assegnato in questo modo
hanno come tipo quello di variabili di espressioni regolari.
.SH CRITERI DI RICERCA E AZIONI
-\*(AK è un linguaggio che procede per righe. Il criterio va a inizio riga,
+\*(AK è un linguaggio che procede per righe. Il criterio va a inizio riga,
l'azione lo segue. Le istruzioni dell'azione sono racchiuse tra
.B {
e
.BR } .
Sia il criterio che l'azione possono mancare ma, naturalmente, non entrambi.
-Se manca il criterio, l'azione è eseguita per ogni record in input.
+Se manca il criterio, l'azione è eseguita per ogni record in input.
Omettere invece l'azione equivale a specificare
.RS
.PP
@@ -1804,15 +1053,15 @@ Anche le istruzioni in righe terminanti con
o
.B else
continuano automaticamente alla riga successiva.
-Negli altri casi, un'istruzione può continua sulla riga successiva
-se termina con \*(lq\e\*(rq, nel qual caso il "newline" è ignorato.
+Negli altri casi, un'istruzione può continua sulla riga successiva
+se termina con \*(lq\e\*(rq, nel qual caso il "newline" è ignorato.
Comunque, un \*(lq\e\*(rq che venga dopo un carattere
.B #
-non è speciale.
+non è speciale.
.PP
-Si possono scrivere più istruzioni sulla stessa riga separandole con
+Si possono scrivere più istruzioni sulla stessa riga separandole con
\*(lq;\*(rq.
-Questo si applica sia alle istruzioni all'interno di un'azione (il caso più
+Questo si applica sia alle istruzioni all'interno di un'azione (il caso più
comune), sia ai gruppi criterio-azione stessi.
.SS Criteri di ricerca
I criteri di ricerca di \*(AK possono assumere le forme seguenti:
@@ -1848,7 +1097,7 @@ e sono eseguite prima che sia letto qualsiasi input.
Allo stesso modo, tutte le regole
.B END
sono fuse insieme, ed eseguite dopo che tutti i dati in input sono
-terminati o dopo che si è incontrata l'istruzione
+terminati o dopo che si è incontrata l'istruzione
.BR exit .
.B BEGIN
e
@@ -1870,7 +1119,7 @@ All'interno della regola
.BR BEGINFILE ,
il valore di
.B ERRNO
-è una stringa vuota se il file è stato aperto con successo.
+è una stringa vuota se il file è stato aperto con successo.
Altrimenti, in caso di problemi col file il codice dovrebbe usare
.B nextfile
per saltarlo. Se non lo fa,
@@ -1879,17 +1128,19 @@ emette il solito errore fatale per i file che non possono essere aperti.
.PP
Per i criteri del tipo
.BI / "espressione regolare" /
-l'azione associata è eseguita per ogni record in input che corrisponde
+l'azione associata è eseguita per ogni record in input che corrisponde
all'espressione regolare.
Le espressioni regolari hanno la stessa forma di quelle di
.IR egrep (1),
-e sono descritte più avanti.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Regexp.html
+per i dettagli sulle espressioni regolari
.PP
In
.RI un' "espressione relazionale"
-si può usare qualsiasi operatore definito nella sezione sulla azioni, più
-avanti. Generalmente l'espressione relazionale è utilizzata per verificare se
-certi campi siano individuati da determinate espressioni regolari.
+si può usare qualsiasi operatore definito nella sezione sulle azioni, più
+avanti. Generalmente l'espressione relazionale è utilizzata per verificare se
+certi campi sono individuati da determinate espressioni regolari.
.PP
Gli operatori
.BR && ,
@@ -1898,329 +1149,32 @@ e
.B !
sono rispettivamente l'AND logico, l'OR logico e il NOT logico. Come i loro
equivalenti del linguaggio C, sono valutati solo il numero di operandi
-strettamente necessario a decidere il risultato, a partire da quello più a sinistra
+strettamente necessario a decidere il risultato, a partire da quello più a sinistra
("short-circuit evaluation"). Sono usati per combinare espressioni di ricerca
-più semplici. Come nella maggior parte dei linguaggi, si possono usare
+più semplici. Come nella maggior parte dei linguaggi, si possono usare
parentesi per cambiare l'ordine di valutazione.
.PP
L'operatore
.B ?\^:
-è simile allo stesso operatore in C: se il primo criterio è vero,
-allora il criterio utilizzato per il test è il secondo, altrimenti
-è il terzo. Dei criteri secondo e terzo, ne è valutato sempre solo uno.
+è simile allo stesso operatore in C: se il primo criterio è vero,
+allora il criterio utilizzato per il test è il secondo, altrimenti
+è il terzo. Dei criteri secondo e terzo, ne è valutato sempre solo uno.
.PP
Un'espressione nella forma
.IB criterio1 ", " criterio2
-è detta
+è detta
.IR "criterio intervallo" .
Essa individua tutti i record a partire da quello che ha corrispondenza con
.IR criterio1 ,
fino a quello che corrisponde a
.IR criterio2 ,
-compreso. Non può essere combinata con alcun'altra espressione.
-.SS Espressioni regolari
-Le espressioni regolari sono del tipo esteso che si trova in
-.IR egrep .
-Sono composte da caratteri secondo le regole seguenti:
-.TP "\w'\fB[^\fIabc.\|.\|.\fB]\fR'u+2n"
-.I c
-Corrisponde al carattere (non speciale)
-.IR c .
-.TP
-.I \ec
-Corrisponde al carattere
-.I c
-considerato letteralmente.
-.TP
-.B .
-Corrisponde a qualsiasi carattere,
-.I compreso
-"newline".
-.TP
-.B ^
-Corrisponde all'inizio di una stringa.
-.TP
-.B $
-Corrisponde alla fine di una stringa.
-.TP
-.BI [ abc.\|.\|. ]
-Una lista di caratteri: corrisponde a uno qualsiasi dei caratteri
-.IR abc.\|.\|.\& .
-Si possono includere intervalli di caratteri separandoli con un trattino.
-Per aggiungere alla lista il carattere trattino, inserirlo all'inizio o
-alla fine della lista stessa.
-.TP
-\fB[^\fIabc.\|.\|.\fB]\fR
-Una lista di caratteri negata: corrisponde a qualsiasi carattere eccetto
-.IR abc.\|.\|.\& .
-.TP
-.IB r1 | r2
-Alternativa: corrisponde a
-.I r1
-oppure a
-.IR r2 .
-.TP
-.I r1r2
-Concatenazione: corrisponde a
-.IR r1 ,
-e poi
-.IR r2 .
-.TP
-.IB r +
-Corrisponde a una o più
-.IR r .
-.TP
-.IB r *
-Corrisponde a zero o più
-.IR r .
-.TP
-.IB r ?
-Corrisponde a zero o una
-.IR r .
-.TP
-.BI ( r )
-Raggruppamento: corrisponde a
-.IR r .
-.TP
-.PD 0
-.IB r { n }
-.TP
-.PD 0
-.IB r { n ,}
-.TP
-.PD
-.IB r { n , m }
-Uno o due numeri racchiusi tra parentesi graffe indicano una
-.IR "espressione di intervallo" .
-Se c'è un numero tra parentesi graffe, l'espressione regolare che precede
-.I r
-è ripetuta
-.I n
-volte. Se tra parentesi graffe ci sono due numeri separati da virgola,
-.I r
-è ripetuta da
-.I n
-ad
-.I m
-volte.
-Se c'è un numero seguito da una virgola,
-.I r
-è ripetuta almeno
-.I n
-volte.
-.TP
-.B \ey
-Corrisponde alla stringa vuota all'inizio o alla
-fine di una parola.
-.TP
-.B \eB
-Corrisponde alla stringa vuota all'interno di una parola.
-.TP
-.B \e<
-Corrisponde alla stringa vuota all'inizio di una parola.
-.TP
-.B \e>
-Corrisponde alla stringa vuota alla fine di una parola.
-.B \es
-Corrisponde a qualsiasi spazio vuoto.
-.TP
-.B \eS
-Corrisponde a qualsiasi carattere che non sia uno spazio vuoto.
-.TP
-.B \ew
-Corrisponde a un qualsiasi carattere che possa far parte di una parola, cioè
-lettere, numeri o trattino basso).
-.TP
-.B \eW
-Corrisponde a un qualsiasi carattere che non possa far parte di una parola.
-.TP
-.B \e`
-Corrisponde alla stringa vuota all'inizio di una stringa.
-.TP
-.B \e'
-Corrisponde alla stringa vuota alla fine di una stringa.
-.PP
-Le sequenze di protezione valide all'interno delle costanti stringa (vedere
-.BR "Costanti di tipo stringa" )
-sono ammesse anche nelle espressioni regolari.
-.PP
-Le
-.I "classi di caratteri"
-sono una nuova funzionalità introdotta nello standard \*(PX. Una classe di
-caratteri è una speciale notazione per indicare liste di caratteri accomunati
-da uno specifico attributo, dove però i caratteri veri e propri possono variare
-a seconda della nazione e del set di caratteri. Per esempio, la nozione di
-"carattere alfabetico" valida negli Stati Uniti è diversa da quella valida in
-Francia.
-.PP
-Una classe di caratteri è ammessa solo
-.I all'interno
-delle parentesi quadre di una lista di caratteri di una espressione regolare.
-Le classi di caratteri si rappresentano con
-.BR [: ,
-una parola chiave indicante la classe, e
-.BR :] .
-Queste sono le classi di caratteri definite dallo standard \*(PX:
-.TP "\w'\fB[:alnum:]\fR'u+2n"
-.B [:alnum:]
-Caratteri alfanumerici.
-.TP
-.B [:alpha:]
-Caratteri alfabetici.
-.TP
-.B [:blank:]
-Caratteri "spazio" e "tab".
-.TP
-.B [:cntrl:]
-Caratteri di controllo.
-.TP
-.B [:digit:]
-Caratteri numerici.
-.TP
-.B [:graph:]
-Caratteri che siano sia stampabili che visibili
-(uno spazio è stampabile ma non visibile, mentre
-.B a
-è entrambe le cose).
-.TP
-.B [:lower:]
-Caratteri alfabetici minuscoli.
-.TP
-.B [:print:]
-Caratteri stampabili (cioè caratteri che non siano di controllo).
-.TP
-.B [:punct:]
-Caratteri di punteggiatura (cioè caratteri che non siano né lettere,
-né cifre, né caratteri di controllo, né caratteri di spaziatura).
-.TP
-.B [:space:]
-Caratteri di spaziatura (come lo spazio, "tab", "formfeed", per citarne solo
-alcuni).
-.TP
-.B [:upper:]
-Caratteri alfabetici maiuscoli.
-.TP
-.B [:xdigit:]
-Cifre esadecimali.
-.PP
-Per fare un esempio, prima dell'introduzione dello standard \*(PX
-si sarebbe dovuto scrivere
-.B /[A\-Za\-z0\-9]/
-per individuare caratteri alfanumerici. Qualora il set di caratteri vigente
-avesse compreso altri caratteri alfanumerici, l'espressione non li avrebbe
-riconosciuti, e se il set di caratteri fosse rappresentato in modo diverso da
-\s-1ASCII\s+1, non sarebbero riconosciuti neanche i caratteri alfanumerici
-\s-1ASCII\s+1.
-Con le classi di caratteri \*(PX, si può scrivere
-.BR /[[:alnum:]]/ ,
-che troverà corrispondenza con
-i caratteri alfabetici e numerici previsti dal set di caratteri in uso,
-qualunque esso sia.
-.PP
-Nelle liste di caratteri possono comparire due sequenze speciali
-aggiuntive. Esse si applicano ai set di caratteri non \s-1ASCII\s+1, i quali
-possono comprendere sia simboli singoli (chiamati
-.IR "elementi di collazione" )
-rappresentati da più di un carattere, sia
-gruppi di caratteri tra loro equivalenti ai fini della
-.I collazione
-o dell'ordinamento.
-Per esempio, in francese una \*(lqe\*(rq semplice ed una
-\*(lqe"\h'-\w:e:u'\`\*(rq con l'accento grave sono equivalenti.
-.TP
-Simboli di collazione
-Un simbolo di collazione è un elemento di confronto costituito da più
-di un carattere racchiuso tra
-.B [.
-e
-.BR .] .
-Per esempio, se
-.B ch
-è un elemento di collazione, allora
-.B [[.ch.]]
-è l'espressione regolare che lo individua, mentre
-.B [ch]
-è un'espressione regolare che individua o il carattere
-.B c
-o il carattere
-.BR h .
-.TP
-Classi di Equivalenza
-Una classe di equivalenza è un nome, dipendente dalla localizzazione, associato
-a una lista di caratteri tra loro equivalenti. Il nome è racchiuso tra
-.B [=
-e
-.BR =] .
-Per esempio, il nome
-.B e
-potrebbe essere usato per rappresentare globalmente i caratteri
-\*(lqe\*(rq, \*(lqe\h'-\w:e:u'\'\*(rq, ed \*(lqe\h'-\w:e:u'\`\*(rq.
-In questo caso,
-.B [[=e]]
-è un'espressione regolare compatibile con uno qualsiasi dei caratteri
-.BR e ,
-.BR é ,
-ed
-.BR è .
-.PP
-Queste funzionalità sono molto apprezzabili quando la lingua
-corrente non è l'inglese.
-Le funzioni di libreria che
-.I gawk
-usa nella valutazione di espressioni regolari
-riconoscono attualmente solo le classi di caratteri \*(PX,
-non i simboli di collazione né le classi di equivalenza.
-.PP
-Gli operatori
-.BR \ey ,
-.BR \eB ,
-.BR \e< ,
-.BR \e> ,
-.BR \ew ,
-.BR \eW ,
-.BR \e` ,
-ed
-.B \e'
-sono specifici di
-.IR gawk ;
-queste estensioni sono possibili grazie alle facilitazioni derivanti dall'uso
-della libreria "regexp" di \*(GN.
-.PP
-Quelle che seguono sono le opzioni della riga di comando
-che controllano come
-.I gawk
-interpreta i caratteri nelle espressioni regolari.
-.TP
-Nessuna opzione
-In assenza di indicazioni,
-.I gawk
-mette a disposizione tutte le facilitazioni caratteristiche delle espressioni
-regolari \*(PX e degli operatori \*(GN descritti più sopra.
-.TP
-.B \-\^\-posix
-Sono riconosciute solo le espressioni regolari \*(PX, non gli operatori \*(GN
-(per esempio,
-.B \ew
-individua il carattere
-.BR w ).
-.TP
-.B \-\^\-traditional
-Le espressioni regolari sono valutate secondo le regole del tradizionale
-.I awk
-per \*(UK. Gli operatori \*(GN non hanno un significato speciale, e le
-espressioni di intervallo non sono disponibili.
-I caratteri descritti da sequenze ottali o esadecimali sono trattati
-letteralmente, anche se rappresentano metacaratteri di espressioni regolari.
-.TP
-.B \-\^\-re\-interval
-Sono permesse le espressioni di intervallo, anche se è stato specificato
-.BR \-\^\-traditional .
+compreso. Non può essere combinata con alcun'altra espressione.
.SS Azioni
Le istruzioni di azione sono racchiuse tra parentesi graffe,
.B {
e
.BR } .
-L'insieme delle istruzioni di azione è formato dalle solite istruzioni di
+L'insieme delle istruzioni di azione è formato dalle solite istruzioni di
assegnamento, condizionali e iterative presenti nella maggior parte
dei linguaggi. Gli operatori, le strutture di controllo e le istruzioni
di input/output ricalcano quelli corrispondenti nel linguaggio C.
@@ -2237,11 +1191,10 @@ Riferimento a campi.
Incremento e decremento, sia prefisso che suffisso.
.TP
.B ^
-Elevamento a potenza (si può anche usare \fB**\fR al suo posto, e \fB**=\fR
-nell'assegnamento con operatore).
+Elevamento a potenza.
.TP
.B "+ \- !"
-Più e meno unari, e negazione logica.
+Più e meno unari, e negazione logica.
.TP
.B "* / %"
Moltiplicazione, divisione e resto della divisione.
@@ -2264,19 +1217,6 @@ I normali operatori di relazione.
.TP
.B "~ !~"
Corrispondenza tra espressioni regolari, e nessuna corrispondenza.
-.B NOTA:
-Non usare un'espressione regolare costante
-.RB ( /foo/ )
-come operando di sinistra di
-.B ~
-o
-.BR !~ .
-Usare un'espressione regolare solo come operando di destra. L'espressione
-.BI "/foo/ ~ " exp
-equivale a richiedere \fB(($0 ~ /foo/) ~ \fIexp\fB)\fR.
-Di solito
-.I non
-è questo, quel che si vorrebbe.
.TP
.B in
Controllo di appartenenza a un vettore.
@@ -2293,9 +1233,9 @@ L'espressione condizionale in stile C. Ha la forma
\&.
Se
.I espressione1
-è vera, il valore dell'espressione è
+è vera, il valore dell'espressione è
.IR espressione2 ,
-altrimenti è
+altrimenti è
.IR espressione3 .
Viene calcolata solo una delle due espressioni
.I espressione2
@@ -2333,12 +1273,12 @@ le seguenti:
.RE
.SS "Istruzioni di I/O"
Le istruzioni di input/output sono le seguenti:
-.TP "\w'\fBprintf \fIfmt, lista-espressioni\fR'u+1n"
+.TP "\w'\fBprintf \fIformato, lista-espressioni\fR'u+1n"
\fBclose(\fIfile \fR[\fB, \fIcome\fR]\fB)\fR
-Chiude un file, una pipe o un coprocesso.
+Chiude un file, una pipe o un coprocesso aperti.
Il parametro facoltativo
.I come
-dovrebbe essere usato solo per chiudere un'estremità di una
+dovrebbe essere usato solo per chiudere un'estremità di una
pipe bi-direzionale aperta con un coprocesso.
Il valore dev'essere una stringa, o
\fB"to"\fR o \fB"from"\fR.
@@ -2397,19 +1337,24 @@ o in
.IR variabile ,
come sopra, e
.BR RT .
-I coprocessi sono un'estensione
-.IR gawk .
.RI "(Il " comando
-può anche essere un socket. Vedere la sottosezione
+può anche essere un socket. Vedere la sottosezione
.BR "Nomi di file speciali" ,
-più avanti.)
+più avanti.)
+\&\fBfflush(\fR[\fIfile\^\fR]\fB)\fR
+Scrive qualsiasi buffer associato con il file di output o la pipe
+.IR file .
+Se
+.I file
+non è specificato o è la stringa nulla,
+vengono scritti tutti i file in output e le pipe.
.TP
.B next
Cessa l'elaborazione della riga di input corrente.
Legge la successiva riga di input,
e l'elaborazione ricomincia a partire dal primo criterio di ricerca del
programma \*(AK.
-Se non ci sono più righe in input,
+Se non ci sono più righe in input,
.I gawk
esegue i comandi di ogni regola
.BR END ,
@@ -2417,7 +1362,7 @@ se presenti.
.TP
.B nextfile
Cessa l'elaborazione del file di input corrente. La prossima riga
-letta proverrà dal file di input successivo.
+letta proverrà dal file di input successivo.
Aggiorna
.B FILENAME
e
@@ -2426,7 +1371,7 @@ reimposta
.B FNR
a 1, e l'elaborazione riprende dal primo criterio di ricerca
del programma \*(AK.
-Se non ci sono più righe in input,
+Se non ci sono più righe in input,
.I gawk
esegue i comandi di ogni regola
.B ENDFILE
@@ -2441,7 +1386,7 @@ Alla fine della riga in output viene aggiunto il valore della variabile
.TP
.BI print " lista-espressioni"
Stampa le espressioni indicate.
-Ogni espressione è separata dal valore della variabile
+Ogni espressione è separata dal valore della variabile
.BR OFS .
La riga prodotta termina col valore della variabile
.BR ORS .
@@ -2449,35 +1394,26 @@ La riga prodotta termina col valore della variabile
.BI print " lista-espressioni" " >" file
Stampa le espressioni indicate su
.IR file .
-Ogni espressione è separata dal valore della variabile
+Ogni espressione è separata dal valore della variabile
.BR OFS.
La riga prodotta termina col valore della variabile
.BR ORS .
.TP
-.BI printf " fmt, lista-espressioni"
-Stampa secondo formato.
-Vedere \fBL'istruzione \fIprintf \fR, più avanti.
+.BI printf " formato, lista-espressioni"
+Stampa usando il formato specificato.
.TP
-.BI printf " fmt, lista-espressioni" " >" file
-Stampa secondo formato su
+.BI printf " formato, lista-espressioni" " >" file
+Stampa usando il formato specificato su
.IR file .
.TP
.BI system( riga-di-comando )
Esegue il comando
.IR riga-di-comando ,
e ne restituisce il valore d'uscita.
-(può non essere disponibile sui sistemi non-\*(PX).
-Si veda \*(EP per tutti i dettagli sullo stato d'uscita.
-.TP
-\&\fBfflush(\fR[\fIfile\^\fR]\fB)\fR
-Scarica il contenuto di tutti i buffer associati ai file o alle pipe
-aperti in scrittura
-.IR file .
-Se
-.I file
-non è specificato
-o ha per valore la stringa nulla,
-l'operazione è eseguita su tutti i file e le pipe aperti in scrittura.
+(può non essere disponibile sui sistemi non-\*(PX).
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/I_002fO-Functions.html#I_002fO-Functions
+per tutti i dettagli sul valore restituito dal comando eseguito.
.PP
Sono permessi anche altri tipi di ridirezione in scrittura per
.B print
@@ -2495,22 +1431,22 @@ Scrive su una pipe.
Invia dati a un coprocesso o a un socket.
(Vedere anche la sottosezione
.BR "Nomi di file speciali" ,
-più avanti).
+più avanti).
.PP
Il comando
.B getline
restituisce 1 se tutto va bene, zero in caso di fine file, e \-1 in caso di errore.
Se il valore di
.IR errno (3)
-indica che l'operazione di I/O può essere ritentata,
+indica che l'operazione di I/O può essere ritentata,
e \fBPROCINFO["\fIinput\^\fP", "RETRY"]\fR
-è stato impostato, viene restituito il valore \-2 invece che \-1 e ulteriori
+è stato impostato, viene restituito il valore \-2 invece che \-1 e ulteriori
chiamate a
.B getline
possono essere effettuate.
A fronte di un errore
.B ERRNO
-è impostato a una stringa che descrive il problema.
+è impostato a una stringa che descrive il problema.
.PP
.BR NOTA :
L'insuccesso nell'apertura di un socket bidirezionale genera un errore
@@ -2528,247 +1464,25 @@ usare
per creare una nuova istanza del comando o del socket.
\*(AK non chiude automaticamente pipe, socket, o coprocessi quando
questi restituiscono EOF.
-.SS L'istruzione \fIprintf\fP\^
+.PP
Le versioni di \*(AK dell'istruzione
.B printf
e della funzione
.B sprintf()
-(vedi più avanti)
-accettano i seguenti
-formati di richiesta conversione:
-.TP "\w'\fB%g\fR, \fB%G\fR'u+2n"
-.BR "%a" "," " %A"
-Un numero a virgola mobile nel formato
-[\fB\-\fP]\fB0x\fIh\fB.\fIhhhh\fBp+\-\fIdd\fR
-(formato esadecimale a virgola mobile di C99).
-Per
-.BR %A ,
-si usano lettere maiuscole invece che lettere minuscole.
-.TP
-.B %c
-Un singolo carattere.
-Se l'argomento usato per
-.B %c
-è numerico, è considerato come un carattere e stampato.
-Altrimenti, si suppone che l'argomento sia una stringa, e ne è stampato
-solo il primo carattere.
-.TP
-.BR "%d" "," " %i"
-Un numero decimale (solo la sua parte intera).
-.TP
-.BR %e , " %E"
-Un numero in virgola mobile nella forma
-[\fB\-\fP]\fId\fB.\fIdddddd\^\fBe\fR[\fB+\-\fR]\fIdd\fR.
-Il formato
-.B %E
-usa
-.B E
-anziché
-.BR e .
-.TP
-.BR %f , " %F"
-Un numero in virgola mobile nella forma
-[\fB\-\fP]\fIddd\fB.\fIdddddd\fR.
-Se la libreria di sistema lo supporta, il formato
-.B %F
-è pure disponibile. Si comporta come
-.BR %f ,
-ma usa lettere maiuscole per i valori speciali \*(lqnon un numero\*(rq
-e \*(lqinfinito\*(rq. Se
-.B %F
-non è disponibile
-.I gawk
-usa
-.BR %f .
-.TP
-.BR %g , " %G"
-Usa la conversione
-.B %e
-o
-.BR %f ,
-(la più corta delle due), sopprimendo gli zeri non significativi.
-Il formato
-.B %G
-usa
-.B %E
-invece che
-.BR %e .
-.TP
-.B %o
-Un numero ottale senza segno (anche questo intero).
-.TP
-.PD
-.B %u
-Un numero decimale senza segno (pure questo intero).
-.TP
-.B %s
-Una stringa di caratteri.
-.TP
-.BR %x , " %X"
-Un numero esadecimale senza segno (un intero).
-Il formato
-.B %X
-usa
-.B ABCDEF
-invece di
-.BR abcdef .
-.TP
-.B %%
-Un singolo carattere
-.BR % ;
-non c'è alcuna conversione di argomenti.
-.PP
-Alcuni ulteriori parametri facoltativi possono comparire fra il
-.B %
-e la lettera che indica il tipo di visualizzazione richiesta:
-.TP
-.IB n $
-Usa l'argomento
-.IR n-esimo
-a questo punto della formattazione.
-Questo è detto uno
-.I "specificatore posizionale"
-ed
-è pensato per usato principalmente nelle versioni tradotte delle
-stringhe di formattazione, non nel testo originale [normalmente in inglese]
-di un programma AWK. Si tratta di un'estensione
-.I gawk
-.
-.TP
-.B \-
-L'espressione va allineata a sinistra all'interno del proprio campo.
-.TP
-.I spazio
-Nelle conversioni numeriche, inserire uno spazio prima dei valori positivi,
-e un segno "meno" prima di quelli negativi.
-.TP
-.B +
-Il segno "più" usato prima del modificatore di dimensione (vedi più avanti)
-indica che nelle conversioni numeriche il segno deve essere sempre presente,
-anche se il valore da riportare è positivo.
-.B +
-annulla l'effetto del modificatore "spazio".
-.TP
-.B #
-Usa una \*(lqforma alternativa\*(rq per alcune lettere di controllo.
-Associato a
-.BR %o ,
-aggiunge uno zero iniziale.
-Con
-.BR %x ,
-e
-.BR %X ,
-aggiunge all'inizio rispettivamente
-.B 0x
-o
-.B 0X
-in caso di
-valore diverso da zero.
-Con
-.BR %e ,
-.BR %E ,
-.B %f
-e
-.BR %F ,
-il risultato conterrà sempre il
-separatore decimale.
-Con
-.BR %g ,
-e
-.BR %G ,
-gli zeri in coda non sono rimossi dal risultato.
-.TP
-.B 0
-Uno
-.B 0
-(zero) iniziale svolge una funzione di flag,
-per indicare che l'output deve essere preceduto
-da zeri anziché da spazi.
-Questo vale solo per i formati numerici in output..
-Questo flag ha effetto solo quando la larghezza del campo
-è maggiore di quella necessaria a contenere il valore da stampare.
-.TP
-.B '
-Un apice semplice chiede a
-.I gawk
-di inserire il separatore delle migliaia proprio della
-localizzazione, come pure di usare il separatore decimale
-proprio della localizzazione per i numeri in virgola mobile.
-È richiesto che la libreria C supporti correttamente la
-localizzazione e che questa sia stata definita correttamente.
-.TP
-.I ampiezza
-Il numero dovrebbe occupare questo numero di byte. Il numero è normalmente
-preceduto da spazi. In presenza del flag
-.BR 0 ,
-è invece preceduto da zeri.
-.TP
-.BI \&.\& prec
-Un numero indicante la precisione da utilizzare nella stampa.
-Con i formati
-.BR %e ,
-.BR %E ,
-.BR %f ,
-e
-.BR %F ,
-specifica il numero di cifre che dovranno comparire a destra del
-separatore decimale.
-Con i formati
-.BR %g ,
-e
-.BR %G ,
-specifica il massimo numero di cifre significative.
-Con i formati
-.BR %d ,
-.BR %i ,
-.BR %o ,
-.BR %u ,
-.BR %x ,
-e
-.BR %X ,
-specifica il numero minimo di
-cifre da stampare. Per il formato
-.BR %s ,
-specifica il massimo numero di caratteri
-della stringa che dovrebbero essere stampati.
-.PP
-La definizione dinamica di
-.I ampiezza
-e
-.I prec
-prevista dalle funzioni
-.B printf()
-dell'ISO C sono supportate.
-Un
-.B *
-al posto sia di
-.I ampiezza
-che di
-.I prec
-farà sì che i loro valori siano presi dalla
-lista degli argomenti di
-.B printf
-o
-.BR sprintf() .
-Per usare uno specificatore di posizione con una larghezza o una precisione
-dinamica inserire il
-.IB contatore $
-dopo il carattere
-.B *
-nella stringa di formattazione.
-Per esempio, \fB"%3$*2$.*1$s"\fP.
+soono simili a quelle del linguaggio C. Per i dettagli, vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/Printf.html .
.SS Nomi di file speciali
-effettuando delle ridirezioni di
+Effettuando delle ridirezioni di
.B print
o
.B printf
-in un file,
+su un file,
o attraverso
.B getline
da un file,
.I gawk
riconosce internamente alcuni nomi di file speciali, che permettono
-di accedere a descrittori di file già aperti ereditati dal processo genitore di
+di accedere a descrittori di file già aperti ereditati dal processo genitore di
.IR gawk
(la shell, solitamente).
Questi nomi di file possono anche essere usati nella riga di comando per
@@ -2790,22 +1504,6 @@ Lo standard error in output.
Il file associato al descrittore di file aperto
.IR n .
.PP
-Questi ultimi sono utili in particolare per i messaggi di errore. Per esempio:
-.PP
-.RS
-.ft B
-print "Ti è andata male!" > "/dev/stderr"
-.ft R
-.RE
-.PP
-laddove, per ottenere lo stesso effetto, si sarebbe stati costretti a scrivere
-.PP
-.RS
-.ft B
-print "Ti è andata male!" | "cat 1>&2"
-.ft R
-.RE
-.PP
I seguenti nomi di file speciali si possono usare con l'operatore
.B |&
di coprocesso per creare connessioni di rete TCP/IP:
@@ -2837,7 +1535,7 @@ per richiedere una connessione IPv6.
Specificando semplicemente
.B /inet
usa quello predefinito del sistema (molto probabilmente IPv4).
-Si può usare solo con l'operatore bidirezionale di I/O
+Si può usare solo con l'operatore bidirezionale di I/O
.B |& .
.TP
.PD 0
@@ -2881,7 +1579,7 @@ diviso per
in \fIresult\fB["quotient"]\fR
e il resto in
\fIresult\fB["remainder"]\fR.
-Questa è un'estensione
+Questa è un'estensione
.IR gawk ,
utile in particolare quando si lavora con numeri
molto grandi.
@@ -2910,13 +1608,14 @@ usa
.I espressione
come nuovo seme per il generatore di numeri casuali. Se
.I espressione
-non è indicata, sarà utilizzata il tempo corrente, misurato in secondi dal 1970.
-Il valore restituito è il valore precedente
+non è indicata, sarà utilizzata il tempo corrente, misurato in secondi dal 1970.
+Il valore restituito è il valore precedente
del seme.
.SS Funzioni di stringa
.I Gawk
-offre le seguenti funzioni di stringa predefinite:
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIlista-espressioni\^\fB)\fR'u+1n"
+offre le seguenti funzioni di stringa seguenti predefinite; ulteriori dettagli in
+.IR https://www.gnu.org/software/gawk/manual/html_node/String-Functions .
+.TP "\w'\fBsprintf(\fIformato\^\fB\^, \fIlista-espressioni\^\fB)\fR'u+1n"
\fBasort(\fIs \fR[\fB, \fId\fR [\fB, \fIcome\fR] ]\fB)\fR
Restituisce il numero di elementi del
vettore di partenza
@@ -2949,30 +1648,33 @@ La stringa facoltativa
controlla la direzione e il modo del confronto.
Valori ammissibili per
.I come
-sono
-quelli delle stringhe ammissibili per
-\fBPROCINFO["sorted_in"]\fR.
-Si può anche specificare il nome di una funzione di confronto
-definita dall'utente, come viene spiegato in
-\fBPROCINFO["sorted_in"]\fR.
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIlista-espressioni\^\fB)\fR'u+1n"
+sono descritti in
+.IR https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html#String-Functions .
+.IR s " e " d
+possono specificare lo stesso vettore; la cosa ha senso nel
+caso si specifichi anche il terzo argomento.
+.TP
\fBasorti(\fIs \fR[\fB, \fId\fR [\fB, \fIcome\fR] ]\fB)\fR
Restituisce il numero di elementi del
vettore di partenza
.IR s .
-Il comportamento è lo stesso di
+Il comportamento è lo stesso di
.BR asort() ,
-con la differenza che l'ordinamento è fatto usando gli
+con la differenza che l'ordinamento è fatto usando gli
.I indici
del vettore, e non i valori.
-Fatto l'ordinamento, il vettore è indicizzato numericamente, e
+Fatto l'ordinamento, il vettore è indicizzato numericamente, e
i valori sono quelli degli indici di partenza.
I valori originali sono persi; quindi va utilizzato
un secondo vettore se si vuole conservare il vettore di partenza.
Lo scopo della stringa facoltativa
.I come
-è lo stesso descritto in precedenza per
+è lo stesso che in
.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
@@ -2981,7 +1683,7 @@ corrispondenze con l'espressione regolare
.IR r .
Se
.I h
-è una stringa che inizia con
+è una stringa che inizia con
.B g
o
.BR G ,
@@ -2991,35 +1693,35 @@ sono sostituite con
.IR s .
Altrimenti,
.I h
-è un numero che indica la particolare corrispondenza con
+è un numero che indica la particolare corrispondenza con
.I r
che si vuole sostituire.
Se
.I t
-non è specificata, è usato
+non è specificata, è usato
.B $0
al suo posto.
All'interno del testo di rimpiazzo
.IR s
-si può utilizzare la sequenza
+si può utilizzare la sequenza
.BI \e n\fR,
dove
.I n
-è una cifra tra 1 e 9, per indicare la parte di testo che corrisponde alla
+è una cifra tra 1 e 9, per indicare la parte di testo che corrisponde alla
.IR n -esima
sottoespressione tra parentesi.
La sequenza
.B \e0
-rappresenta tutto il testo corrispondente, e così pure il carattere
+rappresenta tutto il testo corrispondente, e così pure il carattere
.BR & .
A differenza di
.B sub()
e
.BR gsub() ,
-la stringa modificata è restituita come risultato della funzione, e
+la stringa modificata è restituita come risultato della funzione, e
la stringa obiettivo originale resta
.IR inalterata .
-.TP "\w'\fBsprintf(\^\fIfmt\fB\^, \fIlista-espressioni\^\fB)\fR'u+1n"
+.TP
\fBgsub(\fIr\fB, \fIs \fR[\fB, \fIt\fR]\fB)\fR
Per ogni sottostringa conforme all'espressione regolare
.I r
@@ -3030,19 +1732,19 @@ sostituisce la stringa
e restituisce il numero di sostituzioni.
Se
.I t
-non è specificata, usa
+non è specificata, usa
.BR $0 .
Una
.B &
-nel testo di rimpiazzo è sostituita dal testo trovato corrispondente alla
+nel testo di rimpiazzo è sostituita dal testo trovato corrispondente alla
espressione regolare.
Si usi
.B \e&
per indicare il carattere
.BR &
-inteso letteralmente (va scritto come \fB"\e\e&"\fP;
-vedere \*(EP
-per una trattazione più completa delle regole sull'uso della "e commerciale" (ampersand)
+inteso letteralmente (va scritto come \fB"\e\e&"\fP; vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Gory-Details.html#Gory-Details
+per una trattazione più completa delle regole sull'uso della "e commerciale" (ampersand)
e delle barre inverse nel testo di rimpiazzo di
.BR sub() ,
.BR gsub() ,
@@ -3056,10 +1758,8 @@ all'interno della stringa
.IR s ,
o zero se la stringa
.I t
-non è presente.
-(Ciò implica che gli indici di una stringa di caratteri partono da 1.)
-È un errore fatale usare una costante generata da un'espressione regolare per
-.IR t .
+non è presente.
+(Ciò implica che gli indici di una stringa di caratteri partono da 1.)
.TP
\fBlength(\fR[\fIs\fR]\fB)
Restituisce la lunghezza della stringa
@@ -3068,8 +1768,8 @@ oppure la lunghezza di
.B $0
se
.I s
-non è specificata.
-Come estensione non-standard, se si fornisce come argomento un vettore,
+non è specificata.
+Se si fornisce come argomento un vettore,
.B length()
restituisce il numero di elementi del vettore.
.TP
@@ -3080,38 +1780,20 @@ in cui ricorre l'espressione regolare
.IR r ,
oppure zero se
.I r
-non è presente, e imposta i valori di
+non è presente, e imposta i valori di
.B RSTART
e
.BR RLENGTH .
-Si noti che l'ordine degli argomenti è lo stesso in uso per l'operatore
+Si noti che l'ordine degli argomenti è lo stesso in uso per l'operatore
.BR ~ :
.IB stringa " ~"
.IR espressione-regolare .
.ft R
-Se viene specificato il vettore
-.IR a ,
-.I a
-viene preventivamente svuotato e quindi i suoi elementi da 1 a
-.I n
-sono riempiti con le parti di
-.I s
-corrispondenti alle sottoespressioni
-fra parentesi presenti in
-.IR r .
-L'elemento di indice zero di
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/String-Functions.html#String-Functions
+per una descrizione di come il vettore
.I a
-contiene la parte
-di
-.I s
-corrispondente all'intera espressione regolare
-.IR r .
-Gli indici
-\fBa[\fIn\^\fB, "inizio"]\fR,
-e
-\fBa[\fIn\^\fB, "lunghezza"]\fR
-contengono l'indice di inizio all'interno della stringa e la lunghezza,
-rispettivamente, di ogni sottostringa individuata.
+viene riempito, se specificato.
.TP
\fBpatsplit(\fIs\fB, \fIa \fR[\fB, \fIr\fR [\fB, \fIseps\fR] ]\fB)\fR
Suddivide la stringa
@@ -3129,15 +1811,15 @@ che corrispondono a
.IR r .
Il valore di
.BI seps[ i ]
-è il separatore (che potrebbe anche essere la stringa nulla) individuato
+è il separatore (che potrebbe anche essere la stringa nulla) individuato
davanti a
.BI a[ i ]\fR.
Il valore di
.B seps[0]
-è il separatore iniziale (che potrebbe anche essere la stringa nulla).
+è il separatore iniziale (che potrebbe anche essere la stringa nulla).
Se
.I r
-è omesso,
+è omesso,
.B FPAT
viene usato al suo posto.
I vettori
@@ -3146,7 +1828,7 @@ e
.I seps
sono svuotati all'inizio dell'operazione.
La suddivisione si comporta come la suddivisione in campi con
-.BR FPAT ,
+.BR FPAT .
descritta sopra.
.TP
\fBsplit(\fIs\fB, \fIa \fR[\fB, \fIr\fR [\fB, \fIseps\fR] ]\fB)\fR
@@ -3160,7 +1842,7 @@ individuati dall'espressione regolare
.IR r ,
e restituisce il numero di campi. Se
.I r
-è omessa, il separatore utilizzato è
+è omessa, il separatore utilizzato è
.BR FS .
I vettori
.I a
@@ -3168,35 +1850,19 @@ e
.I seps
sono svuotati all'inizio dell'operazione.
.BI seps[ i ]
-è il separatore di campo individuato da
+è il separatore di campo individuato da
.I r
tra
.BI a[ i ]
e
.BI a[ i +1]\fR.
-Se
-.I r
-è uno spazio singolo, gli eventuali spazi bianchi all'inizio di
-.I s
-vengono messi nell'elemento extra del vettore
-.B seps[0]
-e gli spazi bianchi alla fine vanno nell'elemento extra del vettore
-.BI seps[ n ]\fR,
-dove
-.I n
-è il valore restituito da
-.BI split( s ", " a ", " r ", " seps )\fR.
-La suddivisione si comporta come la suddivisione in campi, descritta sopra.
-Nel caso particolare in cui
-.I r
-è una stringa composta da un unico carattere, quella stringa fa da separatore,
-anche se il carattere è un metacarattere di un'espressione regolare.
+La divisione viene effettuata con le stesse regole con cui vengono divisi i campi.
.TP
-.BI sprintf( fmt , " lista-espressioni" )
+.BI sprintf( formato\^ , " lista-espressioni\^" )
Stampa
.I lista-espressioni
secondo quanto specificato dal formato
-.IR fmt ,
+.IR formato ,
e restituisce la stringa risultante.
.TP
.BI strtonum( str )
@@ -3208,7 +1874,7 @@ Se
inizia
con uno
.BR 0 ,
-è considerato
+è considerato
un numero ottale.
Se
.I str
@@ -3217,14 +1883,14 @@ con uno
.B 0x
o
.BR 0X ,
-è considerato
+è considerato
un numero esadecimale.
Altrimenti, viene interpretato come numero decimale.
.TP
\fBsub(\fIr\fB, \fIs \fR[\fB, \fIt\fR]\fB)\fR
Si comporta come
.BR gsub() ,
-ma è sostituita solo la prima sottostringa trovata.
+ma è sostituita solo la prima sottostringa trovata.
Viene restituito zero oppure uno.
.TP
\fBsubstr(\fIs\fB, \fIi \fR[\fB, \fIn\fR]\fB)\fR
@@ -3236,7 +1902,7 @@ a partire dalla posizione
.IR i .
Se
.I n
-è omesso, è usato il resto di
+è omesso, è usato il resto di
.IR s .
.TP
.BI tolower( str )
@@ -3256,7 +1922,7 @@ tradotti nei maiuscoli corrispondenti.
I caratteri non alfabetici restano invariati.
.PP
.I Gawk
-gestisce i caratteri multi-byte. Ciò implica che
+gestisce i caratteri multi-byte. Ciò implica che
.BR index() ,
.BR length() ,
.B substr()
@@ -3264,11 +1930,10 @@ e
.B match()
lavorano in termini di caratteri, non di byte.
.SS Funzioni di tempo
-Poiché uno dei principali campi di applicazione dei programmi \*(AK è l'elaborazione
-dei file di log contenenti informazioni relative alla data e all'ora [di un evento],
-.I gawk
+.I Gawk
mette a disposizione le seguenti funzioni per ottenere data e ora
-e per formattarle come desiderato.
+e per formattarle come desiderato. I dettagli si trovano in
+.IR https://www.gnu.org/software/gawk/manual/html_node/Time-Functions .
.TP "\w'\fBsystime()\fR'u+1n"
\fBmktime(\fIdatespec\fR [\fB, \fIutc-flag\fR]\fB)\fR
Traduce
@@ -3276,44 +1941,23 @@ Traduce
In una marcatura temporale nello stesso formato restituito dalla funzione [del linguaggio C]
.BR systime() ,
e restituisce il risultato.
-Il parametro
-.I datespec
-è una stringa nella forma
-.IR "YYYY MM DD HH MM SS[ DST]" .
-Il contenuto della stringa consiste in sei o sette numeri che rappresentano rispettivamente:
-l'anno, incluso il secolo,
-il mese, da 1 a 12,
-il giorno del mese da 1 a 31,
-l'ora del giorno da 0 a 23,
-il minuto da 0 a 59,
-il secondo da 0 a 60,
-e un flag facoltativo riguardo all'ora legale.
-I valori di questi numeri non sono limitati agli intervalli sopra descritti;
-per esempio, un'ora di \-1 significa 1 ora prima di mezzanotte.
-Si suppone di lavorare con un calendario gregoriano dotato di anno 0,
-con l'anno 0 prima dell'anno 1 e l'anno \-1 prima dell'anno 0.
Se il flag
.I utc-flag
-è presente e diverso da zero e dalla stringa nulla,
-il tempo è supposto essere quello del fuso orario UTC
+è presente e diverso da zero e dalla stringa nulla,
+il tempo è supposto essere quello del fuso orario UTC
[ora di Greenwich];
altrimenti, si suppone che il tempo sia quello del
fuso orario locale.
-Se il flag
-.I DST
-(daylight saving time - ora legale) è positivo,
-si suppone che ci si trovi in un periodo dell'anno in cui vige l'ora legale;
-se vale zero, l'ora è ritenuta essere quella standard [ora di Greenwich];
-se è negativa (questo è il comportamento predefinito),
-.B mktime()
-tenta di determinare se è in vigore l'ora legale
-nel momento specificato.
Se
.I datespec
non contiene sufficienti elementi o se il tempo risultante
-è fuori intervallo,
+è fuori intervallo,
.B mktime()
restituisce \-1.
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Time-Functions.html#Time-Functions
+per i dettagli di
+.IR datespec .
.TP
\fBstrftime(\fR[\fIformat \fR[\fB, \fItimestamp\fR[\fB, \fIutc-flag\fR]]]\fB)\fR
Formatta
@@ -3322,20 +1966,20 @@ secondo quanto specificato in
.IR format .
Se
.I utc-flag
-è presente e diversa da zero o dalla stringa nulla, il risultato
-è in UTC [ora di Greenwich], altrimenti il risultato è nell'ora locale.
+è presente e diversa da zero o dalla stringa nulla, il risultato
+è in UTC [ora di Greenwich], altrimenti il risultato è nell'ora locale.
Il
.I timestamp
dovrebbe essere nella forma utilizzata da
.BR systime() .
Se
.I timestamp
-è omesso, sono utilizzate la data e l'ora correnti.
+è omesso, sono utilizzate la data e l'ora correnti.
Se
.I format
-è omesso, è assunto un formato equivalente a quello dell'output del comando
+è omesso, è assunto un formato equivalente a quello dell'output del comando
.IR date (1).
-Il formato predefinito è disponibile in
+Il formato predefinito è disponibile in
.BR PROCINFO["strftime"] .
Vedere le specifiche per la funzione
.B strftime()
@@ -3353,10 +1997,8 @@ doppia in interi nel formato
.BR uintmax_t ,
eseguendo l'operazione indicata, e poi convertendo il risultato
nuovamente in virgola mobile.
-.PP
-.BR NOTA :
Se a una delle funzioni seguenti si forniscono operandi negativi,
-il risultato è un errore fatale.
+il risultato è un errore fatale.
.PP
Le funzioni sono:
.TP "\w'\fBrshift(\fIval\fB, \fIcontatore\fB)\fR'u+2n"
@@ -3398,15 +2040,13 @@ che vengono loro passati.
\fBisarray(\fIx\fB)\fR
Restituisce "Vero" se
.I x
-è un vettore, altrimenti restituisce "Falso".
+è un vettore, altrimenti restituisce "Falso".
[0 e la stringa nulla significano "Falso". Qualsiasi altro valore sta per "Vero".]
-Questa funzione è destinata principalmente a essere usata con elementi di
-vettori multidimensionali, e con parametri usati da funzioni.
.TP
\fBtypeof(\fIx\fB)\fR
Restituisce una stringa che indica il tipo di
.IR x .
-La stringa sarà una di queste:
+La stringa sarà una di queste:
\fB"array"\fP,
\fB"number"\fP,
\fB"regexp"\fP,
@@ -3418,27 +2058,27 @@ o
.SS Funzioni di internazionalizzazione
Le seguenti funzioni possono essere usate all'interno di un programma AWK
per tradurre stringhe in fase di esecuzione del programma.
-Per informazioni più complete, vedere \*(EP.
+Per informazioni dettagliate, vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/I18N-Functions.html#I18N-Functions .
.TP
\fBbindtextdomain(\fIdirectory \fR[\fB, \fIdominio\fR]\fB)\fR
Specifica la directory in cui
.I gawk
cerca i file
.BR \&.gmo ,
-nel caso non si trovino
-o non si possano mettere nelle directory ``standard''
-(per esempio, in fase di test).
+nel caso non siano
+o non si possano mettere nelle directory ``standard''.
Restituisce la directory a cui
.I dominio
-è ``collegato''.
+è ``collegato''.
.sp .5
Il valore predefinito per
.I dominio
-è il valore della variabile
+è il valore della variabile
.BR TEXTDOMAIN .
Se
.I directory
-è impostato alla stringa nulla (\fB""\fR),
+è impostato alla stringa nulla (\fB""\fR),
.B bindtextdomain()
restituisce il collegamento corrente per il
dato
@@ -3453,20 +2093,12 @@ per la categoria di localizzazione
.IR categoria .
Il valore predefinito per
.I dominio
-è il valore corrente della variabile
+è il valore corrente della variabile
.BR TEXTDOMAIN .
Il valore predefinito per
.I categoria
-è \fB"LC_MESSAGES"\fR.
+è \fB"LC_MESSAGES"\fR.
.sp .5
-Se si fornisce un valore per
-.IR categoria ,
-dev'essere una stringa uguale
-a una delle categorie di localizzazione note, come descritto
-in \*(EP.
-Occorre anche fornire un dominio di testo. Si usi
-.B TEXTDOMAIN
-se ci si vuole servire del dominio corrente.
.TP
\fBdcngettext(\fIstringa1\fB, \fIstringa2\fB, \fInumero \fR[\fB, \fIdominio \fR[\fB, \fIcategory\fR]]\fB)\fR
Restituisce la forma plurale in uso per
@@ -3482,25 +2114,27 @@ per la categoria di localizzazione
.IR categoria .
Il valore predefinito per
.I dominio
-è il valore corrente della variabile
+è il valore corrente della variabile
.BR TEXTDOMAIN .
Il valore predefinito per
.I categoria
-è \fB"LC_MESSAGES"\fR.
-.sp .5
-Se si fornisce un valore per
-.IR categoria ,
-dev'essere una stringa uguale
-a una delle categorie di localizzazione note, come descritto
-in \*(EP.
-Occorre anche fornire un dominio di testo. Si usi
-.B TEXTDOMAIN
-se ci si vuole servire del dominio corrente.
+è \fB"LC_MESSAGES"\fR.
+.SS Funzioni con valori booleani
+È possibile creare valori speciali di tipo booleano;
+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
.RS
-\fBfunction \fInome\fB(\fIlista-di-parametri\fB) { \fIistruzioni \fB}\fR
+\fBfunction \fInome\fB(\fIlista-parametri\fB) { \fIistruzioni \fB}\fR
.RE
.PP
Le funzioni vengono eseguite se chiamate dall'interno di espressioni,
@@ -3509,11 +2143,10 @@ I parametri forniti al momento della chiamata sono sostituiti
ai parametri formali dichiarati nella funzione.
I vettori sono passati per riferimento, le altre variabili per valore.
.PP
-Poiché le funzioni non erano in origine previste nel linguaggio \*(AK,
-la gestione delle variabili locali è piuttosto goffa: sono dichiarate
-semplicemente come parametri in più nella lista dei parametri formali.
+Le variabili locali sono dichiarate come parametri in più nella
+lista dei parametri.
Per convenzione, si usa separare le variabili locali dai veri parametri
-con qualche spazio in più nella lista. Per esempio:
+con qualche spazio in più nella lista. Per esempio:
.PP
.RS
.ft B
@@ -3528,9 +2161,8 @@ function f(p, q, a, b) # a e b sono variabili locali
.ft R
.RE
.PP
-La parentesi di sinistra che indica una chiamata deve seguire immediatamente
-il nome della funzione chiamata, senza spazi in mezzo; questo per evitare
-l'ambiguità sintattica con l'operatore di concatenazione [di stringhe].
+La parentesi sinistra che indica una chiamata deve seguire immediatamente
+il nome della funzione chiamata, senza spazi in mezzo.
Questa restrizione non si applica alle funzioni predefinite elencate sopra.
.PP
Le funzioni possono chiamare a loro volta altre funzioni, e possono essere ricorsive.
@@ -3539,23 +2171,21 @@ alla stringa nulla e al numero zero al momento dell'invocazione.
.PP
Si usi
.BI return " expr"
-per restituire un valore da una funzione. Il valore di ritorno è indefinito se
+per restituire un valore da una funzione. Il valore di ritorno è indefinito se
non si fornisce alcun valore, o se la funzione ritorna automaticamente dopo aver
-eseguito l'ultima istruzione della funzione stessa, nella modalità detta \*(lqfalling off\*(rq.
+eseguito l'ultima istruzione della funzione stessa, nella modalità detta \*(lqfalling off\*(rq.
.PP
-Come estensione
-.I gawk
-le funzioni possono essere chiamate indirettamente. Per far ciò basta assegnare
+Le funzioni possono essere chiamate indirettamente. Per far ciò basta assegnare
il nome della funzione da chiamare, in formato stringa, a una variabile. Poi
si usi la variabile come se fosse un nome di funzione, premettendole il segno
.B @
-come si può vedere qui sotto:
+come si può vedere qui sotto:
.RS
.ft B
.nf
function mia_funzione()
{
- print "mia_funzione è stata chiamata"
+ print "mia_funzione è stata chiamata"
\&.\|.\|.
}
@@ -3567,30 +2197,23 @@ function mia_funzione()
.fi
.ft R
.RE
-A partire dalla versione 4.1.2, questo vale per le funzioni definite
-dall'utente, per quelle predefinite e per le funzioni di estensione.
.PP
-Se è stata data l'opzione
+Se è stata data l'opzione
.BR \-\^\-lint ,
.I gawk
-avvertirà in caso di chiamate a funzioni indefinite al momento della
-valutazione sintattica del programma anziché durante l'esecuzione.
+avvertirà in caso di chiamate a funzioni indefinite al momento della
+valutazione sintattica del programma anziché durante l'esecuzione.
La chiamata di una funzione indefinita in fase di esecuzione
-è un errore fatale.
-.PP
-Si può usare la parola
-.B func
-al posto di
-.BR function .
-anche se questo modo di operare è deprecato.
+è un errore fatale.
.SH CARICARE DINAMICAMENTE NUOVE FUNZIONI
Si possono aggiungere dinamicamente nuove funzioni scritte in C o C++
all'interpretatore
.I gawk
in esecuzione tramite l'istruzione
.BR @load .
-Una descrizione dettagliata non è possibile in questa pagina di manuale;
-vedere \*(EP.
+Una descrizione dettagliata non è possibile in questa pagina di manuale;
+vedere
+.IR https://www.gnu.org/software/gawk/manual/html_node/Dynamic-Extensions.html#Dynamic-Extensions .
.SH SEGNALI
Il profilo
.I gawk
@@ -3608,7 +2231,7 @@ chiede a
di scrivere il profilo e lo stack delle chiamate a funzione e di terminare l'esecuzione del programma.
.SH INTERNAZIONALIZZAZIONE
Le costanti di tipo stringa sono sequenze di caratteri racchiuse fra doppi
-apici. In un ambiente dove non si parla inglese, è possibile segnare delle
+apici. In un ambiente dove non si parla inglese, è possibile segnare delle
stringhe in un programma \*(AK per richiederne la traduzione nel linguaggio
utilizzato in loco. Tali stringhe sono precedute nel programma \*(AK da
un carattere di sottolineatura (\*(lq_\*(rq). Per esempio,,
@@ -3633,172 +2256,17 @@ potrebbe invece stampare
.B "bonjour, monde"
se eseguito in Francia.
.PP
-Parecchi passi sono necessari per produrre ed eseguire un programma \*(AK
+Vedere
+.I https://www.gnu.org/software/gawk/manual/html_node/Internationalization.html#Internationalization
+per i passi necessari per produrre ed eseguire un programma \*(AK
localizzabile.
-.TP "\w'4.'u+2n"
-1.
-Aggiungere un'azione
-.B BEGIN
-per assegnare un valore alla variabile
-.B TEXTDOMAIN
-per impostare il dominio del testo a un nome associato al programma in uso:
-.sp
-.in +5m
-.ft B
-BEGIN { TEXTDOMAIN = "mio_programma" }
-.ft R
-.in -5m
-.sp
-Ciò consente a
-.I gawk
-di trovare il file
-.B \&.gmo
-associato al vostro programma.
-Se non si fa ciò,
-.I gawk
-usa il dominio di testo associato ai
-.B messaggi
-il quale, molto probabilmente, non contiene
-le traduzioni necessarie al programma in uso.
-.TP
-2.
-Far precedere a tutte le stringhe da tradurre il carattere "_".
-.TP
-3.
-Se è il caso, usare le funzioni
-.B dcgettext()
-e/o
-.B bindtextdomain()
-nel programma, secondo necessità.
-.TP
-4.
-Eseguite il comando
-.B "gawk \-\^\-gen\-pot \-f mio_programma.awk > mio_programma.pot"
-per generare un file
-.B \&.pot
-per il programma [questo file contiene i messaggi da tradurre e la
-struttura in cui inserire la traduzione]
-.TP
-5.
-Preparare delle traduzioni appropriate dei messaggi, e costruire [con make]
-il corrispondente file
-.B \&.gmo
-[che contiene messaggi e traduzioni in formato accessibile da gawk].
-.PP
-Le procedure da usare per la traduzione sono descritte in dettaglio in \*(EP.
-.SH COMPATIBILITÀ POSIX
-Un obiettivo fondamentale di
-.I gawk
-è la compatibilità con lo standard \*(PX, come pure con
-l'ultima versione di
-.IR awk
-scritta da Brian Kernighan.
-Per questa ragione
-.I gawk
-include le seguenti caratteristiche a disposizione dell'utente
-che non sono descritte nel libro di \*(AK,
-ma che fanno parte della versione di
-.I awk
-scritta da Brian Kernighan, e che sono incluse nello standard \*(PX.
-.PP
-Il libro indica che l'assegnazione delle variabili fornite sulla riga di
-comando è fatta subito prima che
-.I awk
-apra il primo file fra gli argomenti, il che avviene dopo che la
-regola
-.B BEGIN
-è stata eseguita. Peraltro, in implementazioni precedenti, quando una tale
-assegnazione compariva prima di un nome di file, l'assegnazione sarebbe
-avvenuta
-.I prima
-di eseguire la regola
-.BR BEGIN .
-Esistono applicazioni che dipendono da questa \*(lqfunzionalità.\*(rq
-Quando
-.I awk
-è stato cambiato per corrispondere alla sua documentazione l'opzione
-.B \-v
-per assegnare valori alle variabili prima dell'inizio dell'esecuzione è stata aggiunta
-per tener conto delle applicazioni che dipendevano dal precedente comportamento.
-(Questa funzionalità ha ottenuto l'approvazione sia dagli sviluppatori
-dei Bell Laboratories che dagli sviluppatori di \*(GN .)
-.PP
-Nella scansione degli argomenti,
-.I gawk
-usa l'opzione speciale \*(lq\-\^\-\*(rq per segnalare la fine degli
-argomenti.
-In modalità compatibile, emette un messaggio e poi ignora le
-opzioni non disponibili.
-Nella modalità normale di operazione, siffatti argomenti sono passati al programma \*(AK
-per essere trattati.
-.PP
-Il libro di \*(AK non definisce il valore restituito dalla funzione
-.BR srand() .
-Lo standard \*(PX
-richiede che restituisca il "seme" che è stato usato, per consentire di tener traccia
-delle sequenze di numeri casuali. Pertanto
-.B srand()
-in
-.I gawk
-restituisce anche il suo "seme" corrente.
-.PP
-Altre funzionalità sono:
-L'uso di opzioni
-.B \-f
-multiple (dalla versione MKS [Mortice Kern Systems] di
-.IR awk );
-il vettore
-.BR ENVIRON ;
-le sequenze di protezione
-.BR \ea ,
-e
-.B \ev
-(provenienti originalmente da
-.I gawk
-e poi riversate nella versione Bell Laboratories); le funzioni predefinite
-.B tolower()
-e
-.B toupper()
-(dalla versione Bell Laboratories);
-e le specifiche di conversione ISO C in
-.B printf
-(presenti per prime nella versione Bell Laboratories).
-.SH FUNZIONALITÀ STORICHE
-C'è una caratteristica dell'implementazione storica di \*(AK che
-.I gawk
-supporta:
-È possibile chiamare la funzione predefinita
-.B length()
-non solo senza alcun argomento, ma perfino senza parentesi!
-Quindi,
-.RS
-.PP
-.ft B
-a = length # Sant'Algol 60, Batman!
-.ft R
-.RE
-.PP
-equivale sia a
-.RS
-.PP
-.ft B
-a = length()
-.br
-a = length($0)
-.ft R
-.RE
-.PP
-Usare questa funzionalità è una pratica deprecata, e
-.I gawk
-emette un messaggio di avvertimento se la si usa, qualora si sia specificato
-.B \-\^\-lint
-sulla riga di comando.
.SH ESTENSIONI GNU
.I Gawk
ha fin troppe estensioni rispetto alla versione \*(PX di
.IR awk .
-Esse sono descritte in questa sezione. Tutte le estensioni qui descritte
-possono essere disabilitate
+Esse sono descritte in
+.IR https://www.gnu.org/software/gawk/manual/html_node/POSIX_002fGNU.html .
+Tutte le estensioni possono essere disabilitate
invocando
.I gawk
con le opzioni
@@ -3806,244 +2274,10 @@ con le opzioni
o
.BR \-\^\-posix .
.PP
-Le seguenti funzionalità di
-.I gawk
-sono sono disponibili nella versione
-\*(PX di
-.IR awk .
-.\" Variabili d'ambiente e cose relative all'avvio programma
-.TP "\w'\(bu'u+1n"
-\(bu
-Non viene fatta una ricerca nelle librerie per file richiamati tramite l'opzione
-.BR \-f .
-Quindi la variabile d'ambiente
-.B AWKPATH
-non è speciale.
-.\" Problemi POSIX e di riconoscimento del linguaggio
-.TP
-\(bu
-Non c'è modo di includere dei file da programma (il meccanismo
-.RI gawk
-di
-.BR @include ).
-.TP
-\(bu
-Non c'è modo di aggiungere dinamicamente nuove funzioni
-scritte in C (meccanismo
-.B @load
-di
-.IR gawk ).
-.TP
-\(bu
-La sequenza di protezione
-.BR \ex .
-.TP
-\(bu
-La possibilità di continuare delle righe dopo un
-.B ?
-e i
-.BR : .
-.TP
-\(bu
-Costanti ottali ed esadecimali nei programmi AWK.
-.\" Variabili speciali
-.TP
-\(bu
-Le variabili
-.BR ARGIND ,
-.BR BINMODE ,
-.BR ERRNO ,
-.BR LINT ,
-.BR PREC ,
-.BR ROUNDMODE ,
-.B RT
-e
-.B TEXTDOMAIN
-non sono speciali.
-.TP
-\(bu
-La variabile
-.B IGNORECASE
-e i suoi effetti collaterali non sono disponibili.
-.TP
-\(bu
-La variabile
-.B FIELDWIDTHS
-e la suddivisione in campi di larghezza fissa e variabile.
-.TP
-\(bu
-La variabile
-.B FPAT
-e la suddivisione in campi sulla base dei valori di un campo.
-.TP
-\(bu
-I vettori
-.BR FUNCTAB ,
-.BR SYMTAB ,
-e
-.B PROCINFO
-non sono disponibili.
-.\" Cose relative all'I/O
-.TP
-\(bu
-L'uso della variabile
-.B RS
-come espressione regolare.
-.TP
-\(bu
-I nomi di file speciali disponibili per ridirigere l'I/O non sono riconosciuti.
-.TP
-\(bu
-L'operatore
-.B |&
-utilizzabile per creare coprocessi.
-.TP
-\(bu
-I criteri di confronto speciali
-.B BEGINFILE
-e
-.B ENDFILE
-non sono disponibili.
-.\" Modifiche alle funzioni standard awk
-.TP
-\(bu
-La possibilità di separare fra loro singoli caratteri usando la stringa nulla
-come valore per la variabile
-.BR FS ,
-e come terzo argomento nella funzione
-.BR split() .
-.TP
-\(bu
-Un quarto argomento opzionale per
-.B split()
-che riceva i testi da usare come separatori.
-.TP
-\(bu
-Il secondo argomento opzionale della funzione
-.BR close() .
-.TP
-\(bu
-Il terzo argomento opzionale della funzione
-.BR match() .
-.TP
-\(bu
-La possibilità di usare specificatori posizionali con
-.B printf
-e
-.BR sprintf() .
-.TP
-\(bu
-La possibilità di avere un vettore come argomento alla funzione
-.BR length() .
-.\" Nuove parole-chiave o modifiche a parole-chiave
-.\" (Dal 2012, queste sono comprese in POSIX)
-.\" .TP
-.\" \(bu
-.\" L'uso dell'istruzione
-.\" .BI delete " array"
-.\" per cancellare tutto il contenuto di un vettore.
-.\" .TP
-.\" \(bu
-.\" L'uso dell'istruzione
-.\" .B "nextfile"
-.\" per interrompere la lettura del file di input corrente.
-.\" Nuove funzioni
-.TP
-\(bu
-Le funzioni
-.BR and() ,
-.BR asort() ,
-.BR asorti() ,
-.BR bindtextdomain() ,
-.BR compl() ,
-.BR dcgettext() ,
-.BR dcngettext() ,
-.BR gensub() ,
-.BR lshift() ,
-.BR mktime() ,
-.BR or() ,
-.BR patsplit() ,
-.BR rshift() ,
-.BR strftime() ,
-.BR strtonum() ,
-.B systime()
-e
-.BR xor() .
-.\" Cose I18N
-.TP
-\(bu
-Stringhe traducibili in varie lingue.
-.TP
-\(bu
-Errore di I/O non-fatale.
-.TP
-\(bu
-I/O ritentabile.
-.PP
-Il libro \*(AK non definisce il valore restituito dalla funzione
-.BR close() .
-Invece la funzione
-.B close()
-di
-.I Gawk
-restituisce il valore ottenuto da
-.IR fclose (3)
-o
-.IR pclose (3)
-alla chiusura, rispettivamente, di un file di output o di una pipe. Alla
-chiusura di una pipe di input viene restituito lo stato di uscita del processo.
-Il valore restituito è \-1 se il file, la pipe o il coprocesso in questione
-non sono stati aperti con una ridirezione.
-.PP
-Quando
-.I gawk
-è invocato con l'opzione
-.BR \-\^\-traditional ,
-se
-l'argomento
-.I fs
-all'opzione
-.B \-F
-è \*(lqt\*(rq,
-.B FS
-è impostato avendo come valore il carattere di tabulazione (<TAB>).
-Si noti che immettendo
-.B "gawk \-F\et \&.\|.\|."
-si chiede alla shell di preservare \*(lqt,\*(rq e non di passare
-\*(lq\et\*(rq all'opzione
-.BR \-F .
-Poiché questo è un caso speciale piuttosto antipatico, non è il comportamento
-predefinito. Questo comportamento non viene seguito neppure quando si specifica
-.BR \-\^\-posix .
-Per ottenere che un carattere <TAB> faccia da delimitatore di campo, è meglio
-usare apici singoli:
-.BR "gawk \-F'\et' \&.\|.\|." .
-.ig
-.PP
-Se
-.I gawk
-è stato compilato richiedendo la possibilità di far del debugging,
-sono accettate le seguenti opzioni addizionali:
-.TP
-.PD 0
-.B \-Y
-.TP
-.PD
-.B \-\^\-parsedebug
-Attiva l'output diagnostico di
-.IR yacc (1)
-o
-.IR bison (1)
-durante la fase di esame del programma.
-Quest'opzione dovrebbe interessare solo i manutentori di
-.IR gawk ,
-e può essere perfino assente da una particolare compilazione di
-.IR gawk .
-..
.SH VARIABILI D'AMBIENTE
La variabile d'ambiente
.B AWKPATH
-può essere usata per fornire una lista di directory che
+può essere usata per fornire una lista di directory che
.I gawk
esamina alla ricerca di file coi nomi indicati tramite le opzioni
.BR \-f ,
@@ -4053,14 +2287,14 @@ e
.BR \-\^\-include ,
e tramite la direttiva
.BR @include .
-Se la ricerca iniziale non ha successo, una seconda ricerca è
+Se la ricerca iniziale non ha successo, una seconda ricerca è
effettuata accodando
.B \&.awk
al nome del file indicato.
.PP
La variabile d'ambiente
.B AWKLIBPATH
-può essere usata per fornire una lista di directory che
+può essere usata per fornire una lista di directory che
.I gawk
esamina alla ricerca di file coi nomi indicati tramite le opzioni
.B \-l
@@ -4070,7 +2304,7 @@ e
.PP
La variabile d'ambiente
.B GAWK_READ_TIMEOUT
-può essere usata per specificare un tempo massimo
+può essere usata per specificare un tempo massimo
in millisecondi per leggere input da un terminale, da una pipe
o da una comunicazione bidirezionale, inclusi i socket.
.PP
@@ -4079,9 +2313,9 @@ Per le connessioni a un host remoto via socket,
controlla il numero di tentativi di lettura, e
.B GAWK_MSEC_SLEEP
l'intervallo fra un tentativo di lettura e quello successivo.
-L'intervallo è in millisecondi. Su sistemi che non supportano
+L'intervallo è in millisecondi. Su sistemi che non supportano
.IR usleep (3),
-il valore è arrotondato a un numero intero di secondi.
+il valore è arrotondato a un numero intero di secondi.
.PP
Se la variabile
.B POSIXLY_CORRECT
@@ -4092,13 +2326,13 @@ si comporta esattamente come se
fosse stato specificato sulla riga di comando.
Se
.B \-\^\-lint
-è stato specificato,
+è stato specificato,
.I gawk
emette un messaggio di avvertimento riguardo a questo.
.SH STATO DI USCITA
Se l'istruzione
.B exit
-è usata avendo come parametro un valore,
+è usata avendo come parametro un valore,
.I gawk
termina restituendo
il valore numerico in questione.
@@ -4107,19 +2341,19 @@ Altrimenti, se non sono stati riscontrati problemi in fase di esecuzione,
.I gawk
termina con il valore della costante C
.BR EXIT_SUCCESS .
-Questo valore è normalmente zero.
+Questo valore è normalmente zero.
.PP
In caso di errore,
.I gawk
termina con il valore della
costante C
.BR EXIT_FAILURE .
-Questo valore è normalmente uno.
+Questo valore è normalmente uno.
.PP
Se
.I gawk
-termina a causa di un errore fatale, il valore restituito è 2. Su sistemi
-non-POSIX, questo valore può essere visualizzato come
+termina a causa di un errore fatale, il valore restituito è 2. Su sistemi
+non-POSIX, questo valore può essere visualizzato come
.BR EXIT_FAILURE .
.SH INFORMAZIONE SULLA VERSIONE
Questa pagina man documenta
@@ -4128,7 +2362,7 @@ versione 5.1.
.SH AUTORI
La versione originale di \*(UX
.I awk
-è stata progettata e implementata da Alfred Aho,
+è stata progettata e implementata da Alfred Aho,
Peter Weinberger, e Brian Kernighan dei Bell Laboratories. Brian Kernighan
continua a mantenere e migliorare il programma.
.PP
@@ -4144,7 +2378,7 @@ da Arnold Robbins, ha reso
.I gawk
compatibile con la nuova versione di \*(UX
.IR awk .
-Arnold Robbins è il manutentore corrente.
+Arnold Robbins è il manutentore corrente.
.PP
Vedere \*(EP per una lista completa di contributori a
.I gawk
@@ -4155,7 +2389,7 @@ Vedere il file
nella distribuzione
.I gawk
per informazioni aggiornate riguardo ai manutentori
-e per sapere per quali sistemi operativi gawk è disponibile.
+e per sapere per quali sistemi operativi gawk è disponibile.
.PP
Traduzione in italiano a cura di
ILDP - Italian Linux Documentation Project
@@ -4163,74 +2397,35 @@ ILDP - Italian Linux Documentation Project
.SH SEGNALAZIONE DI ERRORI
Se trovate un bug in
.IR gawk ,
-siete pregati di inviare un messaggio di posta elettronica a
+siete pregati di usare il programma
.BR \%bug-gawk@gnu.org .
-Siete pregati di includere il vostro sistema operativo e la versione di
-.I gawk
-(da
-.BR "gawk \-\^\-version" ),
-quale compilatore C avete usato per compilarlo, e un programma di test
-con anche i dati, ridotti allo stretto necessario, per riprodurre il problema.
-.PP
-Prima di spedire un rapporto di errore fate quanto segue. Per prima cosa,
-verificate che stiate usando l'ultima versione di
-.IR gawk .
-Molti bug (normalmente abbastanza difficili da incontrare) sono corretti in
-ogni nuova versione, e se la vostra versione è molto datata, il problema
-potrebbe essere già stato risolto. Secondariamente, siete pregati di
-controllare se impostando la variabile d'ambiente
-.B LC_ALL
-a
-.B LC_ALL=C
-faccia sì che il problema scompaia. Se così è, si tratta di un problema
-legato alla localizzazione, che può essere o meno un errore.
-Infine, siete pregati di leggere questa man page e il manuale di riferimento
-con attenzione, per assicurarvi che quello che voi ritenete essere un errore
-lo sia veramente, invece di essere solo un comportamento strano del linguaggio.
-.PP
-Qualsiasi cosa facciate,
-.B NON
-inviate un messaggio per segnalare l'errore a
-.BR comp.lang.awk .
-Anche se gli sviluppatori di
-.I gawk
-di tanto in tanto leggono questo forum, inviare qui messaggi di segnalazione
-di errore è una maniera poco affidabile per segnalare errori.
-Analogamente,
-.B NON
-usare una comunità web (tipo Stack Overflow) per segnalare errori.
-Siete invece pregati di usare gli indirizzi di posta elettronica
-riportati più sopra.
+.IR gawkbug (1)
+per segnalarlo.
+.PP
+Istruzioni dettagliate per segnalare un bug sono disponibili in
+IR https://www.gnu.org/software/gawk/manual/html_node/Bugs.html .
+.I Per piacere,
+leggete attentamente e seguite le istruzioni là disponibili.
+Ciò faciliterà la segnalazione di errori e la loro risoluzione per
+tutte le persone coinvolte.
Veramente!
.PP
-Se state usando un sistema GNU/Linux o basato sulla distribuzione BSD,
-potreste rivolgervi a chi fornisce la vostra distribuzione software.
-Questo va bene, ma siete pregati di spedire una copia all'indirizzo email
-specificato, poiché non esiste alcune certezza che il vostro messaggio
-sia inoltrato al manutentore di
-.IR gawk .
-.PP
-Segnalare eventuali errori di traduzione a
-.IR ildp@pluto.it
.SH ERRORI
L'opzione
.B \-F
-non è più necessaria, vista la possibilità di assegnare variabili nella riga
-di comando; viene mantenuta solo per compatibilità all'indietro.
+non è più necessaria, vista la possibilità di assegnare variabili nella riga
+di comando; viene mantenuta solo per compatibilità all'indietro.
+.PP
+Questa man page è troppo lunga;
+.I gawk
+ha troppe funzionalità.
.SH VEDERE ANCHE
.IR egrep (1),
.IR sed (1),
-.IR getpid (2),
-.IR getppid (2),
-.IR getpgrp (2),
-.IR getuid (2),
-.IR geteuid (2),
-.IR getgid (2),
-.IR getegid (2),
-.IR getgroups (2),
+.IR gawkbug (1),
.IR printf (3),
+e
.IR strftime (3),
-.IR usleep (3)
.PP
.IR "The AWK Programming Language" ,
Alfred V.\& Aho, Brian W.\& Kernighan, Peter J.\& Weinberger,
@@ -4239,17 +2434,17 @@ Addison-Wesley, 1988. ISBN 0-201-07981-X.
\*(EP,
Edizione 5.1, disponibile con il codice sorgente
.IR gawk .
-La versione originale corrente di questo documento è
+La versione originale corrente di questo documento è
disponibile online a:
-.BR https://www.gnu.org/software/gawk/manual .
+.IR https://www.gnu.org/software/gawk/manual .
.PP
La documentazione di
.B gettext
-GNU è disponibile online a:
-.BR https://www.gnu.org/software/gettext .
+GNU è disponibile online a:
+.IR https://www.gnu.org/software/gettext .
.SH ESEMPI
.nf
-Stampa ed ordina i nomi di login di tutti gli utenti:
+Stampa e ordina i nomi di login di tutti gli utenti:
.ft B
BEGIN { FS = ":" }
@@ -4282,14 +2477,17 @@ Esegui un comando esterno per alcune linee di dati:
awk '/myhome.html/ { system("nmap " $1 ">> logdir/myhome.html") }'
.ft R
.fi
+.ig
.SH RICONOSCIMENTI
Brian Kernighan
ha fornito valida assistenza durante il test e la correzione degli errori.
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, 2022
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
@@ -4313,11 +2511,11 @@ modified versions, except that this permission notice may be stated in
a translation approved by the Foundation.
.SH PERMESSI DI COPIA
-Questa è una traduzione non ufficiale in italiano dei permessi di copia
-riportati nella precedente sezione "COPYING PERMISSIONS". Non è una
-pubblicazione della Free Software Foundation, e non ha validità legale per
+Questa è una traduzione non ufficiale in italiano dei permessi di copia
+riportati nella precedente sezione "COPYING PERMISSIONS". Non è una
+pubblicazione della Free Software Foundation, e non ha validità legale per
i termini di distribuzione della documentazione; solo il testo originale
-inglese ha tale validità.
+inglese ha tale validità.
.PP
This is an unofficial translation into Italian of the above section "COPYING
PERMISSIONS". It was not published by the Free Software Foundation, and does not
@@ -4326,25 +2524,26 @@ the original English text does that.
.PP
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
+2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
+2020, 2021, 2022
Free Software Foundation, Inc.
.PP
-È permesso stampare e distribuire copie letterali di questa pagina
+È permesso stampare e distribuire copie letterali di questa pagina
di manuale, a patto che il copyright e questa nota di autorizzazione
siano conservate e presenti in ogni copia.
.ig
-È permesso elaborare questo file con il programma troff e stampare il
+È permesso elaborare questo file con il programma troff e stampare il
risultato, a patto che il documento stampato contenga una sezione
identica a questa sui permessi di ristampa, tranne che per la rimozione di
questo paragrafo (in quanto non rilevante per la pagina stampata).
..
.PP
-È permesso copiare e distribuire versioni modificate di questa
+È permesso copiare e distribuire versioni modificate di questa
pagina del manuale, sotto le condizioni poste per la copia letterale,
a patto che l'intero lavoro derivato sia distribuito secondo permessi
di stampa identici a questi.
.PP
-È permesso copiare e distribuire traduzioni di questa pagina di
+È permesso copiare e distribuire traduzioni di questa pagina di
manuale in un'altra lingua, sotto le condizioni poste sopra per le
versioni modificate, salvo che quest'informazione sui
permessi di copia e ristampa deve essere espressa in una traduzione
diff --git a/doc/it/gawktexi.in b/doc/it/gawktexi.in
index fe7c6b29..75b15bbe 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 Ottobre 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;2022
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--2022 @*
Free Software Foundation, Inc.
@end iftex
@end ifnotdocbook
@@ -424,7 +431,7 @@ URL: @uref{https://www.gnu.org/}
@c This one is correct for gawk 3.1.0 from the FSF
ISBN 1-882114-28-0
@sp 0
-Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2018 @*
+Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2022 @*
Free Software Foundation, Inc.
@sp 1
Traduzione e revisione:@*
@@ -686,8 +693,9 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
fissa.
* Separazione in base al contenuto:: Definire campi dal loro contenuto.
* File CSV:: Ancora sui file CSV.
+* FS rispetto a FPAT:: Una differenza sottile.
* 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 +885,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 +943,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 +980,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 +1009,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 +1021,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 +1050,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 +1082,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 +1102,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 +1191,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 +1220,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 +1386,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 +1802,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 +2527,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 +2747,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 +3044,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 +3302,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 +3381,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
@@ -3527,8 +3571,8 @@ awk '@{ if (length($0) > max) max = length($0) @}
Il codice associato a @code{END} viene eseguito dopo che tutto
l'input @`e stato letto; @`e l'altra faccia della medaglia di @code{BEGIN}.
-@cindex programma @subentry @command{expand}
@cindex @command{expand} (programma)
+@cindex programma @subentry @command{expand}
@item
Stampare la lunghezza della riga pi@`u lunga in @file{data}:
@@ -3689,7 +3733,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 +3742,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 +3762,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 +3987,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
@@ -4118,7 +4168,7 @@ L'elenco seguente descrive le opzioni richieste dallo standard POSIX:
@cindex opzione @subentry @option{-F}
@cindex @option{--field-separator} (opzione)
@cindex opzione @subentry @option{--field-separator}
-@cindex @code{FS} (variabile) @subentry l'opzione @code{--field-separator} e
+@cindex @code{FS} (variabile) @subentry l'opzione @option{--field-separator} e
Imposta la variabile @code{FS} a @var{fs}
(@pxref{Separatori di campo}).
@@ -4429,7 +4479,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.
@@ -4512,7 +4562,7 @@ MPFR e MP
@cindex valori @subentry esadecimali @subentry abilitare l'interpretazione di
@cindex ottali @subentry numeri @subentry abilitare l'interpretazione di
@cindex valori @subentry ottali @subentry abilitare l'interpretazione di
-@cindex risoluzione di problemi @subentry opzione @code{--non-decimal-data}
+@cindex risoluzione di problemi @subentry opzione @option{--non-decimal-data}
Abilita l'interpretazione automatica di valori ottali ed esadecimali
nei dati di input
(@pxref{Dati non decimali}).
@@ -4534,7 +4584,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)
@@ -4634,10 +4684,10 @@ i dati di input
@c @cindex automatic warnings
@c @cindex warnings, automatic
-@cindex @option{--traditional} (opzione) @subentry e opzione @code{--posix}
-@cindex opzione @subentry @option{--traditional} @subentry e opzione @code{--posix}
-@cindex @option{--posix} (opzione) @subentry e opzione @code{--traditional}
-@cindex opzione @subentry @option{--posix} @subentry e opzione @code{--traditional}
+@cindex @option{--traditional} (opzione) @subentry e opzione @option{--posix}
+@cindex opzione @subentry @option{--traditional} @subentry e opzione @option{--posix}
+@cindex @option{--posix} (opzione) @subentry e opzione @option{--traditional}
+@cindex opzione @subentry @option{--posix} @subentry e opzione @option{--traditional}
Se si forniscono entrambe le opzioni @option{--traditional} e @option{--posix}
sulla riga di comando, @option{--posix} ha la precedenza. Se vengono fornite
entrambe le opzioni @command{gawk} emette un avviso.
@@ -5018,7 +5068,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 +5076,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 +5242,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 +5440,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 +6173,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 +6368,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 trovare 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,17 +6436,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.
+@cindex Brian Kernighan @subsentry @command{awk} di @subentry espressioni di intervallo in
Come detto sopra, le espressioni di intervallo non erano tradizionalmente
-disponibili in @command{awk}. Con la versione di Marzo 2019 di
+disponibili in @command{awk}. Con la versione di marzo 2019 di
BWK @command{awk} sono (finalmente) disponibili.
+A partire dalla @value{PVERSION} 5.2 l'opzione @option{--traditional}
+di @command{gawk} non disabilita pi@`u le espressioni di intervallo
+contenute in espressioni regolari.
+
+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 in modo considerevole 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
-Ciononostante, non essendo state disponibili per parecchi decenni,
-@command{gawk} continua a non renderle disponibili quando viene
-eseguito in modalit@`a compatibile (@pxref{Opzioni}).
+@noindent
+Lo stesso vale anche per @command{gawk}.
@node Espressioni tra parentesi quadre
@section Usare espressioni tra parentesi quadre
@@ -6384,7 +6507,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 +6646,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
@@ -6879,25 +7002,24 @@ in @ref{Operatori di espressioni regolari}.
@end ifnotdocbook
@end ifnottex
-@item @code{--posix}
+@item @option{--posix}
Sono ammesse solo le @dfn{regexp} POSIX; gli operatori GNU non sono
speciali (p.es., @samp{\w} individua una semplice lettera @samp{w}).
Le espressioni di intervallo sono ammesse.
@cindex Brian Kernighan @subentry @command{awk} di
-@item @code{--traditional}
+@item @option{--traditional}
Le @dfn{regexp} Unix tradizionali di @command{awk} sono ammesse. Gli
-operatori GNU non sono speciali, e le espressioni
-di intervallo non sono ammesse.
-Le classi di caratteri POSIX (@samp{[[:alnum:]]}, etc.) sono ammesse,
-poich@'e BWK @command{awk} le prevede.
+operatori GNU non sono speciali. Poich@'e sono supportate anche da
+BWK @command{awk},
+le classi di caratteri POSIX (@samp{[[:alnum:]]}, etc.) sono disponibili.
+Quindi, anche le espressioni di intervallo sono consentite.
I caratteri descritti usando sequenze di protezione ottali ed esadecimali sono
trattati letteralmente, anche se rappresentano metacaratteri di @dfn{regexp}.
-@item @code{--re-interval}
-Sono consentite espressioni di intervallo in @dfn{regexp},
-se @option{--traditional} @`e stata specificata.
-Altrimenti, le espressioni di intervallo sono disponibili per default.
+@item @option{--re-interval}
+Quest'opzione rimane specificabile per compatibilit@`a all'indietro,
+ma non ha in pratica alcun effetto.
@end table
@node Maiuscolo-Minuscolo
@@ -7096,7 +7218,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 +7396,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 +7492,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 +7500,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 +8040,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 +8153,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 +8663,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,
@@ -8570,6 +8698,7 @@ per un esempio di tale funzione).
@menu
* File CSV:: Ancora sui file CSV.
+* FS rispetto a FPAT:: Una differenza sottile.
@end menu
@c O'Reilly doesn't like it as a note the first thing in the section.
@@ -8592,6 +8721,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 +8843,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 +8922,45 @@ $ @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 FS rispetto a FPAT
+@subsection @code{FS} rispetto a @code{FPAT}: Una differenza sottile
+
+Come gi@`a spiegato, @code{FS} descrive i dati che si trovano tra un campo e
+l'altro (``ci@`o che non @`e un campo'') mentre @code{FPAT} descrive i campi stessi
+(``ci@`o che @`e un campo'').
+Ci@`o pu@`o portare a una sottile differenza nell'individuazione dei campi, se si usano
+@dfn{regexp} [espressioni regolari] come valori per @code{FS} o @code{FPAT}.
+
+Per distinguere un campo da un altro, ci dev'essere un separatore (diverso dalla stringa
+nulla) fra i campi stessi. Ci@`o @`e evidentemente sensato---altrimenti non si potrebbero
+distinguere i campi dai separatori.
+
+Quindi, il valore di un'espressione regolare specificata come @code{FS} non pu@`o
+essere la stringa nulla; dev'essere lunga almeno un carattere, per poter
+esguire i controlli sull'intero record.
+
+D'altro canto, il valore di un'espressione regolare specificata come @code{FPAT}
+pu@`o essere la stringa nulla, e i caratteri che non corrispondono ad essa
+vengono utilizzati come separatori.
+
+Questa stessa differenza si riscontra nel modo con cui si individuano le
+stringhe utilizzando le funzioni @code{split()} e @code{patsplit()}
+(@pxref{Funzioni per stringhe}).
+
@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 +10368,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 +10619,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 +10643,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 +10716,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 +11951,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 +12468,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 +12499,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 +12673,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 +13388,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 +13561,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 +15233,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 +15365,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 +15432,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:
@@ -15635,22 +15873,26 @@ awk '
Questo programma stampa i primi tre campi di ogni record in input,
mettendo un unico campo in una riga in output.
-Non @`e possibile impostare
-pi@`u di una variabile nella parte di
-@var{inizializzazione} senza usare un'istruzione di assegnamento multiplo,
-come @samp{x = y = 0}. Ci@`o ha senso solo se tutti i valori iniziali
-sono uguali. (Ma @`e possibile inizializzare ulteriori variabili scrivendo
-i relativi assegnamenti come istruzioni separate @emph{prima} del ciclo
-@code{for}.)
-
@c @cindex comma operator, not supported
-Lo stesso vale per la parte @var{incremento}. Se serve incrementare ulteriori
-variabili, questo va fatto con istruzioni separate alla fine del ciclo.
-L'espressione composta del linguaggio C, che usa l'operatore virgola [,]
-del C, sarebbe
-utile in questo contesto, ma non @`e
-prevista in @command{awk}.
+Chi programma in C e C++ potrebbe aspettarsi di essere in grado di
+usare l'operatore "virgola" (",") per impostare pi@`u di una
+variabile nella parte di @var{inizializzazione} del ciclo @code{for},
+o per aumentare pi@`u di una variabile nella parte @var{incremento}
+del ciclo, cos@`{@dotless{i}}:
+
+@example
+for (i = 0, j = length(a); i < j; i++, j--) @dots{} @ii{C/C++, non awk!}
+@end example
+@noindent
+Non @`e possibile farlo; l'operatore "," non @`e supportato in @command{awk}.
+Ci sono dei modi per ottenere un tale risultato, ma non sono semplici,
+e possono generare del codice difficile sia da leggere che da
+comprendere. @`E quindi meglio scrivere le istruzioni di
+inizializzazione come istruzioni a parte, prima del ciclo
+@code{for}, e inserire ulteriori istruzioni di incremento variabili
+alla fine del codice all'interno del ciclo stesso.
+
Molto spesso, @var{incremento} @`e un'espressione di incremento, come
nell'esempio precedente. Ma questo non @`e obbligatorio; pu@`o trattarsi di
un'espressione qualsiasi. Per esempio,
@@ -16060,16 +16302,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 +16446,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.
@@ -16370,7 +16620,7 @@ costituito da un unico carattere.
@cindex differenze tra @command{awk} e @command{gawk} @subentry variabile @code{LINT}
@cindex @dfn{lint} @subentry controlli
@cindex controllo @subentry @dfn{lint}
-@item LINT o
+@item LINT #
Quando questa variabile @`e vera (non uguale a zero e non uguale alla stringa
nulla), @command{gawk} si comporta come se fosse stata specificata sulla
riga di comando l'opzione @option{--lint}
@@ -16694,7 +16944,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 +17641,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 +19159,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 +19261,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 +19351,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 +19476,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 +19612,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 +19632,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 +19687,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}
@@ -20006,6 +20323,18 @@ I caratteri non alfabetici non vengono modificati. Per esempio,
@code{"MAIUSCOLO MINUSCOLO 123"}.
@end table
+A prima vista, le funzioni @code{split()} e @code{patsplit()} sembrano
+essere immagini speculari l'una dell'altra. Ma ci sono delle differenze:
+
+@itemize @bullet
+@item @code{split()} tratta il suo terzo argomento allo stesso modo della
+variabile @code{FS}, con tutte le regole speciali che riguardano
+@code{FS}.
+
+@item L'individuazioni di stringhe nulle @`e invece differente.
+Questo @`e spiegato in @ref{FS rispetto a FPAT}.
+@end itemize
+
@sidebar Individuare la stringa nulla
@cindex individuare @subentry la stringa nulla
@cindex stringa nulla @subentry individuare la
@@ -21037,7 +21366,7 @@ In aggiunta a ci@`o, le notazioni alternative sono riconosciute, ma al
loro posto sono usate quelle normali.
@cindex @code{date} (programma di utilit@`a POSIX)
-@cindex programma di utilit@`a POSIX @subentry @code{date}
+@cindex programma di utilit@`a POSIX @subentry @command{date}
@cindex POSIX @command{awk} @subentry @code{date} (programma di utilit@`a)
Il seguente esempio @`e un'implementazione @command{awk} del
programma di utilit@`a POSIX @command{date}.
@@ -21304,8 +21633,8 @@ che illustra l'uso di queste funzioni:
@cindex @code{bits2str()} @subentry funzione definita dall'utente
@cindex funzione definita dall'utente @subentry @code{bits2str()}
-@cindex @code{testbits.awk} (programma)
-@cindex programma @subentry @code{testbits.awk}
+@cindex @file{testbits.awk} (programma)
+@cindex programma @subentry @file{testbits.awk}
@example
@group
@c file eg/lib/bits2str.awk
@@ -21449,8 +21778,9 @@ $ @kbd{gawk -M 'BEGIN @{ printf "%#x\n", compl(42) @}'}
@print{} 0xffffffffffffffd5
@end example
-Quando si usa l'opzione @option{-M}, nel dettaglio, @command{gawk} usa
-gli interi a precisione arbitraria di GNU MP che hanno almeno 64 bit di precisione.
+Quando si usa l'opzione @option{-M}, ``sotto il coperchio'', @command{gawk} usa
+gli interi a precisione arbitraria di GNU MP che hanno almeno 64 bit di
+precisione.
Quando non si usa l'opzione @option{-M}, @command{gawk} memorizza i valori
interi come regolari valori in virgola mobile con doppia precisione, che
mantengono solo 53 bit di precisione. Inoltre, la libreria GNU MP tratta
@@ -21458,8 +21788,9 @@ mantengono solo 53 bit di precisione. Inoltre, la libreria GNU MP tratta
cos@`{@dotless{i}} il
risultato con @option{-M} in questo caso @`e un numero negativo.
-In breve, usare @command{gawk} per qualsiasi tipo di operazione "bit a bit",
-tranne le pi@`u semplici, probabilmente @`e una cattiva idea; @dfn{caveat emptor}!
+In poche parole, usare @command{gawk} per qualsiasi tipo di operazione
+"bit a bit", tranne le pi@`u semplici, probabilmente @`e una cattiva idea;
+@dfn{caveat emptor}!
@end sidebar
@@ -21497,6 +21828,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.
@@ -21568,6 +21902,31 @@ Tuttavia, se si chiama @code{isarray()} e @code{typeof()} queste
funzioni non cambiano gli argomenti che vengono passati loro da
non ancora tipizzati (untyped) a non ancora assegnati (unassigned).
+@cindex angolo buio @subentry elementi di un vettore creati per riferimento
+Per ``variabile'' intendiamo quelle descritte da un identificativo semplice.
+Elementi di un vettore che vengono creati semplicemente facendo un
+riferimento agli stessi sono differenti, e sono automaticamente forzati
+a essere delle variabili scalari. Si consideri:
+
+@example
+$ @kbd{gawk 'BEGIN @{ print typeof(x) @}'}
+@print{} untyped
+$ @kbd{gawk 'BEGIN @{ print typeof(x["pippo"]) @}'}
+@print{} unassigned
+@end example
+
+@noindent
+@code{x["pippo"]} viene creato prima di essere passato alla funzione
+@code{typeof()}; @code{typeof()} non @`e in grado di determinare se
+esisteva o no prima che la funzione fosse chiamata.
+@value{DARKCORNER}
+
+@c FIXME: For 5.2, if this will change, update this bit of doc.
+@c This may change in a future release, whereby @command{gawk}
+@c would allow such an unassigned array element to be used for
+@c a multidimensional array, and not remain a scalar forever
+@c (or until deleted).
+
@node Funzioni di internazionalizzazione
@subsection Funzioni per tradurre stringhe
@cindex @command{gawk} @subentry funzioni di traduzione di stringhe
@@ -21778,8 +22137,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 +22820,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 +22897,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
@@ -22838,19 +23210,33 @@ in maniera indiretta delle funzioni predefinite, come qui dettagliato:
@itemize @value{BULLET}
@item
Non si pu@`o passare una costante @dfn{regexp} a una funzione predefinita
-effettuando una chiamata di funzione indiretta.@footnote{Questa
-limitazione potrebbe cambiare in una futura versione;
-per appurarlo, si controlli la documentazione che accompagna
-la versione in uso di @command{gawk}.}
+effettuando una chiamata di funzione indiretta.
Quanto sopra vale per le funzioni
@code{sub()}, @code{gsub()}, @code{gensub()}, @code{match()},
-@code{split()} e @code{patsplit()}.
+@code{split()} e @code{patsplit()}. Si pu@`o comunque passare a tali
+funzioni un'espressione regolare fortemente tipizzata
+(@pxref{Costanti @dfn{regexp} forti}).
@item
Nel chiamare @code{sub()} o @code{gsub()}, sono accettati solo due argomenti,
poich@'e queste funzioni sono atipiche, in quanto aggiornano il loro terzo
argomento. Questo significa che verr@`a sempre aggiornato l'argomento di
default, @code{$0}.
+
+@item
+Non @`e possibile chiamare indirettamente quelle funzioni predefinite
+che accettano @code{$0} come parametro di default; occorre invece fornire
+esplicitamente un argomento. Per esempio, occorre passare un argomento
+alla funzione @code{length()} se viene chiamata indirettamente.
+
+@item
+Quando si chiama indirettamente una funzione predefinita e si specifica
+un numero errato di argomenti per tale funzione, viene generato un
+errore fatale. Per esempio, quando si chiama la funzione
+@code{length()} specificando due argomenti. Tali errori sono rilevati
+al momento dell'esecuzione della chiamata, e non quando @command{gawk}
+analizza il programma, poich@'e @command{gawk} non @`e in grado di stabilire
+prima di allora se il numero di argomenti passato sia corretto o no.
@end itemize
@command{gawk} fa del suo meglio per rendere efficiente la chiamata indiretta
@@ -23187,7 +23573,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 +23594,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 +23622,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 +24463,50 @@ function shell_quote(s, # parametro
@c endfile
@end example
+@node Funzione isnumeric
+@subsection Controllare se un valore @`e numerico
+
+Una domanda ricorrente sulla programmazione @`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 dall'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 @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 +24514,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
@@ -24321,7 +24774,8 @@ Tuttavia, il codice qui proposto fornisce una soluzione portabile.}
Si pu@`o far questo facendo precedere il proprio programma @command{awk} dal
seguente programma:
-@cindex @code{readable.awk} (programma)
+@cindex @file{readable.awk} (programma)
+@cindex programma @subentry @file{readable.awk}
@example
@c file eg/lib/readable.awk
# readable.awk --- file di libreria per saltare file non leggibili
@@ -24385,7 +24839,8 @@ Usando la variabile @code{ARGIND} di @command{gawk}
di nome @code{zerofile()} che l'utente deve fornire. Gli argomenti passati
sono il @value{FN} e la posizione del file in @code{ARGV}:
-@cindex @code{zerofile.awk} (programma)
+@cindex @file{zerofile.awk} (programma)
+@cindex programma @subentry @file{zerofile.awk}
@example
@c file eg/lib/zerofile.awk
# zerofile.awk --- file di libreria per elaborare file in input vuoti
@@ -24449,8 +24904,8 @@ Alcuni utenti hanno suggerito un'opzione aggiuntiva da riga di comando per
Comunque, poche righe di codice di programmazione in un file di libreria
hanno lo stesso effetto:
-@cindex @code{noassign.awk} (programma)
-@cindex programma @subentry @code{noassign.awk}
+@cindex @file{noassign.awk} (programma)
+@cindex programma @subentry @file{noassign.awk}
@example
@c file eg/lib/noassign.awk
# noassign.awk --- file di libreria per evitare la necessit@`a
@@ -24975,8 +25430,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
@@ -25049,7 +25504,8 @@ un file non accessibile dall'utente normale. La struttura del file
@file{/etc/passwd} @`e rimasta la stessa, ma al posto del campo @dfn{password}
c'@`e una @code{x}.}
-@cindex @command{pwcat} (programma)
+@cindex @command{pwcat} (programma C)
+@cindex programma C @subentry @command{pwcat}
Sebbene un programma @command{awk} possa semplicemente leggere
@file{/etc/passwd} direttamente, questo file pu@`o non contenere tutte le
informazioni su tutti gli utenti del sistema.@footnote{Capita spesso che le
@@ -25109,11 +25565,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 +25575,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
@@ -25447,6 +25903,7 @@ piccolo programma in C che genera la lista dei gruppi come suo output.
@cindex @command{grcat} (programma C)
@cindex programma C @subentry @command{grcat}
+@cindex @command{grcat} (programma C)
@example
@c file eg/lib/grcat.c
/*
@@ -26138,7 +26595,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 +26663,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,13 +26680,19 @@ 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
argomenti non validi:
-@cindex @code{cut.awk} (programma)
-@cindex programma @subentry @code{cut.awk}
+@cindex @file{cut.awk} (programma)
+@cindex programma @subentry @file{cut.awk}
@example
@c file eg/prog/cut.awk
# cut.awk --- implementa cut in awk
@@ -26237,9 +26707,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 +26785,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.
@@ -26574,8 +27044,8 @@ da implementare con @command{gawk}; basta usare la variabile predefinita
@code{IGNORECASE}
(@pxref{Variabili predefinite}):
-@cindex @code{egrep.awk} (programma)
-@cindex programma @subentry @code{egrep.awk}
+@cindex @file{egrep.awk} (programma)
+@cindex programma @subentry @file{egrep.awk}
@example
@c file eg/prog/egrep.awk
# egrep.awk --- simula egrep in awk
@@ -26595,11 +27065,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 +27103,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 +27167,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 +27207,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,18 +27328,18 @@ 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)
-@cindex programma @subentry @code{id.awk}
+@cindex @file{id.awk} (programma)
+@cindex programma @subentry @file{id.awk}
@example
@c file eg/prog/id.awk
# id.awk --- implement id in awk
@@ -26903,9 +27376,9 @@ function sintassi()
@{
printf("Uso:\n" \
"\tid [user]\n" \
- "\tid −G [−n] [user]\n" \
- "\tid −g [−nr] [user]\n" \
- "\tid −u [−nr] [user]\n") > "/dev/stderr"
+ "\tid -G [-n] [user]\n" \
+ "\tid -g [-nr] [user]\n" \
+ "\tid -u [-nr] [user]\n") > "/dev/stderr"
exit 1
@}
@@ -26939,7 +27412,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 +27431,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 +27548,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 +27729,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,10 +27758,12 @@ 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}
+@cindex @file{split.awk} (programma)
+@cindex programma @subentry @file{split.awk}
@example
@c file eg/prog/split.awk
# split.awk --- comando split scritto in awk
@@ -27306,10 +27781,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 +27879,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
@@ -27626,8 +28103,8 @@ esce.
Infine, @command{awk} viene obbligato a leggere lo standard input
impostando @code{ARGV[1]} al valore @code{"-"} e @code{ARGC} a due:
-@cindex @code{tee.awk} (programma)
-@cindex programma @subentry @code{tee.awk}
+@cindex @file{tee.awk} (programma)
+@cindex programma @subentry @file{tee.awk}
@example
@c file eg/prog/tee.awk
# tee.awk --- tee in awk
@@ -27779,8 +28256,8 @@ e la funzione di libreria @code{join()}
Il programma inizia con una funzione @code{sintassi()} e poi con una breve
spiegazione delle opzioni e del loro significato, sotto forma di commenti:
-@cindex @code{uniq.awk} (programma)
-@cindex programma @subentry @code{uniq.awk}
+@cindex @file{uniq.awk} (programma)
+@cindex programma @subentry @file{uniq.awk}
@example
@c file eg/prog/uniq.awk
@group
@@ -27801,7 +28278,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 +28541,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 +28568,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 +28588,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
@@ -28151,8 +28629,8 @@ La regola @code{BEGIN} elabora gli argomenti. La variabile
@code{stampa_totale} @`e vera se pi@`u di un file @`e presente sulla
riga di comando:
-@cindex @code{wc.awk} (programma)
-@cindex programma @subentry @code{wc.awk}
+@cindex @file{wc.awk} (programma)
+@cindex programma @subentry @file{wc.awk}
@example
@c file eg/prog/wc.awk
# wc.awk --- conta righe, parole, caratteri, byte
@@ -28295,7 +28773,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
@@ -28354,8 +28839,8 @@ Se, dopo aver rimosso tutta la punteggiatura, non rimane alcun campo, il
record corrente @`e saltato. In caso contrario, il programma esegue il ciclo
per ogni parola, confrontandola con quella che la precede:
-@cindex @code{dupword.awk} (programma)
-@cindex programma @subentry @code{dupword.awk}
+@cindex @file{dupword.awk} (programma)
+@cindex programma @subentry @file{dupword.awk}
@example
@c file eg/prog/dupword.awk
# dupword.awk --- trova parole duplicate in un testo
@@ -28454,8 +28939,8 @@ Per amor di variet@`a, questo programma usa un'istruzione @code{switch}
con una serie di istruzioni @code{if}-@code{else}.
Ecco il programma:
-@cindex @code{alarm.awk} (programma)
-@cindex programma @subentry @code{alarm.awk}
+@cindex @file{alarm.awk} (programma)
+@cindex programma @subentry @file{alarm.awk}
@example
@c file eg/prog/alarm.awk
# alarm.awk --- impostare una sveglia
@@ -28518,7 +29003,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
@@ -28662,8 +29154,8 @@ come stringa. Il programma principale imposta due variabili globali, @code{DA}
Infine, la regola di elaborazione si limita a chiamare @code{traducilo()}
per ogni record:
-@cindex @code{translate.awk} (programma)
-@cindex programma @subentry @code{translate.awk}
+@cindex @file{translate.awk} (programma)
+@cindex programma @subentry @file{translate.awk}
@example
@c file eg/prog/translate.awk
# translate.awk --- fa cose simili al comando tr
@@ -28821,8 +29313,8 @@ La regola @code{END} si occupa di stampare l'ultima pagina di
etichette; @`e improbabile che il numero di indirizzi da stampare sia un
multiplo esatto di 20:
-@cindex @code{labels.awk} (programma)
-@cindex programma @subentry @code{labels.awk}
+@cindex @file{labels.awk} (programma)
+@cindex programma @subentry @file{labels.awk}
@example
@c file eg/prog/labels.awk
# labels.awk --- stampare etichette per lettera
@@ -28966,8 +29458,8 @@ risolvere il terzo problema si pu@`o usare il programma di utilit@`a
@command{sort} per elaborare l'output dello @dfn{script} @command{awk}. Ecco la
nuova versione del programma:
-@cindex @code{wordfreq.awk} (programma)
-@cindex programma @subentry @code{wordfreq.awk}
+@cindex @file{wordfreq.awk} (programma)
+@cindex programma @subentry @file{wordfreq.awk}
@example
@c file eg/prog/wordfreq.awk
# wordfreq.awk --- stampa la lista con la frequenza delle parole
@@ -29064,8 +29556,8 @@ incontrate.
La regola @code{END} stampa semplicemente le righe, in ordine:
@cindex Rakitzis, Byron
-@cindex @code{histsort.awk} (programma)
-@cindex programma @subentry @code{histsort.awk}
+@cindex @file{histsort.awk} (programma)
+@cindex programma @subentry @file{histsort.awk}
@example
@c file eg/prog/histsort.awk
# histsort.awk --- compatta un file della cronologia dei comandi della shell
@@ -29138,7 +29630,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
@@ -29167,7 +29659,7 @@ e anche @uref{https://www.gnu.org/software/texinfo/manual/texinfo/, online}.)
@end ifnotinfo
@ifinfo
(Il linguaggio Texinfo @`e descritto esaurientemente, a partire da
-@inforef{Top, , Texinfo, texinfo,Texinfo --- The GNU Documentation Format}.)
+@ref{Top, , Texinfo, texinfo,Texinfo---The GNU Documentation Format}.)
@end ifinfo
Per quel che ci riguarda, @`e sufficiente sapere tre cose riguardo ai file di
@@ -29246,8 +29738,8 @@ stato fornito un comando (@code{NF} dev'essere almeno tre) e controllando
anche che il comando termini con un codice di ritorno uguale a zero, che sta
a significare che tutto @`e andato bene:
-@cindex @code{extract.awk} (programma)
-@cindex programma @subentry @code{extract.awk}
+@cindex @file{extract.awk} (programma)
+@cindex programma @subentry @file{extract.awk}
@example
@c file eg/prog/extract.awk
# extract.awk --- estrae file ed esegue programmi dal file Texinfo
@@ -29258,6 +29750,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 +29858,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
@}
@@ -29468,8 +29961,8 @@ come un nome di @value{DF} da elaborare. Se non ne viene fornito alcuno, si
usa lo standard input:
@cindex Brennan, Michael
-@cindex @command{awksed.awk} (programma)
-@cindex programma @subentry @command{awksed.awk}
+@cindex @file{awksed.awk} (programma)
+@cindex programma @subentry @file{awksed.awk}
@c @cindex simple stream editor
@c @cindex stream editor, simple
@example
@@ -29565,7 +30058,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 +30232,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
@@ -30065,8 +30564,8 @@ Il programma seguente usa vettori di vettori per riunire
parole con la stessa firma, e l'ordinamento di vettori per stampare le
parole trovate in ordine alfabetico:
-@cindex @code{anagram.awk} (programma)
-@cindex programma @subentry @code{anagram.awk}
+@cindex @file{anagram.awk} (programma)
+@cindex programma @subentry @file{anagram.awk}
@example
@c file eg/prog/anagram.awk
# anagram.awk --- Un'implementazione dell'algoritmo per trovare anagrammi
@@ -30373,7 +30872,7 @@ informazioni stampare. Modificare la versione @command{awk}
stesso modo.
@item
-Il programma @code{split.awk} (@pxref{Programma split}) presuppone che le
+Il programma @file{split.awk} (@pxref{Programma split}) presuppone che le
lettere siano contigue nella codifica dei caratteri,
il che non @`e vero per sistemi che usano la codifica EBCDIC.
Risolvere questo problema.
@@ -30612,12 +31111,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
@@ -30666,10 +31167,10 @@ e poich@'e l'uso di questa funzionalit@`a pu@`o portare a risultati inattesi, il
comportamento di default @`e quello lasciarla disabilitata. Se si vuole, la si
deve richiedere esplicitamente.
-@cindex programmazione @subentry convenzioni di @subentry opzione @code{--non-decimal-data}
+@cindex programmazione @subentry convenzioni di @subentry opzione @option{--non-decimal-data}
@cindex @option{--non-decimal-data} (opzione) @subentry funzione @code{strtonum()} e
@cindex opzione @subentry @option{--non-decimal-data} @subentry funzione @code{strtonum()} e
-@cindex @code{strtonum()} (funzione @command{gawk}) @subentry opzione @code{--non-decimal-data} e
+@cindex @code{strtonum()} (funzione @command{gawk}) @subentry opzione @option{--non-decimal-data} e
@quotation ATTENZIONE
@emph{L'uso di questa opzione non @`e consigliata.}
Pu@`o provocare errori molto seri eseguendo vecchi programmi.
@@ -30681,6 +31182,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 proprio:
+un valore @`e ``true'' [vero] se @`e diverso da zero e dalla stringa nulla
+e ``false'' [falso] in tutti gli altri casi.
+
+Se si 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 +31648,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
@@ -31169,6 +31725,20 @@ $ @kbd{gawk -f confronta_in_minuscolo.awk}
@print{} n N O o p P Q q r R S s t T u U V v w W X x y Y z Z
@end example
+@quotation NOTA
+``Sotto il coperchio,'' @command{gawk} usa la funzione di libreria
+C @code{qsort()} per gestire le operazioni di ordinamento.
+@code{qsort()} pu@`o anche chiamare se stesso ricorsivamente.
+Ci@`o implica che, nello scrivere una funzione di confronto, si
+dovrebbe stare attenti a evitare l'uso di variabili e di vettori
+globali; si dovrebbero usare solo variabili locali e vettori che
+sono definiti come parametri ulteriori passati alla funzione che
+effettua il confronto. In caso contrario, @`e possibile che avvengano
+delle corruzioni inintenzionali di memoria dei vettori
+globali e anche che lo stesso programma @command{gawk} finisca con
+un errore.
+@end quotation
+
@node I/O bidirezionale
@section Comunicazioni bidirezionali con un altro processo
@@ -31435,7 +32005,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,
@@ -31581,8 +32151,7 @@ Stampa poi il risultato e chiude la connessione.
Poich@'e questo tema @`e molto ampio, l'uso di @command{gawk} per
la programmazione TCP/IP viene documentato separatamente.
@ifinfo
-Si veda
-@inforef{Top, , General Introduction, gawkinet, @value{GAWKINETTITLE}},
+@xref{Top, , General Introduction, gawkinet, @value{GAWKINETTITLE}},
@end ifinfo
@ifnotinfo
Si veda
@@ -31828,7 +32397,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 +32492,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 +32502,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 +32517,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 +32641,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 +32723,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 +32866,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
@@ -32562,8 +33209,8 @@ si crea il file iniziale @file{.pot}:
gawk --gen-pot -f guide.awk > guide.pot
@end example
-@cindex @code{xgettext} (programma di utilit@`a)
-@cindex programma di utilit@`a @subentry @code{xgettext}
+@cindex @command{xgettext} (programma di utilit@`a)
+@cindex programma di utilit@`a @subentry @command{xgettext}
Quando viene chiamato specificando @option{--gen-pot}, @command{gawk} non
esegue il programma. Il programma viene esaminato come al solito, e tutte
le stringhe che sono state marcate per essere tradotte vengono scritte nello
@@ -32717,7 +33364,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}.
@@ -32955,7 +33602,7 @@ usando il pacchetto GNU @command{gettext}.
(GNU @command{gettext} @`e descritto in
maniera esauriente in
@ifinfo
-@inforef{Top, , GNU @command{gettext} utilities, gettext, GNU @command{gettext} utilities}.)
+@xref{Top, , GNU @command{gettext} utilities, gettext, GNU @command{gettext} utilities}.)
@end ifinfo
@ifnotinfo
@uref{https://www.gnu.org/software/gettext/manual/,
@@ -33045,7 +33692,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 +33818,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 +34233,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 +34670,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 +35292,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 +35733,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 +35797,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 +35832,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 +36020,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 +36150,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 +36182,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 +36204,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 +36331,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 +37199,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 +37237,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 +37287,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 +37931,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 +37945,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 +37961,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 +38273,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 +38324,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 +38360,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
@@ -37471,15 +38380,22 @@ assegnandogli dei puntatori. Per esempio:
@example
char *p = gawk_malloc(42); p @ii{``possiede'' la memoria}
char *q = p;
-p = NULL; @ii{ora} q @ii{la ``possiede''}
+p = NULL; @ii{adesso} q @ii{la ``possiede''}
@end example
-Gli oggetti MPFR e GMP sono certamente allocati sullo @dfn{stack}
+Gli oggetti MPFR e GMP sono in effetti allocati sullo @dfn{stack}
oppure dinamicamente, ma le librerie MPFR e GMP trattano questi
oggetti come valori, allo stesso modo in cui si passa normalmente
un valore intero (@code{int}) o uno a virgola mobile a doppia
precisione (@code{double}) per valore. Non c'@`e modo di
``trasferire il possesso'' di oggetti MPFR e GMP.
+
+Il risultato finale di un calcolo effettuato tramite MPFR o GMP
+dovrebbe essere restituito a @command{gawk} per valore, come
+si farebbe se si trattasse di una stringa o di un numero
+a virgola mobile a doppia precisione (@code{double}).
+@command{gawk} liberer@`a la memoria occupata dal numero stesso.
+
Per questo motivo, il codice in un'estensione dovrebbe essere
simile a questo:
@@ -37494,11 +38410,10 @@ mpz_add(risposta, part1, part2);
/* di tipo (awk_value_t *). */
make_number_mpz(risposta, & risultato); @ii{assegnare valore finale GMP}
-mpz_clear(part1); @ii{rilasciare valori intermedi}
+mpz_clear(part1); @ii{rilasciare valori intermedi}
mpz_clear(part2);
-mpz_clear(risposta);
-return result;
+return risultato; @ii{valore in @code{risposta} gestito da @code{gawk}}
@end example
@node Funzioni di registrazione
@@ -37506,7 +38421,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 +38945,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 +39249,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 +39260,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 +39273,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 +39286,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 +39295,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 +39304,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 +39312,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 +39339,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 +39350,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 +39363,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 +39381,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 +39415,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 +39451,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 +39500,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 +39514,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}.
@@ -38591,6 +39538,13 @@ gi@`a esistente @emph{non} @`e consentito, e questa routine non pu@`o neppure
essere usata per aggiornare un vettore.
Questa routine non pu@`o essere usata per modificare nessuna delle variabili
predefinite (come @code{ARGC} o @code{NF}).
+
+@item awk_bool_t sym_update_ns(const char *name_space, const char *nome, awk_value_t *valore);
+Simile a @code{sym_update()}, ma il parametro @code{name_space} consente di
+specificare a quale spazio-di-nomi appartiene @code{nome}.
+@code{name_space} non pu@`o essere la stringa nulla (@code{NULL}).
+Se vale @code{""} o @code{"awk"}, allora @code{nome} @`e cercato nello
+spazio-di-nomi di default, ossia @code{awk}.
@end table
Un'estensione pu@`o andare a cercare il valore delle variabili speciali di
@@ -38614,7 +39568,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 +39655,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 +39696,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 +39937,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 +41590,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
@@ -41278,8 +42254,9 @@ anche in questo caso @`e:
@node Esempio di estensione Rwarray
@subsection Scaricare e ricaricare un vettore
-L'estensione @code{rwarray} aggiunge due funzioni,
-di nome @code{writea()} e @code{reada()}, come segue:
+L'estensione @code{rwarray} aggiunge quattro funzioni,
+di nome @code{writea()}, @code{reada()},
+@code{writeall()} e @code{readall()}, come segue:
@table @code
@item @@load "rwarray"
@@ -41297,11 +42274,31 @@ valore uno se completa il lavoro o zero se non va a buon fine.
@cindex estensione @subentry @code{reada()}
@item ret = reada(file, vettore)
@code{reada()} @`e la funzione inversa di @code{writea()};
-legge il file il cui nome @`e fornito come primo argomento, riempiendo il
+legge il file il cui nome @`e fornito come primo argomento, caricando il
vettore il cui nome @`e il secondo argomento. Il vettore viene preventivamente
svuotato.
-Anche in questo caso, il valore restituito @`e uno se tutto va bene o zero se
-la funzione non va a buon fine.
+Anche in questo caso, la funzione restituisce il valore uno se completa il
+il lavoro o zero se non va a buon fine.
+
+@cindex @code{writeall()} (estensione)
+@cindex estensione @subentry @code{writeall()}
+@item ret = writeall(file)
+Questa funzione ha come argomento una stringa, che @`e il nome del file
+sul quale scaricare tutte le variabili e i rispettivi valori.
+Chiamare questa funzione @`e completamente equivalente a chiamare
+@code{writea(file, SYMTAB)}. Restituisce il
+valore uno se completa il lavoro o zero se non va a buon fine.
+
+@cindex @code{readall()} (estensione)
+@cindex estensione @subentry @code{readall()}
+@item ret = readall(file)
+Questa funzione ha come argomento una stringa, che @`e il nome del file
+dal quale leggere i valori di molteplici variabili globali.
+Per ogni variabile contenuta nel file, il relativo valore viene
+caricato, a meno che la variabile sia gi@`a esistente.
+Se la variabile esiste gi@`a, il valore della variabile specificato
+nel file viene ignorato. Restituisce il
+valore uno se completa il lavoro o zero se non va a buon fine.
@end table
Il vettore creato da @code{reada()} @`e identico a quello scritto da
@@ -41325,6 +42322,16 @@ stringa possono essere scaricati da un sistema con un certo ordine di byte
e ripristinati su un sistema con un ordine di byte differente, anche se
un test al riguardo non @`e mai stato fatto.
+Si noti che le funzioni @code{writeall()} e @code{readall()} forniscono
+un meccanismo che consente di ripristinare una situazione esistente
+nel caso in cui si chiami ripetutamente lo stesso programma.
+Se, per esempio, un programma calcola alcune statistiche basandosi sui
+dati contenuti in una serie di file, si potrebbe salvare lo stato delle
+variabili usando la funzione @code{writeall()} dopo aver elaborato
+N file, e in seguito ricaricare lo stato delle variabili usando la
+funzione @code{readall()} quando @`e disponibile il file N+1, cos@`{@dotless{i}}
+da poter aggiornare i risultati.
+
Ecco un esempio:
@example
@@ -41333,6 +42340,10 @@ Ecco un esempio:
ret = writea("scaricato.bin", vettore)
@dots{}
ret = reada("scaricato.bin", vettore)
+@dots{}
+ret = writeall("situazione-corrente.bin")
+@dots{}
+ret = readall("situazione-corrente.bin")
@end example
@node Esempio di estensione Readfile
@@ -41518,7 +42529,7 @@ Poi, dal sito @url{https://sourceforge.net/projects/gawkextlib/files} si deve
scaricare @code{gawkextlib} e le estensioni che si vogliono installare.
Il file @file{README} del sito spiega come compilare il codice. Se si @`e
installato @command{gawk} in una posizione non-standard, occorre
-specificare @code{./configure --with-gawk=@var{/percorso/del/programma/gawk}}
+specificare @samp{./configure --with-gawk=@var{/percorso/del/programma/gawk}}
per far s@`{@dotless{i}} che venga trovato.
Pu@`o essere necessario usare il programma di utilit@`a @command{sudo}
per installare sia @command{gawk} che @code{gawkextlib}, a seconda di come
@@ -41809,7 +42820,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 +43574,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 +43738,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 +43851,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 +44077,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 +44125,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 +44278,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} (@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 +44485,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 +44865,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 +44920,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 +44929,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 +45010,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 altre 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 altre sottodirectory.
@item COPYING
La @dfn{GNU General Public License}.
@@ -43974,7 +45044,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
@@ -44018,7 +45088,7 @@ Il file Info generato per questo @value{DOCUMENT}.
@item doc/gawkinet.texi
Il file sorgente Texinfo per
@ifinfo
-@inforef{Top, , Introduzione generale, gawkinet, @value{GAWKINETTITLE}}.
+@ref{Top, , Introduzione generale, gawkinet, @value{GAWKINETTITLE}}.
@end ifinfo
@ifnotinfo
@cite{@value{GAWKINETTITLE}}.
@@ -44032,6 +45102,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
+@ref{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/gawkworkflow.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 +45249,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.
@@ -44188,7 +45281,7 @@ della Free Software Foundation}.)
@end ifnotinfo
@ifinfo
(Il software Autoconf @`e descritto in dettaglio a partire da
-@inforef{Top, , Autoconf, autoconf,Autoconf --- Generating Automatic Configuration Scripts}.)
+@ref{Top, , Autoconf, autoconf,Autoconf---Generating Automatic Configuration Scripts}.)
@end ifinfo
Per configurare @command{gawk} basta eseguire @command{configure}:
@@ -44249,6 +45342,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
@@ -44325,7 +45443,7 @@ L'azione di default @`e di controllare dinamicamente se le estensioni
possono essere configurate e compilate.
@cindex @option{--disable-lint} (opzione di configurazione)
-@cindex opzioni di configurazione @subentry @code{--disable-lint}
+@cindex opzioni di configurazione @subentry @option{--disable-lint}
@item --disable-lint
Disabilitare i controlli @dfn{lint} all'interno di @command{gawk}. Le opzioni
@option{--lint} e @option{--lint-old}
@@ -44350,7 +45468,7 @@ Quest'opzione potr@`a essere rimossa in futuro.
@end quotation
@cindex @option{--disable-mpfr} (opzione di configurazione)
-@cindex opzioni di configurazione @subentry @code{--disable-mpfr}
+@cindex opzioni di configurazione @subentry @option{--disable-mpfr}
@item --disable-mpfr
Non effettuare il controllo delle librerie MPFR e GMP.
Ci@`o pu@`o essere utile principalmente per gli sviluppatori,
@@ -44358,14 +45476,14 @@ per assicurarsi che tutto funzioni regolarmente nel caso in cui
il supporto MPFR non sia disponibile.
@cindex @option{--disable-nls} (opzione di configurazione)
-@cindex opzioni di configurazione @subentry @code{--disable-nls}
+@cindex opzioni di configurazione @subentry @option{--disable-nls}
@item --disable-nls
Non attivare la traduzione automatica dei messaggi.
Ci@`o normalmente non @`e consigliabile, ma pu@`o apportare qualche lieve
miglioramento nei tempi di esecuzione di un programma.
@cindex @option{--enable-versioned-extension-dir} (opzione di configurazione)
-@cindex opzioni di configurazione @subentry @code{--enable-versioned-extension-dir}
+@cindex opzioni di configurazione @subentry @option{--enable-versioned-extension-dir}
@item --enable-versioned-extension-dir
Usare una directory con l'indicazione della versione per le estensioni.
Il nome della directory conterr@`a la versione principale e quella
@@ -44383,14 +45501,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 +45552,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 +45641,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.
@@ -44471,7 +45682,17 @@ Si veda anche il file @file{README_d/README.pc} nella distribuzione.
La sola distribuzione binaria predisposta supportata per i sistem MS-Windows
@`e quella messa a disposizione da Eli Zaretskii
@uref{https://sourceforge.net/projects/ezwinports/, progetto ``ezwinports''}.
-Si parta da l@`{@dotless{i}} per installare il comando @command{gawk} precompilato.
+Si parta da l@`{@dotless{i}} per installare il comando @command{gawk}
+precompilato.
+Si noti che per eseguire questa versione @`e necessario che sia disponibile sul
+vostro sistema il file @file{libgcc_s_dw2-1.dll}. Tale file fa parte della
+distribuzione di GCC (in ambiente MinGW), e dovrebbe trovarsi nella stessa
+directory in cui @`e installato @file{gawk.exe} oppure essere raggiungibile
+in qualche libreria della lista contenuta nella variabile @env{Path} del
+vostro sistema. @`E possibile scaricare il file dal
+@uref{https://osdn.net/projects/mingw/releases, sito MinGW};
+cercare ``MinGW.org Compiler Collection (GCC)'' e da quella pagina
+scaricare @code{LibGCC-1.DLL}.
@node Compilazione su PC
@appendixsubsubsec Compilare @command{gawk} per sistemi operativi di PC
@@ -44568,7 +45789,7 @@ un'appropriata opzione @samp{-v BINMODE=@var{N}} sulla riga di comando.
@code{BINMODE} @`e impostato nel momento in cui un file o @dfn{pipe} @`e aperto
e non pu@`o essere cambiato in corso di elaborazione.
-Su sistemi compatibili con POSIX, il valore di queta variabile non ha
+Su sistemi compatibili con POSIX, il valore di questa variabile non ha
alcun effetto. Pertanto, se si pensa che un dato programma sar@`a eseguito
su parecchi sistemi differenti, e che sia necessario usare
@code{BINMODE}, @`e possibile impostarlo semplicemente (nel programma
@@ -44631,7 +45852,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 +45908,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 +45926,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 +46074,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 +46181,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 +46236,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 +46252,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,66 +46269,199 @@ 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 alla 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}}.'' Questa @`e la lista:
+
+@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.
+In altre parole, se @command{gawk} non fa quello che @emph{voi}
+vi aspettate che faccia, ci@`o non @`e necessariamente un bug.
+
+@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.
+
+Ci@`o vale anche per le differenze nel comportamento tra @command{gawk}
+e i compilatori e gli interpretatori di altri linguaggi, come, per
+esempio, descrizioni pi@`u dettagliate di quello che @`e il problema
+quando viene emesso un messaggio di errore di sintassi.
+
+@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. Il suo
+obiettivo @`e quello di mettervi in grado di risolvere da soli
+i vostri problemi.
+
+@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.
+versione, e se la versione che state usando non @`e aggiornata,
+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.
-Questa informazione si pu@`o ottenere con il comando @samp{gawk --version}.
-
-@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}
-@cindex indirizzo email per segnalare bug @subentry @code{bug-gawk@@gnu.org}
-@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}.
+@item
+Prima di segnalare un bug o di tentare di risolverlo da soli, 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.
+
+@item
+@cindex @command{gawkbug} utility
+@cindex programma di utilit@`a @subentry @command{gawkbug}
+Si usi il programma @command{gawkbug} per preparare la segnalazione
+del bug. Questo programma prepara un modello di segnalazione
+di bug e vi permette di modificarlo nel vostro programma di edit.
+Va quindi modificato appropriatamente per includere:
+
+@itemize @bullet
+@item
+il programma e il @value{DF}.
+
+@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 in realt@`a un problema
+di documentazione.
+
+@item
+Una soluzione al problema, se ne avete una.
+@end itemize
+
+@item
+@emph{Non} inviare immagini di videate. In alternativa, usate COPIA/INCOLLA
+per inviare testo, o per spedire file.
+
+@c @item
+@c Do send files as attachments, instead of inline. This avoids corruption
+@c by mailer programs out in the wilds of the 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 @email{bug-gawk@@gnu.org} indirizzo per la segnalazione dei bug
+@cindex email @subentry indirizzo per segnalare bug @subentry @email{bug-gawk@@gnu.org}
+@cindex indirizzo email per segnalare bug @subentry @email{bug-gawk@@gnu.org}
+@cindex bug @subentry segnalare @subentry indirizzo email, @email{bug-gawk@@gnu.org}
+@cindex segnalare bug @subentry indirizzo email @subentry @email{bug-gawk@@gnu.org}
+Il programma @command{gawkbug} spedisce un messaggio 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
-manutentori, @`e preferibile usare l'indirizzo sopra fornito perch@'e quella
-mailing list rimane in archivio presso il Progetto GNU. @emph{Tutti i messaggi
-devono essere in inglese. @`E questo il solo linguaggio che tutti i manutentori
-conoscono.} Inoltre, occorre accertarsi di spedire tutti i messaggi in formato
-@emph{testo}, e non (o non soltanto) in formato HTML.
+segnalazione di errore.
+@emph{Non} spedite messaggi di posta elettronica direttamente ai manutentori;
+@`e preferibile usare l'indirizzo sopra fornito perch@'e quella
+mailing list rimane in archivio presso il Progetto GNU.
@quotation NOTA
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 +46472,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}
@@ -45208,6 +46505,10 @@ messaggi di questo gruppo di discussione, il manutentore principale di
@command{gawk} non lo fa pi@`u. Quindi @`e praticamente certo che un
messaggio inviato l@`a @emph{non} sia da lui letto.
+Se si ignora quanto scritto nella frase precedente, e si continua a
+inviare bug a @code{comp.lang.awk}, dovreste tenere presente che non
+si stanno riportando dei bug, ma solo brontolando.
+
Analogamente, segnalando bug o ponendo domande in @dfn{forum} online
come @uref{https://stackoverflow.com/, Stack Overflow}) si pu@`o
ottenere una risposta, ma non dai manutentori di @command{gawk},
@@ -45228,8 +46529,176 @@ 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 eseguire i passi sopra elencati, o non si vuole farlo,
+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 con la lista di aiuto
+(e anche in generale).
+
+@cindex Proulx, Bob
+Se volete far parte della lista di aiuto, 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 +46723,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 +46781,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 +46876,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 +46887,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 +46944,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}
@@ -45479,6 +46970,21 @@ L'autore ha scritto un buon
@uref{https://benhoyt.com/writings/goawk/, articolo}
che descrive l'implementazione.
+@cindex @command{AWKgo} @subentry traduttore da @command{awk} @subentry al linguaggio Go
+@cindex @command{awk} @subentry traduttore al linguaggio Go
+@cindex Go subentry traduttore @command{AWKgo} da @command{awk} al linguaggio
+@cindex codice sorgente @subentry @command{AWKgo}
+@cindex Go @subentry linguaggio di programmazione
+@cindex linguaggi di programmazione @subentry Go
+@item @command{AWKgo}
+Questo @`e un traduttore da @command{awk} al linguaggio Go.
+@`E stato scritto dall'autore di @command{goawk}.
+(Vedere l'elemento precedente di questa lista.)
+Il codice sorgente @`e disponibile in
+@uref{https://github.com/benhoyt/goawk/tree/master/awkgo}.
+L'articolo sull'argomento, scritto dall'autore @`e in
+@uref{https://benhoyt.com/writings/awkgo/}.
+
@cindex @command{jawk}
@cindex Java @subentry implementazione di @command{awk}
@cindex implementazione @subentry di @command{awk} in Java
@@ -45490,7 +46996,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 +47016,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 +47060,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 +47091,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 +47270,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.
@@ -45758,7 +47286,7 @@ per informazioni su come ottenere l'ultima versione di @command{gawk}.)
Seguire gli @cite{Standard di codifica GNU}.
@end ifnotinfo
@ifinfo
-Si veda @inforef{Top, , Version, standards, Standard di Codifica GNU}.
+@xref{Top, , Version, standards, Standard di Codifica GNU}.
@end ifinfo
Questo documento descrive come dovrebbe essere scritto il software GNU.
Se non lo si @`e letto, @`e bene farlo, preferibilmente @emph{prima}
@@ -45884,7 +47412,7 @@ Per inviare le modifiche proposte spedire l'output prodotto da @command{diff}.
L'uso di questo formato rende semplice per me l'applicazione delle modifiche
alla versione principale del sorgente di @command{gawk} (usando il programma di
-utilit@`a @code{patch}). Se invece tocca a me applicare le modifiche a mano,
+utilit@`a @command{patch}). Se invece tocca a me applicare le modifiche a mano,
con un editor di testo, potrei decidere di non farlo, specialmente
se le modifiche sono molte.
@@ -45928,7 +47456,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 +47848,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 +48827,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 +49300,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..19b7bd07 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-11-01.16}
%
-% 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.
@@ -3672,6 +3632,9 @@ $$%
\def\quotedblbase{{\ecfont \char"12}}
\def\quotesinglbase{{\ecfont \char"0D}}
%
+\def\L{{\ecfont \char"8A}} % L with stroke
+\def\l{{\ecfont \char"AA}} % l with stroke
+%
% This positioning is not perfect (see the ogonek LaTeX package), but
% we have the precomposed glyphs for the most common cases. We put the
% tests to use those glyphs in the single \ogonek macro so we have fewer
@@ -4359,82 +4322,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 +4371,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 +4387,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 +4403,8 @@ $$%
%
\tolerance=9500
\hbadness=9500
- \setmultitablespacing
- \parskip=\multitableparskip
- \parindent=\multitableparindent
+ \parskip=0pt
+ \parindent=6pt
\overfullrule=0pt
\global\colcount=0
%
@@ -4554,47 +4434,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 +4460,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 +5073,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 +5220,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 +6998,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 +7224,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 +7270,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 +7430,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 +7471,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.
@@ -7785,6 +7620,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
\def\printdefunline#1#2{%
\begingroup
+ \plainfrenchspacing
% call \deffnheader:
#1#2 \endheader
% common ending:
@@ -8055,7 +7891,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 +8000,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 +8064,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 +8235,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 +8247,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 +8840,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 +8934,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 +8969,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 +9059,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 +9087,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 +9196,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 +9420,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
@@ -9580,7 +9431,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi\fi
%
\ifimagevmode
- \nobreak\medskip
+ \medskip
% Usually we'll have text after the image which will insert
% \parskip glue, so insert it here too to equalize the space
% above and below.
@@ -9595,7 +9446,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 +11473,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 +11532,7 @@ directory should work if nowhere else does.}
@let|=@normalverticalbar
@let~=@normaltilde
@let\=@ttbackslash
- @markupsetuplqdefault
- @markupsetuprqdefault
+ @setregularquotes
@unsepspaces
}
}
@@ -11775,17 +11625,15 @@ 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)
+@c eval: (add-hook 'before-save-hook 'time-stamp nil t)
+@c time-stamp-pattern: "texinfoversion{%Y-%02m-%02d.%02H}"
@c page-delimiter: "^\\\\message\\|emacs-page"
-@c time-stamp-start: "def\\\\texinfoversion{"
-@c time-stamp-format: "%:y-%02m-%02d.%02H"
-@c time-stamp-end: "}"
@c End:
@c vim:sw=2:
@enablebackslashhack
+
diff --git a/doc/wordlist b/doc/wordlist
index 25015b2a..722ac71a 100644
--- a/doc/wordlist
+++ b/doc/wordlist
@@ -20,6 +20,7 @@ AWKBUFSIZE
AWKLIBPATH
AWKPATH
AWKREADFUNC
+AWKgo
AbbC
AdditionalResources
Affero
@@ -44,6 +45,7 @@ BEGINFILE
BEL
BINMODE
BLKSIZE
+BOOL
BREs
BSIZE
BTL
@@ -52,6 +54,7 @@ Banzai
BeOS
Benzinger
Bleah
+Bool
Bornstein
Brin's
Brini
@@ -115,6 +118,7 @@ DHAVE
DIR
DJGPP
DK
+DLL
DST
DTD
DVI
@@ -157,6 +161,7 @@ FIXME
FN
FNM
FNR
+FNV
FOO
FORmula
FP
@@ -273,6 +278,7 @@ LINENO
LXIX
Langston
LeBlanc
+LibGCC
Libmawk
Libtool
Lijewski
@@ -326,6 +332,7 @@ NR
NT
NUMCUR
NaN
+NaNs
Nachum
Neacsu
Neacsu's
@@ -629,6 +636,7 @@ awk
awka
awkcard
awkforai
+awkgo
awkgram
awklang
awklib
@@ -680,6 +688,7 @@ blockdev
blockquote
blocksize
bool
+boolval
boundar
br
brabble
@@ -733,6 +742,7 @@ chem
chet
chien
chmod
+chongo
chown
chr
cilnqsvx
@@ -840,6 +850,7 @@ distributable
div
djgpp
dl
+dll
dlopen
dlsym
dn
@@ -857,6 +868,7 @@ duncan
dup
dupword
dvi
+dw
dx
ebcdic
eca
@@ -886,6 +898,7 @@ enrichening
enum
env
eof
+eq
eql
equiv
erealloc
@@ -947,6 +960,7 @@ fmode
fn
fname
fnmatch
+fnv
fo
foObAr
foo
@@ -984,6 +998,7 @@ ga
gai
gatech
gawkapi
+gawkbug
gawkextlib
gawkfts
gawkinet
@@ -1023,6 +1038,7 @@ getuid
gid
gierd
github
+globalstate
gmail
gmo
gmon
@@ -1047,6 +1063,7 @@ groupset
grp
gst
gsub
+gt
guerrero
gunzip
gvim
@@ -1139,6 +1156,7 @@ isatty
isnumeric
iso
ist
+isthe
itd
itemx
ith
@@ -1186,6 +1204,7 @@ lgpl
lhs
li
libexec
+libgcc
libintl
libmawk
libs
@@ -1249,6 +1268,7 @@ mingw
miriam
misc
mit
+mkbool
mkdir
mkinstalldirs
mktime
@@ -1405,6 +1425,7 @@ org
orig
orspan
os
+osdn
otherc
otherd
otiens
@@ -1488,6 +1509,7 @@ pwcat
pwd
pwent
pxref
+py
qb
qc
qquad
@@ -1509,6 +1531,7 @@ rapidjson
rdev
rdquo
reada
+readall
readdir
readfile
readline
@@ -1619,6 +1642,7 @@ stat
statdata
statfunc
std
+stdbool
stdbuf
stddef
stderr
@@ -1795,6 +1819,7 @@ wnewmail
wordfreq
wr
writea
+writeall
www
wy
xA
diff --git a/doc/wordlist3 b/doc/wordlist3
index f920c4a2..cbe0cdcb 100644
--- a/doc/wordlist3
+++ b/doc/wordlist3
@@ -1,32 +1,16 @@
-AB
-ABCDEF
-API
ARGC
ARGIND
ARGV
AWK
AWKLIBPATH
AWKPATH
-Ab
Aho
BEGINFILE
-BEL
-BI
BINMODE
CGI
CONVFMT
-Coprocesses
-Cygwin
-DD
-DJGPP
-DST
-EAGAIN
-EINTR
ENDFILE
ERRNO
-ESC
-ETIMEDOUT
-EWOULDBLOCK
FIELDWIDTHS
FNR
FPAT
@@ -34,51 +18,33 @@ FS
FUNCTAB
Fenlason
GMP
-HH
IGNORECASE
IPv
ISBN
-Jul
LC
-Localizable
-MKS
MPFR
MSEC
-MinGW
NF
NR
OFMT
OFS
ORS
-OpenVMS
PREC
PROCINFO
+Printf
RLENGTH
ROUNDMODE
RSTART
RT
Regexp
-Retryable
SIGHUP
SIGUSR
-SS
SUBSEP
SYMTAB
TEXTDOMAIN
-TP
Trueman
UTC
-YYYY
-Za
-aB
-ab
abc
-abcdef
-alnum
-api
-argv
-arnold
-asc
asort
asorti
atan
@@ -87,11 +53,7 @@ awkprof
awkvars
bignum
bindtextdomain
-ch
cmd
-cmp
-cntrl
-comp
compl
coprocess
coprocesses
@@ -99,118 +61,71 @@ cos
datespec
dcgettext
dcngettext
-dd
-ddd
-dddddd
denom
-desc
dev
-djgpp
dl
ds
-eB
-eS
-eW
-ea
-eb
-ec
+dsensitivity
+dset
ef
-egid
egrep
en
er
errno
-euid
ev
-ew
exp
expr
-ext
-ey
-fclose
+fGNU
+fO
fd
fflush
fmt
-foo
-formfeed
fs
func
+gawkbug
gen
gensub
-getegid
-geteuid
-getgid
-getgroups
getline
-getpgrp
-getpid
-getppid
gettext
-getuid
-gid
gmo
-gmp
gsub
-hhhh
html
https
-ind
inet
int
intdiv
isarray
-lang
lc
localizable
logdir
lport
lq
lshift
-metacharacter
-metacharacters
-min
-mingw
+mkbool
mktime
monde
-mpfr
multibyte
myfunc
myhome
-myprog
nextfile
nlines
nmap
-nonsignificant
-nonwhitespace
num
op
org
-os
-parsedebug
patsplit
-pclose
-pgrpid
-pid
posix
-ppid
pre
-prec
printf
-pty
-punct
rand
regex
regexp
resplit
rhost
roundTiesToEven
-roundTowardNegative
-roundTowardPositive
-roundTowardZero
rport
rq
rshift
-rw
sed
seps
sprintf
@@ -223,7 +138,6 @@ strftime
strnum
strtod
strtonum
-subarray
substr
systime
tcp
@@ -231,17 +145,11 @@ tolower
toupper
typeof
udp
-uid
uintmax
usleep
usr
utc
val
var
-vars
-vms
-wr
www
-xdigit
xor
-zero'th
diff --git a/doc/wordlist5 b/doc/wordlist5
new file mode 100644
index 00000000..63b99038
--- /dev/null
+++ b/doc/wordlist5
@@ -0,0 +1,13 @@
+Awk
+Chet
+GAWKBUG
+IST
+Ramey
+TMPDIR
+bfox
+chet
+cwru
+edu
+gawkbug
+org
+po
diff --git a/eval.c b/eval.c
index 013ee062..c6f8bcb9 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 69896748..c752da78 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,14 @@
+2022-03-11 Arnold D. Robbins <arnold@skeeve.com>
+
+ * rwarray.3m: Typo fixes, update copyright and modification dates.
+
+2022-02-25 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ Memory issues with MPFR, fix part 1.
+
+ * intdiv.c (do_intdiv): Don't clear quotient and remainder.
+ * testext.c (test_scalar): Add GMP/MPFR support.
+
2022-02-22 Arnold D. Robbins <arnold@skeeve.com>
Fix resource links found by Coverity. Thanks to
@@ -5,10 +16,86 @@
* readfile.c (do_readfile): Close fd if text == NULL.
+2021-12-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * rwarray.c (write_number): Update comment to reflect that we are
+ now using mpfr_get_default_rounding_mode() instead of MPFR_RNDN.
+
2021-12-10 Arnold D. Robbins <arnold@skeeve.com>
* rwarray.c (write_number, read_number): Reformat comments a bit.
+2021-12-09 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * rwarray.c (write_number, read_number): Use
+ mpfr_get_default_rounding_mode() instead of arbitrarily choosing
+ MPFR_RNDN, taking advantage of the fact that core gawk maintains
+ this using the ROUNDMODE global variable.
+
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * rwarray.c: Fix valgrind complaints related to creating mpz and mpfr
+ values on the stack in read_number by passing down storage from
+ the calling function that loads the data into gawk.
+ (value_storage): New union type to contain mpz_t or mpfr_t data.
+ (read_global): Allocate value_storage on the stack and pass a pointer
+ to read_elem.
+ (read_array): Ditto.
+ (read_elem): Receive new arg pointing to value_storage, and pass it
+ down to read_value.
+ (read_value): Receive new arg pointing to value_storage, and pass it
+ down to read_number.
+ (read_number): Receive new arg pointing to value_storage, and create
+ mpz and mpfr variables using that storage instead of in the local
+ scope.
+
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * rwarray.c: Add new functions writeall and readall to implement
+ persistent state.
+ (write_backend): New helper function containing most of the logic
+ from do_writea. Note that we do not need to check nargs < 2 because
+ gawk will issue a fatal error if a function is called with fewer
+ than min_required_args. Clean up some minor issues with error
+ handling.
+ (do_writea): Grab the array argument and use write_backend to
+ do the rest of the work.
+ (do_writeall): Lookup SYMTAB and invoke write_backend.
+ (free_value): New function to free memory for data we end up ignoring
+ because the variables exist already.
+ (do_poke): Attempt to create variables that don't exist already or
+ are undefined.
+ (regular_array_handle): Wrapper around create_array.
+ (global_array_handle): Call create_array unless the variable exists
+ already and is an array with zero elements.
+ (read_global): New function used by readall to load global variables
+ from a file.
+ (read_one): New function to read a single array from a file.
+ (read_backend): New helper function containing most of the logic
+ from do_reada. Remove the superfluous nargs check. Read the file
+ prologue and then call read_global or read_one as appropriate to load
+ the data.
+ (do_reada): Grab the array argument and call read_backend with
+ read_one to load the data.
+ (do_readall): Call read_backend with read_global to load the data.
+ (read_array): Call read_elem with additional arg regular_array_handle.
+ (read_elem): Add a function argument controlling array creation to
+ pass down to read_value.
+ (read_value): Add a function argument to call for array creation
+ instead of calling create_array directly, since we may need to use
+ an existing array when populating global arrays in readall.
+ (func_table): Add writeall and readall.
+ * rwarray.3am: Document new functions writeall and readall.
+
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * testext.c (test_array_create): New function to create an array
+ by name that enables testing whether an undefined variable can
+ be converted by the API into an array.
+ (populate_array): New helper function.
+ (fill_in_array): Use populate_array to fill in the elements.
+ (func_table): Add test_array_create.
+
2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
* rwarray.c (write_number): Since mpfr_fpif_export is experimental
@@ -66,15 +153,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/intdiv.c b/extension/intdiv.c
index 8d52c879..7eaa4841 100644
--- a/extension/intdiv.c
+++ b/extension/intdiv.c
@@ -222,9 +222,6 @@ do_intdiv(int nargs, awk_value_t *result, struct awk_ext_func *unused)
array_set_mpz(array, "quotient", 8, quotient);
array_set_mpz(array, "remainder", 9, remainder);
- mpz_clear(quotient);
- mpz_clear(remainder);
-
/* release temporary variables */
if (numer == numer_tmp)
mpz_clear(numer);
diff --git a/extension/rwarray.3am b/extension/rwarray.3am
index f17ffaa9..dbebf519 100644
--- a/extension/rwarray.3am
+++ b/extension/rwarray.3am
@@ -1,6 +1,6 @@
-.TH RWARRAY 3am "Feb 02 2018" "Free Software Foundation" "GNU Awk Extension Modules"
+.TH RWARRAY 3am "Mar 11 2022" "Free Software Foundation" "GNU Awk Extension Modules"
.SH NAME
-writea, reada \- write and read gawk arrays to/from files
+writea, reada, writeall, readall \- write and read gawk arrays to/from files
.SH SYNOPSIS
.ft CW
@load "rwarray"
@@ -8,14 +8,20 @@ writea, reada \- write and read gawk arrays to/from files
ret = writea(file, array)
.br
ret = reada(file, array)
+.br
+ret = writeall(file)
+.br
+ret = readall(file)
.ft R
.SH DESCRIPTION
The
.I rwarray
-extension adds two functions named
-.BR writea() .
-and
+extension adds functions named
+.BR writea() ,
.BR reada() ,
+.BR writeall() ,
+and
+.BR readall() ,
as follows.
.TP
.B writea()
@@ -33,6 +39,23 @@ it reads the file named as its first argument, filling in
the array named as the second argument. It clears the array
first.
Here too, the return value is one on success and zero upon failure.
+.TP
+.B writeall()
+This function takes a string argument, which is the name of the
+file to which dump the state of all variables. Calling this function
+is completely equivalent to calling
+.B writea()
+with the second argument equal to
+.BR SYMTAB .
+It returns one on success, or zero upon failure.
+.TP
+.B readall()
+This function takes a string argument, which is the name of the
+file from which to read the contents of various global variables.
+For each variable in the file, the data is loaded unless the variable
+already exists. If the variable already exists, the data for that variable
+in the file is ignored.
+It returns one on success, or zero upon failure.
.SH NOTES
The array created by
.B reada()
@@ -62,6 +85,10 @@ restored on systems with a different one, but this has not been tried.
ret = writea("arraydump.bin", array)
\&...
ret = reada("arraydump.bin", array)
+\&...
+ret = writeall("globalstate.bin")
+\&...
+ret = readall("globalstate.bin")
.fi
.ft R
.SH "SEE ALSO"
@@ -79,7 +106,7 @@ ret = reada("arraydump.bin", array)
Arnold Robbins,
.BR arnold@skeeve.com .
.SH COPYING PERMISSIONS
-Copyright \(co 2012, 2013, 2018,
+Copyright \(co 2012, 2013, 2018, 2022
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 59d6b0f7..54032e5e 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -37,6 +37,7 @@
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -63,11 +64,11 @@
#define MAGIC "awkrulz\n"
#define MAJOR 4
-#define MINOR 0
+#define MINOR 1
static const gawk_api_t *api; /* for convenience macros to work */
static awk_ext_id_t ext_id;
-static const char *ext_version = "rwarray extension: version 2.0";
+static const char *ext_version = "rwarray extension: version 2.1";
static awk_bool_t (*init_func)(void) = NULL;
int plugin_is_GPL_compatible;
@@ -77,10 +78,16 @@ static awk_bool_t write_elem(FILE *fp, awk_element_t *element);
static awk_bool_t write_value(FILE *fp, awk_value_t *val);
static awk_bool_t write_number(FILE *fp, awk_value_t *val);
+typedef union {
+ mpz_t mpz_val;
+ mpfr_t mpfr_val;
+} value_storage;
+
+typedef awk_array_t (*array_handle_t)(awk_value_t *);
static awk_bool_t read_array(FILE *fp, awk_array_t array);
-static awk_bool_t read_elem(FILE *fp, awk_element_t *element);
-static awk_bool_t read_value(FILE *fp, awk_value_t *value);
-static awk_bool_t read_number(FILE *fp, awk_value_t *value, uint32_t code);
+static awk_bool_t read_elem(FILE *fp, awk_element_t *element, array_handle_t, value_storage *);
+static awk_bool_t read_value(FILE *fp, awk_value_t *value, array_handle_t, awk_value_t *idx, value_storage *vs);
+static awk_bool_t read_number(FILE *fp, awk_value_t *value, uint32_t code, value_storage *);
/*
* Format of array info:
@@ -113,14 +120,15 @@ static awk_bool_t read_number(FILE *fp, awk_value_t *value, uint32_t code);
#define VT_ARRAY 5
#define VT_REGEX 6
#define VT_STRNUM 7
+#define VT_BOOL 8
#define VT_UNDEFINED 20
-/* do_writea --- write an array */
+/* write_backend --- write an array */
static awk_value_t *
-do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+write_backend(awk_value_t *result, awk_array_t array, const char *name)
{
- awk_value_t filename, array;
+ awk_value_t filename;
FILE *fp = NULL;
uint32_t major = MAJOR;
uint32_t minor = MINOR;
@@ -128,18 +136,9 @@ do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
assert(result != NULL);
make_number(0.0, result);
- if (nargs < 2)
- goto out;
-
- /* filename is first arg, array to dump is second */
+ /* filename is first arg */
if (! get_argument(0, AWK_STRING, & filename)) {
- warning(ext_id, _("do_writea: first argument is not a string"));
- errno = EINVAL;
- goto done1;
- }
-
- if (! get_argument(1, AWK_ARRAY, & array)) {
- warning(ext_id, _("do_writea: second argument is not an array"));
+ warning(ext_id, _("%s: first argument is not a string"), name);
errno = EINVAL;
goto done1;
}
@@ -160,21 +159,55 @@ do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
if (fwrite(& minor, 1, sizeof(minor), fp) != sizeof(minor))
goto done1;
- if (write_array(fp, array.array_cookie)) {
+ if (write_array(fp, array)) {
make_number(1.0, result);
- goto done0;
+ fclose(fp);
+ return result;
}
done1:
update_ERRNO_int(errno);
- unlink(filename.str_value.str);
-
-done0:
- fclose(fp);
-out:
+ if (fp != NULL) {
+ fclose(fp);
+ unlink(filename.str_value.str);
+ }
return result;
}
+/* do_writea --- write an array */
+
+static awk_value_t *
+do_writea(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+{
+ awk_value_t array;
+
+ if (! get_argument(1, AWK_ARRAY, & array)) {
+ warning(ext_id, _("writea: second argument is not an array"));
+ errno = EINVAL;
+ update_ERRNO_int(errno);
+ make_number(0.0, result);
+ return result;
+ }
+ return write_backend(result, array.array_cookie, "writea");
+}
+
+/* do_writeall --- write out SYMTAB */
+
+static awk_value_t *
+do_writeall(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+{
+ awk_value_t array;
+
+ if (! sym_lookup("SYMTAB", AWK_ARRAY, & array)) {
+ warning(ext_id, _("writeall: unable to find SYMTAB array"));
+ errno = EINVAL;
+ update_ERRNO_int(errno);
+ make_number(0.0, result);
+ return result;
+ }
+ return write_backend(result, array.array_cookie, "writeall");
+}
+
/* write_array --- write out an array or a sub-array */
@@ -258,6 +291,9 @@ write_value(FILE *fp, awk_value_t *val)
case AWK_REGEX:
code = htonl(VT_REGEX);
break;
+ case AWK_BOOL:
+ code = htonl(VT_BOOL);
+ break;
case AWK_UNDEFINED:
code = htonl(VT_UNDEFINED);
break;
@@ -267,17 +303,29 @@ write_value(FILE *fp, awk_value_t *val)
warning(ext_id, _("array value has unknown type %d"), val->val_type);
break;
}
+
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(VT_BOOL)) {
+ 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;
}
@@ -323,9 +371,9 @@ write_number(FILE *fp, awk_value_t *val)
if (mpfr_fpif_export(fp, val->num_ptr) != 0)
#else
#define MPFR_STR_BASE 62 /* maximize base to minimize string len */
-#define MPFR_STR_ROUND MPFR_RNDN
+#define MPFR_STR_ROUND mpfr_get_default_rounding_mode()
/*
- * XXX does the choice of MPFR_RNDN matter, given
+ * Does the choice of rounding mode matter, given
* that the precision is 0, so we should be rendering
* in full precision?
*/
@@ -350,12 +398,139 @@ write_number(FILE *fp, awk_value_t *val)
return awk_true;
}
-/* do_reada --- read an array */
+/* free_value --- release memory for ignored global variables */
+
+static void
+free_value(awk_value_t *v)
+{
+ switch (v->val_type) {
+ case AWK_ARRAY:
+ clear_array(v->array_cookie);
+ break;
+ case AWK_STRING:
+ case AWK_REGEX:
+ case AWK_STRNUM:
+ case AWK_UNDEFINED:
+ gawk_free(v->str_value.str);
+ break;
+ case AWK_BOOL:
+ /* no memory allocated */
+ break;
+ case AWK_NUMBER:
+ switch (v->num_type) {
+ case AWK_NUMBER_TYPE_DOUBLE:
+ /* no memory allocated */
+ break;
+ case AWK_NUMBER_TYPE_MPZ:
+ mpz_clear(v->num_ptr);
+ break;
+ case AWK_NUMBER_TYPE_MPFR:
+ mpfr_clear(v->num_ptr);
+ break;
+ default:
+ warning(ext_id, _("cannot free number with unknown type %d"), v->num_type);
+ break;
+ }
+ break;
+ default:
+ warning(ext_id, _("cannot free value with unhandled type %d"), v->val_type);
+ break;
+ }
+}
+
+/* do_poke --- create a global variable */
+
+static awk_bool_t
+do_poke(awk_element_t *e)
+{
+ awk_value_t t;
+
+ if (e->index.val_type != AWK_STRING)
+ return awk_false;
+ /* So this is a bit tricky. If the program refers to the variable,
+ * then it will already exist in an undefined state after parsing.
+ * If the program never refers to it, then the lookup fails.
+ * We still need to create it in case the program accesses it via
+ * indirection through the SYMTAB table. */
+ if (sym_lookup(e->index.str_value.str, AWK_UNDEFINED, &t) && (t.val_type != AWK_UNDEFINED))
+ return awk_false;
+ if (! sym_update(e->index.str_value.str, & e->value)) {
+ warning(ext_id, _("readall: unable to set %s"), e->index.str_value.str);
+ return awk_false;
+ }
+ return awk_true;
+}
+
+/* regular_array_handle --- array creation hook for normal reada */
+
+static awk_array_t
+regular_array_handle(awk_value_t *unused)
+{
+ return create_array();
+}
+
+/* global_array_handle --- array creation hook for readall */
+
+static awk_array_t
+global_array_handle(awk_value_t *n)
+{
+ awk_value_t t;
+ size_t count;
+
+ /* The array may exist already because it was instantiated during
+ * program parsing, so we use the existing array if it is empty. */
+ return ((n->val_type == AWK_STRING) && sym_lookup(n->str_value.str, AWK_UNDEFINED, &t) && (t.val_type == AWK_ARRAY) && get_element_count(t.array_cookie, & count) && ! count) ? t.array_cookie : create_array();
+}
+
+/* read_global --- read top-level variables dumped from SYMTAB */
+
+static awk_bool_t
+read_global(FILE *fp, awk_array_t unused)
+{
+ uint32_t i;
+ uint32_t count;
+ awk_element_t new_elem;
+ value_storage vs;
+
+ if (fread(& count, 1, sizeof(count), fp) != sizeof(count))
+ return awk_false;
+
+ count = ntohl(count);
+
+ for (i = 0; i < count; i++) {
+ if (read_elem(fp, & new_elem, global_array_handle, &vs)) {
+ if (! do_poke(& new_elem))
+ free_value(& new_elem.value);
+ if (new_elem.index.str_value.len)
+ /* free string allocated by make_const_string */
+ gawk_free(new_elem.index.str_value.str);
+ } else
+ return awk_false;
+ }
+
+ return awk_true;
+}
+
+/* read_one --- read one array */
+
+static awk_bool_t
+read_one(FILE *fp, awk_array_t array)
+{
+ if (! clear_array(array)) {
+ errno = ENOMEM;
+ warning(ext_id, _("reada: clear_array failed"));
+ return awk_false;
+ }
+
+ return read_array(fp, array);
+}
+
+/* read_backend --- common code for reada and readall */
static awk_value_t *
-do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+read_backend(awk_value_t *result, awk_array_t array, const char *name, awk_bool_t (*func)(FILE *, awk_array_t))
{
- awk_value_t filename, array;
+ awk_value_t filename;
FILE *fp = NULL;
uint32_t major;
uint32_t minor;
@@ -364,18 +539,9 @@ do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused)
assert(result != NULL);
make_number(0.0, result);
- if (nargs < 2)
- goto out;
-
- /* directory is first arg, array to read is second */
+ /* filename is first arg */
if (! get_argument(0, AWK_STRING, & filename)) {
- warning(ext_id, _("do_reada: first argument is not a string"));
- errno = EINVAL;
- goto done1;
- }
-
- if (! get_argument(1, AWK_ARRAY, & array)) {
- warning(ext_id, _("do_reada: second argument is not an array"));
+ warning(ext_id, _("%s: first argument is not a string"), name);
errno = EINVAL;
goto done1;
}
@@ -417,13 +583,7 @@ do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused)
goto done1;
}
- if (! clear_array(array.array_cookie)) {
- errno = ENOMEM;
- warning(ext_id, _("do_reada: clear_array failed"));
- goto done1;
- }
-
- if (read_array(fp, array.array_cookie)) {
+ if ((*func)(fp, array)) {
make_number(1.0, result);
goto done0;
}
@@ -433,10 +593,34 @@ done1:
done0:
if (fp != NULL)
fclose(fp);
-out:
return result;
}
+/* do_reada --- read an array */
+
+static awk_value_t *
+do_reada(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+{
+ awk_value_t array;
+
+ if (! get_argument(1, AWK_ARRAY, & array)) {
+ warning(ext_id, _("reada: second argument is not an array"));
+ errno = EINVAL;
+ update_ERRNO_int(errno);
+ make_number(0.0, result);
+ return result;
+ }
+ return read_backend(result, array.array_cookie, "read", read_one);
+}
+
+/* do_readall --- read top-level variables */
+
+static awk_value_t *
+do_readall(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+{
+ return read_backend(result, NULL, "readall", read_global);
+}
+
/* read_array --- read in an array or sub-array */
@@ -446,6 +630,7 @@ read_array(FILE *fp, awk_array_t array)
uint32_t i;
uint32_t count;
awk_element_t new_elem;
+ value_storage vs;
if (fread(& count, 1, sizeof(count), fp) != sizeof(count))
return awk_false;
@@ -453,7 +638,7 @@ read_array(FILE *fp, awk_array_t array)
count = ntohl(count);
for (i = 0; i < count; i++) {
- if (read_elem(fp, & new_elem)) {
+ if (read_elem(fp, & new_elem, regular_array_handle, &vs)) {
/* add to array */
if (! set_array_element_by_elem(array, & new_elem)) {
warning(ext_id, _("read_array: set_array_element failed"));
@@ -472,7 +657,7 @@ read_array(FILE *fp, awk_array_t array)
/* read_elem --- read in a single element */
static awk_bool_t
-read_elem(FILE *fp, awk_element_t *element)
+read_elem(FILE *fp, awk_element_t *element, array_handle_t array_handle, value_storage *vs)
{
uint32_t index_len;
static char *buffer;
@@ -510,7 +695,7 @@ read_elem(FILE *fp, awk_element_t *element)
make_null_string(& element->index);
}
- if (! read_value(fp, & element->value))
+ if (! read_value(fp, & element->value, array_handle, & element->index, vs))
return awk_false;
return awk_true;
@@ -519,7 +704,7 @@ read_elem(FILE *fp, awk_element_t *element)
/* read_value --- read a number or a string */
static awk_bool_t
-read_value(FILE *fp, awk_value_t *value)
+read_value(FILE *fp, awk_value_t *value, array_handle_t array_handle, awk_value_t *idx, value_storage *vs)
{
uint32_t code, len;
@@ -529,7 +714,7 @@ read_value(FILE *fp, awk_value_t *value)
code = ntohl(code);
if (code == VT_ARRAY) {
- awk_array_t array = create_array();
+ awk_array_t array = (*array_handle)(idx);
if (! read_array(fp, array))
return awk_false;
@@ -540,7 +725,7 @@ read_value(FILE *fp, awk_value_t *value)
} else if (code == VT_NUMBER
|| code == VT_GMP
|| code == VT_MPFR) {
- return read_number(fp, value, code);
+ return read_number(fp, value, code, vs);
} else {
if (fread(& len, 1, sizeof(len), fp) != sizeof(len)) {
return awk_false;
@@ -559,6 +744,9 @@ read_value(FILE *fp, awk_value_t *value)
case VT_UNDEFINED:
value->val_type = AWK_UNDEFINED;
break;
+ case VT_BOOL:
+ 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);
@@ -573,6 +761,15 @@ read_value(FILE *fp, awk_value_t *value)
return awk_false;
}
value->str_value.str[len] = '\0';
+ value->str_value.len = len;
+
+ if (code == VT_BOOL) {
+ bool val = (strcmp(value->str_value.str, "TRUE") == 0);
+
+ gawk_free(value->str_value.str);
+ value->str_value.str = NULL;
+ value->bool_value = val ? awk_true : awk_false;
+ }
}
return awk_true;
@@ -581,7 +778,7 @@ read_value(FILE *fp, awk_value_t *value)
/* read_number --- read a double, GMP, or MPFR number */
static awk_bool_t
-read_number(FILE *fp, awk_value_t *value, uint32_t code)
+read_number(FILE *fp, awk_value_t *value, uint32_t code, value_storage *vs)
{
uint32_t len;
@@ -603,28 +800,24 @@ read_number(FILE *fp, awk_value_t *value, uint32_t code)
} else {
#ifdef HAVE_MPFR
if (code == VT_GMP) {
- mpz_t mp_ptr;
-
- mpz_init(mp_ptr);
- if (mpz_inp_raw(mp_ptr, fp) == 0)
+ mpz_init(vs->mpz_val);
+ if (mpz_inp_raw(vs->mpz_val, fp) == 0)
return awk_false;
- value = make_number_mpz(mp_ptr, value);
+ value = make_number_mpz(vs->mpz_val, value);
} else {
- mpfr_t mpfr_val;
- mpfr_init(mpfr_val);
-
+ mpfr_init(vs->mpfr_val);
#ifdef USE_MPFR_FPIF
/* preferable if widely available and stable */
- if (mpfr_fpif_import(mpfr_val, fp) != 0)
+ if (mpfr_fpif_import(vs->mpfr_val, fp) != 0)
#else
// N.B. need to consume the terminating space we wrote
// after mpfr_out_str
- if ((mpfr_inp_str(mpfr_val, fp, MPFR_STR_BASE, MPFR_STR_ROUND) == 0) || (getc(fp) != ' '))
+ if ((mpfr_inp_str(vs->mpfr_val, fp, MPFR_STR_BASE, MPFR_STR_ROUND) == 0) || (getc(fp) != ' '))
#endif
return awk_false;
- value = make_number_mpfr(& mpfr_val, value);
+ value = make_number_mpfr(vs->mpfr_val, value);
}
#else
fatal(ext_id(_("rwarray extension: GMP/MPFR value in file but compiled without GMP/MPFR support."));
@@ -637,6 +830,8 @@ read_number(FILE *fp, awk_value_t *value, uint32_t code)
static awk_ext_func_t func_table[] = {
{ "writea", do_writea, 2, 2, awk_false, NULL },
{ "reada", do_reada, 2, 2, awk_false, NULL },
+ { "writeall", do_writeall, 1, 1, awk_false, NULL },
+ { "readall", do_readall, 1, 1, awk_false, NULL },
};
diff --git a/extension/testext.c b/extension/testext.c
index a5bef7ae..30dcdeb3 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -39,6 +39,11 @@
#include <sys/stat.h>
#include <fcntl.h>
+#ifdef HAVE_MPFR
+#include <gmp.h>
+#include <mpfr.h>
+#endif
+
#include "gawkapi.h"
static const gawk_api_t *api; /* for convenience macros to work */
@@ -48,6 +53,7 @@ static const char *ext_version = "testext extension: version 1.0";
int plugin_is_GPL_compatible;
static void fill_in_array(awk_value_t *value);
+static int populate_array(awk_array_t);
#ifdef __MINGW32__
unsigned int
@@ -88,6 +94,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;
@@ -659,6 +672,54 @@ out:
}
/*
+function tfunc(f) {
+ if (isarray(f))
+ print "good: we have an array"
+}
+
+BEGIN {
+ printf "test_array_create returned %d\n", test_array_create("testarr")
+ tfunc(testarr)
+}
+*/
+
+static awk_value_t *
+test_array_create(int nargs, awk_value_t *result, struct awk_ext_func *unused)
+{
+ awk_value_t new_array;
+ awk_value_t arg0;
+
+ (void) nargs; /* silence warnings */
+ make_number(0.0, result);
+
+ if (! get_argument(0, AWK_STRING, & arg0)) {
+ printf("test_array_create: could not get argument\n");
+ goto out;
+ }
+
+ if (arg0.val_type != AWK_STRING) {
+ printf("test_array_create: argument is not string (%d)\n",
+ arg0.val_type);
+ goto out;
+ }
+
+ new_array.val_type = AWK_ARRAY;
+ new_array.array_cookie = create_array();
+ if (! sym_update(arg0.str_value.str, & new_array)) {
+ printf("test_array_create: sym_update(\"%s\") failed!\n", arg0.str_value.str);
+ goto out;
+ }
+ if (populate_array(new_array.array_cookie) < 0) {
+ printf("test_array_create: populate(\"%s\") failed!\n", arg0.str_value.str);
+ goto out;
+ }
+
+ make_number(1.0, result);
+out:
+ return result;
+}
+
+/*
BEGIN {
printf("Initial value of LINT is %d\n", LINT)
ret = print_do_lint();
@@ -711,6 +772,10 @@ test_scalar(int nargs, awk_value_t *result, struct awk_ext_func *unused)
{
awk_value_t new_value, new_value2;
awk_value_t the_scalar;
+#ifdef HAVE_MPFR
+ mpz_t mpz_val;
+ mpfr_t mpfr_val;
+#endif
(void) nargs; /* silence warnings */
make_number(0.0, result);
@@ -730,8 +795,26 @@ test_scalar(int nargs, awk_value_t *result, struct awk_ext_func *unused)
if (new_value.val_type == AWK_STRING) {
make_const_string(new_value.str_value.str, new_value.str_value.len, & new_value2);
- } else {
+ } else { /* AWK_NUMBER */
+#ifdef HAVE_MPFR
+ switch (new_value.num_type) {
+ case AWK_NUMBER_TYPE_MPZ:
+ mpz_init(mpz_val);
+ mpz_set(mpz_val, new_value.num_ptr);
+ make_number_mpz(mpz_val, & new_value2);
+ break;
+ case AWK_NUMBER_TYPE_MPFR:
+ mpfr_init(mpfr_val);
+ mpfr_set(mpfr_val, (mpfr_ptr) new_value.num_ptr, mpfr_get_default_rounding_mode());
+ make_number_mpfr(mpfr_val, & new_value2);
+ break;
+ default:
+ new_value2 = new_value;
+ break;
+ }
+#else
new_value2 = new_value;
+#endif
}
if (! sym_update_scalar(the_scalar.scalar_cookie, & new_value2)) {
@@ -951,29 +1034,40 @@ do_get_file(int nargs, awk_value_t *result, struct awk_ext_func *unused)
return make_number(1.0, result);
}
-/* fill_in_array --- fill in a new array */
+/* populate_array --- fill in some array values */
-static void
-fill_in_array(awk_value_t *new_array)
+static int
+populate_array(awk_array_t a_cookie)
{
- awk_array_t a_cookie;
awk_value_t index, value;
- a_cookie = create_array();
-
(void) make_const_string("hello", 5, & index);
(void) make_const_string("world", 5, & value);
if (! set_array_element(a_cookie, & index, & value)) {
printf("fill_in_array:%d: set_array_element failed\n", __LINE__);
- return;
+ return -1;
}
(void) make_const_string("answer", 6, & index);
(void) make_number(42.0, & value);
if (! set_array_element(a_cookie, & index, & value)) {
printf("fill_in_array:%d: set_array_element failed\n", __LINE__);
- return;
+ return -1;
}
+ return 0;
+}
+
+/* fill_in_array --- fill in a new array */
+
+static void
+fill_in_array(awk_value_t *new_array)
+{
+ awk_array_t a_cookie;
+
+ a_cookie = create_array();
+
+ if (populate_array(a_cookie) < 0)
+ return;
new_array->val_type = AWK_ARRAY;
new_array->array_cookie = a_cookie;
@@ -1054,6 +1148,7 @@ static awk_ext_func_t func_table[] = {
{ "test_array_size", test_array_size, 1, 1, awk_false, NULL },
{ "test_array_elem", test_array_elem, 2, 2, awk_false, NULL },
{ "test_array_param", test_array_param, 1, 1, awk_false, NULL },
+ { "test_array_create", test_array_create, 1, 1, awk_false, NULL },
{ "print_do_lint", print_do_lint, 0, 0, awk_false, NULL },
{ "test_scalar", test_scalar, 1, 1, awk_false, NULL },
{ "test_scalar_reserved", test_scalar_reserved, 0, 0, awk_false, NULL },
diff --git a/gawkapi.c b/gawkapi.c
index 4435ad10..90f328f8 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:
@@ -173,6 +176,7 @@ awk_value_to_node(const awk_value_t *retval)
mpfr_init(ext_ret_val->mpg_numbr);
tval = mpfr_set(ext_ret_val->mpg_numbr, (mpfr_srcptr) retval->num_ptr, ROUND_MODE);
IEEE_FMT(ext_ret_val->mpg_numbr, tval);
+ mpfr_clear(retval->num_ptr);
#else
fatal(_("awk_value_to_node: MPFR not supported"));
#endif
@@ -182,7 +186,9 @@ awk_value_to_node(const awk_value_t *retval)
if (! do_mpfr)
fatal(_("awk_value_to_node: not in MPFR mode"));
ext_ret_val = make_number_node(MPZN);
+ mpz_init(ext_ret_val->mpg_i);
mpz_set(ext_ret_val->mpg_i, (mpz_ptr) retval->num_ptr);
+ mpz_clear(retval->num_ptr);
#else
fatal(_("awk_value_to_node: MPFR not supported"));
#endif
@@ -533,6 +539,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
@@ -568,8 +584,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);
@@ -579,7 +603,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;
@@ -613,10 +640,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;
@@ -641,7 +671,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;
@@ -669,7 +702,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;
@@ -847,7 +884,8 @@ api_sym_update(awk_ext_id_t id,
/*
* If we get here, then it exists already. Any valid type is
- * OK except for AWK_ARRAY.
+ * OK except for AWK_ARRAY (unless it is in Node_var_new undefined
+ * state, in which case an array is OK).
*/
if ( (node->flags & NO_EXT_SET) != 0
|| is_off_limits_var(full_name)) { /* most built-in vars not allowed */
@@ -858,8 +896,7 @@ api_sym_update(awk_ext_id_t id,
efree((void *) full_name);
- if ( value->val_type != AWK_ARRAY
- && (node->type == Node_var || node->type == Node_var_new)) {
+ if ((node->type == Node_var && value->val_type != AWK_ARRAY) || node->type == Node_var_new) {
unref(node->var_value);
node->var_value = awk_value_to_node(value);
if (node->type == Node_var_new && value->val_type != AWK_UNDEFINED)
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/gawkbug.in b/gawkbug.in
new file mode 100644
index 00000000..7e13ec5e
--- /dev/null
+++ b/gawkbug.in
@@ -0,0 +1,277 @@
+#!/bin/sh -
+#
+# gawkbug - create a bug report and mail it to the bug address
+#
+# All mail defaults to bug-gawk@gnu.org. Unlike the original bashbug
+# script, we don't differentiate on the release status.
+#
+# Copyright (C) 1996-2022 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 <http://www.gnu.org/licenses/>.
+
+#
+# configuration section:
+# these variables are filled in by the make target in Makefile
+#
+MACHINE="@host_cpu@"
+OS="@host_os@"
+CC="@CC@"
+CFLAGS="@CFLAGS@"
+VERSION="@PACKAGE_VERSION@"
+MACHTYPE="@host@"
+
+PATH=/bin:/usr/bin:/usr/local/bin:$PATH
+export PATH
+
+# Check if TMPDIR is set, default to /tmp
+: ${TMPDIR:=/tmp}
+
+#Securely create a temporary directory for the temporary files
+TEMPDIR=$TMPDIR/bbug.$$
+(umask 077 && mkdir "$TEMPDIR") || {
+ echo "$0: could not create temporary directory" >&2
+ exit 1
+}
+
+TEMPFILE1=$TEMPDIR/bbug1
+TEMPFILE2=$TEMPDIR/bbug2
+
+USAGE="Usage: $0 [--help] [--version] [bug-report-email-address]"
+VERSTR="GNU gawkbug, version ${VERSION}"
+
+do_help= do_version=
+
+while [ $# -gt 0 ]
+do
+ case "$1" in
+ --help) shift ; do_help=y ;;
+ --version) shift ; do_version=y ;;
+ --) shift ; break ;;
+ -*) echo "gawkbug: ${1}: invalid option" >&2
+ echo "$USAGE" >&2
+ exit 2 ;;
+ *) break ;;
+ esac
+done
+
+if [ -n "$do_version" ]
+then
+ echo "${VERSTR}"
+ exit 0
+fi
+
+if [ -n "$do_help" ]
+then
+ echo "${VERSTR}"
+ echo "${USAGE}"
+ echo
+ cat << HERE_EOF
+Gawkbug is used to send mail to the Gawk maintainers
+for when Gawk doesn't behave like you'd like, or expect.
+
+Gawkbug will start up your editor (as defined by the shell's
+EDITOR environment variable) with a preformatted bug report
+template for you to fill in. The report will be mailed to the
+bug-gawk mailing list by default. See the manual for details.
+
+If you invoke gawkbug by accident, just quit your editor without
+saving any changes to the template, and no bug report will be sent.
+HERE_EOF
+ exit 0
+fi
+
+# Figure out how to echo a string without a trailing newline
+N=`echo 'hi there\c'`
+case "$N" in
+*c) n=-n c= ;;
+*) n= c='\c' ;;
+esac
+
+BUGGAWK=bug-gawk@gnu.org
+
+BUGADDR="${1-$BUGGAWK}"
+
+if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]
+then
+ if [ -x /usr/bin/editor ]
+ then
+ DEFEDITOR=editor
+ elif [ -x /usr/bin/vim ]
+ then
+ DEFEDITOR=vim
+ elif [ -x /usr/bin/gvim ]
+ then
+ DEFEDITOR=gvim
+ elif [ -x /usr/local/bin/ce ]
+ then
+ DEFEDITOR=ce
+ elif [ -x /usr/local/bin/emacs ]
+ then
+ DEFEDITOR=emacs
+ elif [ -x /usr/contrib/bin/emacs ]
+ then
+ DEFEDITOR=emacs
+ elif [ -x /usr/bin/emacs ]
+ then
+ DEFEDITOR=emacs
+ elif [ -x /usr/bin/xemacs ]
+ then
+ DEFEDITOR=xemacs
+ elif [ -x /usr/bin/nano ]
+ then
+ DEFEDITOR=nano
+ elif [ -x /usr/contrib/bin/jove ]
+ then
+ DEFEDITOR=jove
+ elif [ -x /usr/local/bin/jove ]
+ then
+ DEFEDITOR=jove
+ elif [ -x /usr/bin/vi ]
+ then
+ DEFEDITOR=vi
+ else
+ echo "$0: No default editor found: attempting to use vi" >&2
+ DEFEDITOR=vi
+ fi
+fi
+
+
+: ${EDITOR=$DEFEDITOR}
+
+: ${USER=${LOGNAME-`whoami`}}
+
+trap 'rm -rf "$TEMPDIR"; exit 1' 1 2 3 13 15
+trap 'rm -rf "$TEMPDIR"' 0
+
+UN=
+if (uname) >/dev/null 2>&1
+then
+ UN=`uname -a`
+fi
+
+if [ -f /usr/lib/sendmail ]
+then
+ RMAIL="/usr/lib/sendmail"
+ SMARGS="-i -t"
+elif [ -f /usr/sbin/sendmail ]
+then
+ RMAIL="/usr/sbin/sendmail"
+ SMARGS="-i -t"
+else
+ RMAIL=rmail
+ SMARGS="$BUGADDR"
+fi
+
+INITIAL_SUBJECT='[50 character or so descriptive subject here (for reference)]'
+
+cat > "$TEMPFILE1" <<EOF
+From: ${USER}
+To: ${BUGADDR}
+Subject: ${INITIAL_SUBJECT}
+
+Configuration Information [Automatically generated, do not change]:
+Machine: $MACHINE
+OS: $OS
+Compiler: $CC
+Compilation CFLAGS: $CFLAGS
+uname output: $UN
+Machine Type: $MACHTYPE
+
+Gawk Version: $VERSION
+
+Description:
+ [Detailed description of the problem, suggestion, or complaint.]
+
+Repeat-By:
+ [Describe the sequence of events that causes the problem
+ to occur.]
+
+Fix:
+ [Description of how to fix the problem. If you don't know a
+ fix for the problem, don't include this section.]
+EOF
+
+cp "$TEMPFILE1" "$TEMPFILE2"
+chmod u+w "$TEMPFILE1"
+
+trap '' 2 # ignore interrupts while in editor
+
+edstat=1
+while [ $edstat -ne 0 ]
+do
+ $EDITOR "$TEMPFILE1"
+ edstat=$?
+
+ if [ $edstat -ne 0 ]
+ then
+ echo "$0: editor \`$EDITOR' exited with nonzero status."
+ echo "$0: Perhaps it was interrupted."
+ echo "$0: Type \`y' to give up, and lose your bug report;"
+ echo "$0: type \`n' to re-enter the editor."
+ echo $n "$0: Do you want to give up? $c"
+
+ read ans
+ case "$ans" in
+ [Yy]*) exit 1 ;;
+ esac
+
+ continue
+ fi
+
+ # find the subject from the temp file and see if it's been changed
+ CURR_SUB=`grep '^Subject: ' "$TEMPFILE1" | sed 's|^Subject:[ ]*||' | sed 1q`
+
+ case "$CURR_SUB" in
+ "${INITIAL_SUBJECT}")
+ echo
+ echo "$0: You have not changed the subject from the default."
+ echo "$0: Please use a more descriptive subject header."
+ echo "$0: Type \`y' to give up, and lose your bug report;"
+ echo "$0: type \`n' to re-enter the editor."
+ echo $n "$0: Do you want to give up? $c"
+
+ read ans
+ case "$ans" in
+ [Yy]*) exit 1 ;;
+ esac
+
+ echo "$0: The editor will be restarted in five seconds."
+ sleep 5
+ edstat=1
+ ;;
+ esac
+
+done
+
+trap 'rm -rf "$TEMPDIR"; exit 1' 2 # restore trap on SIGINT
+
+if cmp -s "$TEMPFILE1" "$TEMPFILE2"
+then
+ echo "File not changed, no bug report submitted."
+ exit
+fi
+
+echo $n "Send bug report to ${BUGADDR}? [y/n] $c"
+read ans
+case "$ans" in
+[Nn]*) exit 0 ;;
+esac
+
+${RMAIL} $SMARGS < "$TEMPFILE1" || {
+ cat "$TEMPFILE1" >> $HOME/dead.gawkbug
+ echo "$0: mail to ${BUGADDR} failed: report saved in $HOME/dead.gawkbug" >&2
+ echo "$0: please send it manually to ${BUGADDR}" >&2
+}
+
+exit 0
diff --git a/interpret.h b/interpret.h
index 03adcd79..ca67e966 100644
--- a/interpret.h
+++ b/interpret.h
@@ -494,37 +494,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 9e7762aa..e044123b 100644
--- a/main.c
+++ b/main.c
@@ -368,8 +368,12 @@ main(int argc, char **argv)
}
}
- if (do_lint && os_is_setuid())
- lintwarn(_("running %s setuid root may be a security problem"), myname);
+ if (do_lint) {
+ if (os_is_setuid())
+ lintwarn(_("running %s setuid root may be a security problem"), myname);
+ if (do_intervals)
+ lintwarn(_("The -r/--re-interval options no longer have any effect"));
+ }
if (do_debug) /* Need to register the debugger pre-exec hook before any other */
init_debug();
@@ -637,7 +641,8 @@ usage(int exitval, FILE *fp)
/* This is one string to make things easier on translators. */
/* TRANSLATORS: --help output (end)
no-wrap */
- fputs(_("\nTo report bugs, see node `Bugs' in `gawk.info'\n\
+ fputs(_("\nTo report bugs, use the `gawkbug' program.\n\
+For full instructions, see the node `Bugs' in `gawk.info'\n\
which is section `Reporting Problems and Bugs' in the\n\
printed version. This same information may be found at\n\
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.\n\
@@ -977,7 +982,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 */
@@ -1689,6 +1693,8 @@ parse_args(int argc, char **argv)
break;
case 'r':
+ // This no longer has any effect. It remains for the
+ // lint check in main().
do_flags |= DO_INTERVALS;
break;
diff --git a/mpfr.c b/mpfr.c
index dbaacb5c..ff4fde0b 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("invalid comparison type %d", (int) comparison_type);
+ 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 c5043baf..342ae067 100644
--- a/pc/ChangeLog
+++ b/pc/ChangeLog
@@ -10,6 +10,10 @@
* Makefile.tst: Regenerated.
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.tst: Regenerated.
+
2021-12-01 Arnold D. Robbins <arnold@skeeve.com>
* gawkmisc.pc (os_maybe_set_errno): Renamed from
@@ -86,6 +90,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 4b3fb0a5..d74172d1 100644
--- a/pc/Makefile.tst
+++ b/pc/Makefile.tst
@@ -186,35 +186,36 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
- arraysort2 arraytype backw badargs beginfile1 beginfile2 binmode1 \
- charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 commas crlf dbugeval dbugeval2 dbugeval3 \
- dbugtypedre1 dbugtypedre2 delsub devfd devfd1 devfd2 dfacheck1 \
- dumpvars errno exit fieldwdth forcenum fpat1 fpat2 fpat3 fpat4 \
- fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs funlen functab1 \
- functab2 functab3 functab6 fwtest fwtest2 fwtest3 fwtest4 fwtest5 \
- fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 getlndir \
- gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
- ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
- incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
+ arraysort2 arraytype asortbool backw badargs beginfile1 \
+ beginfile2 binmode1 charasbytes clos1way clos1way2 clos1way3 \
+ clos1way4 clos1way5 clos1way6 colonwarn commas crlf dbugeval \
+ dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub devfd \
+ devfd1 devfd2 dfacheck1 dumpvars errno exit fieldwdth forcenum \
+ fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \
+ fsfwfs functab1 functab2 functab3 functab6 funlen fwtest fwtest2 \
+ fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub \
+ gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \
+ icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase \
+ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
+ include include2 indirectbuiltin indirectcall indirectcall2 \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
- isarrayunset lint lintexp lintindex lintint lintlength lintplus \
- lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
- mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
- next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
- nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
- printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
- profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
- profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
- profile14 profile15 profile16 pty1 pty2 rebuf regexsub regnul1 regnul2 \
- regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \
+ inf-nan-torture intarray iolint isarrayunset lint lintexp \
+ lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
+ modifiers muldimposix nastyparm negtime next nondec nondec2 \
+ nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
+ nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
+ profile1 profile10 profile11 profile12 profile13 profile14 \
+ profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
+ profile7 profile8 profile9 pty1 pty2 rebuf regexsub reginttrad \
+ regnul1 regnul2 regx8bit reint reint2 rsgetline rsglstdin rsstart1 \
rsstart2 rsstart3 rstest6 sandbox1 shadow shadowbuiltin sortfor \
sortfor2 sortu sourcesplit split_after_fpat splitarg4 strftfld \
strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
- switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
- symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+ switch2 symtab1 symtab10 symtab11 symtab2 symtab3 symtab4 symtab5 \
+ symtab6 symtab7 symtab8 symtab9 timeout typedregex1 typedregex2 \
typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
typeof3 typeof4 typeof5 typeof6 watchpoint1
@@ -234,6 +235,7 @@ SHLIB_TESTS = \
getfile \
inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \
ordchr ordchr2 \
+ readall \
readdir readdir_test readdir_retest readfile readfile2 revout \
revtwoway rwarray \
testext time
@@ -346,7 +348,8 @@ EXPECTED_FAIL_ZOS = \
GENTESTS_UNUSED = Makefile.in checknegtime.awk dtdgport.awk fix-fmtspcl.awk \
fmtspcl-mpfr.ok fmtspcl.awk fmtspcl.tok gtlnbufv.awk hello.awk \
inchello.awk inclib.awk inplace.1.in inplace.2.in inplace.in \
- printfloat.awk readdir0.awk valgrind.awk xref.awk
+ printfloat.awk readdir0.awk valgrind.awk xref.awk \
+ readall1.awk readall2.awk
# List of tests on MinGW or DJGPP that need a different cmp program
@@ -1026,7 +1029,7 @@ inplace3bcomp::
testext::
@echo $@
- @-$(AWK) ' /^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
+ @-$(AWK) ' /^(@load|BEGIN|function)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
@-$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null; \
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ testext.awk testexttmp.txt ; \
@@ -1064,6 +1067,13 @@ readdir_retest:
@-$(AWK) -lreaddir_test -F$(SLASH) -f "$(srcdir)"/$@.awk "$(top_srcdir)" > _$@
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
+readall:
+ @echo $@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@1.awk -v "ofile=readall.state" > _$@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@2.awk -v "ifile=readall.state" >> _$@
+ @-$(CMP) $@.ok _$@ && rm -f _$@
+ @-$(RM) -f readall.state
+
fts:
@echo $@
@echo Expect $@ to fail with MinGW.
@@ -2589,6 +2599,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.
@@ -2743,11 +2758,6 @@ fsfwfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-funlen:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
functab1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -2768,6 +2778,11 @@ functab6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+funlen:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fwtest:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -2954,14 +2969,14 @@ lintlength:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintplus:
+lintold:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintold:
+lintplus:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
lintset:
@@ -3065,12 +3080,12 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsidentifier:
+nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsindirect1:
+nsidentifier:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -3131,47 +3146,47 @@ procinfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile4:
+profile10:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile8:
+profile11:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile9:
+profile13:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile10:
+profile14:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile11:
+profile15:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile13:
+profile16:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile14:
+profile4:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile15:
+profile8:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile16:
+profile9:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -3318,6 +3333,16 @@ symtab1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+symtab10:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+symtab11:
+ @echo $@ $(ZOS_FAIL)
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
symtab2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -3343,16 +3368,6 @@ symtab7:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-symtab10:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-symtab11:
- @echo $@ $(ZOS_FAIL)
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
timeout:
@echo $@ $(ZOS_FAIL)
@echo Expect $@ to fail with DJGPP and MinGW.
@@ -3691,7 +3706,11 @@ diffout:
if [ "$$i" != "_*" ]; then \
echo ============== $$i ============= ; \
base=`echo $$i | sed 's/^_//'` ; \
- if [ -r $${base}.ok ]; then \
+ if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r $${base}-mpfr.ok ]; then \
+ diff -u $${base}-mpfr.ok $$i ; \
+ elif echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r "$(srcdir)"/$${base}-mpfr.ok ]; then \
+ diff -u "$(srcdir)"/$${base}-mpfr.ok $$i ; \
+ elif [ -r $${base}.ok ]; then \
diff -u $${base}.ok $$i ; \
else \
diff -u "$(srcdir)"/$${base}.ok $$i ; \
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 afe41a61..23a0cff2 100644
--- a/po/ChangeLog
+++ b/po/ChangeLog
@@ -1,3 +1,7 @@
+2022-02-25 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * it.po: Updated.
+
2021-12-14 Arnold D. Robbins <arnold@skeeve.com>
* sr.po: Updated.
@@ -30,6 +34,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 279cd686..747ca21e 100644
--- a/po/it.po
+++ b/po/it.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: GNU Awk 5.1.1, API: 3.0\n"
"Report-Msgid-Bugs-To: bug-gawk@gnu.org\n"
-"POT-Creation-Date: 2021-10-27 07:58+0300\n"
-"PO-Revision-Date: 2021-10-22 17:15+0100\n"
+"POT-Creation-Date: 2022-02-23 10:45+0100\n"
+"PO-Revision-Date: 2022-02-23 11:10+0100\n"
"Last-Translator: Antonio Colombo <azc100@gmail.com>\n"
"Language-Team: Italian <it@li.org>\n"
"Language: it\n"
@@ -34,9 +34,9 @@ msgstr "tentativo di usare il parametro scalare `%s' come un vettore"
msgid "attempt to use scalar `%s' as an array"
msgstr "tentativo di usare scalare '%s' come vettore"
-#: array.c:402 array.c:569 builtin.c:89 builtin.c:1677 builtin.c:1723
-#: builtin.c:1736 builtin.c:2233 builtin.c:2260 eval.c:1155 eval.c:1159
-#: eval.c:1541
+#: array.c:402 array.c:569 builtin.c:89 builtin.c:1726 builtin.c:1772
+#: builtin.c:1785 builtin.c:2294 builtin.c:2321 eval.c:1154 eval.c:1158
+#: eval.c:1539
#, c-format
msgid "attempt to use array `%s' in a scalar context"
msgstr "tentativo di usare vettore `%s' in un contesto scalare"
@@ -54,14 +54,14 @@ msgstr "tentativo di usare scalare`%s[\"%.*s\"]' come vettore"
#: array.c:784 array.c:834
#, c-format
msgid "%s: first argument is not an array"
-msgstr "%s: il primo argomento non è un vettore"
+msgstr "%s: il primo argomento non è un vettore"
#: array.c:826
#, c-format
msgid "%s: second argument is not an array"
-msgstr "%s: il secondo argomento non è un vettore"
+msgstr "%s: il secondo argomento non è un vettore"
-#: array.c:829 field.c:1004 field.c:1096
+#: array.c:829 field.c:1006 field.c:1100
#, c-format
msgid "%s: cannot use %s as second argument"
msgstr "%s: non consentito usare %s come secondo argomento"
@@ -70,14 +70,14 @@ msgstr "%s: non consentito usare %s come secondo argomento"
#, c-format
msgid "%s: first argument cannot be SYMTAB without a second argument"
msgstr ""
-"%s: il primo argomento non può essere SYMTAB senza specificare un secondo "
+"%s: il primo argomento non può essere SYMTAB senza specificare un secondo "
"argomento"
#: array.c:839
#, c-format
msgid "%s: first argument cannot be FUNCTAB without a second argument"
msgstr ""
-"%s: il primo argomento non può essere FUNCTAB senza specificare un secondo "
+"%s: il primo argomento non può essere FUNCTAB senza specificare un secondo "
"argomento"
#: array.c:846
@@ -85,7 +85,7 @@ msgid ""
"asort/asorti: using the same array as source and destination without a third "
"argument is silly."
msgstr ""
-"asort/asorti: usare lo stesso vettore come origine e come destinazione è "
+"asort/asorti: usare lo stesso vettore come origine e come destinazione è "
"sciocco."
#: array.c:851
@@ -102,164 +102,164 @@ msgstr ""
"%s: non consentito un primo argomento che sia un sottovettore del secondo "
"argomento"
-#: array.c:1370
+#: array.c:1371
#, c-format
msgid "`%s' is invalid as a function name"
-msgstr "`%s' non è un nome funzione valido"
+msgstr "`%s' non è un nome funzione valido"
-#: array.c:1374
+#: array.c:1375
#, c-format
msgid "sort comparison function `%s' is not defined"
msgstr "funzione di confronto del sort `%s' non definita"
-#: awkgram.y:276
+#: awkgram.y:278
#, c-format
msgid "%s blocks must have an action part"
msgstr "blocchi %s richiedono una `azione'"
-#: awkgram.y:279
+#: awkgram.y:281
msgid "each rule must have a pattern or an action part"
msgstr "ogni regola deve avere una parte `espressione' o una parte `azione'"
-#: awkgram.y:420 awkgram.y:432
+#: awkgram.y:435 awkgram.y:447
msgid "old awk does not support multiple `BEGIN' or `END' rules"
-msgstr "il vecchio awk non supporta più di una regola `BEGIN' o `END'"
+msgstr "il vecchio awk non supporta più di una regola `BEGIN' o `END'"
-#: awkgram.y:485
+#: awkgram.y:500
#, c-format
msgid "`%s' is a built-in function, it cannot be redefined"
-msgstr "`%s' è una funzione interna, non si può ridefinire"
+msgstr "`%s' è una funzione interna, non si può ridefinire"
-#: awkgram.y:549
+#: awkgram.y:564
msgid "regexp constant `//' looks like a C++ comment, but is not"
-msgstr "espressione regolare costante `//' sembra un commento C++, ma non lo è"
+msgstr "espressione regolare costante `//' sembra un commento C++, ma non lo è"
-#: awkgram.y:553
+#: awkgram.y:568
#, c-format
msgid "regexp constant `/%s/' looks like a C comment, but is not"
-msgstr "espressione regolare costante `/%s/' sembra un commento C, ma non lo è"
+msgstr "espressione regolare costante `/%s/' sembra un commento C, ma non lo è"
-#: awkgram.y:680
+#: awkgram.y:695
#, c-format
msgid "duplicate case values in switch body: %s"
msgstr "valori di `case' doppi all'interno di uno `switch': %s"
-#: awkgram.y:701
+#: awkgram.y:716
msgid "duplicate `default' detected in switch body"
msgstr "valori di default doppi all'interno di uno `switch'"
-#: awkgram.y:1037 awkgram.y:4470
+#: awkgram.y:1052 awkgram.y:4491
msgid "`break' is not allowed outside a loop or switch"
msgstr "`break' non consentito fuori da un ciclo o da uno `switch'"
-#: awkgram.y:1047 awkgram.y:4462
+#: awkgram.y:1062 awkgram.y:4483
msgid "`continue' is not allowed outside a loop"
msgstr "`continue' non consentito fuori da un un ciclo"
-#: awkgram.y:1058
+#: awkgram.y:1073
#, c-format
msgid "`next' used in %s action"
msgstr "`next' usato in `azione' %s"
-#: awkgram.y:1069
+#: awkgram.y:1084
#, c-format
msgid "`nextfile' used in %s action"
msgstr "`nextfile' usato in `azione' %s"
-#: awkgram.y:1097
+#: awkgram.y:1112
msgid "`return' used outside function context"
msgstr "`return' usato fuori da una funzione"
-#: awkgram.y:1170
+#: awkgram.y:1185
msgid "plain `print' in BEGIN or END rule should probably be `print \"\"'"
msgstr "`print' da solo in BEGIN o END dovrebbe forse essere `print \"\"'"
-#: awkgram.y:1240 awkgram.y:1289
+#: awkgram.y:1255 awkgram.y:1304
msgid "`delete' is not allowed with SYMTAB"
msgstr "`delete' non consentito in SYMTAB"
-#: awkgram.y:1242 awkgram.y:1291
+#: awkgram.y:1257 awkgram.y:1306
msgid "`delete' is not allowed with FUNCTAB"
msgstr "`delete' non consentito in FUNCTAB"
-#: awkgram.y:1276 awkgram.y:1280
+#: awkgram.y:1291 awkgram.y:1295
msgid "`delete(array)' is a non-portable tawk extension"
-msgstr "`delete(array)' è un'estensione tawk non-portabile"
+msgstr "`delete(array)' è un'estensione tawk non-portabile"
-#: awkgram.y:1416
+#: awkgram.y:1431
msgid "multistage two-way pipelines don't work"
msgstr "`pipeline' multistadio bidirezionali non funzionano"
-#: awkgram.y:1418
+#: awkgram.y:1433
msgid "concatenation as I/O `>' redirection target is ambiguous"
msgstr "concatenazione in I/O `>' destinazione della ridirezione ambigua"
-#: awkgram.y:1630
+#: awkgram.y:1645
msgid "regular expression on right of assignment"
msgstr "espressione regolare usata per assegnare un valore"
-#: awkgram.y:1645 awkgram.y:1658
+#: awkgram.y:1660 awkgram.y:1673
msgid "regular expression on left of `~' or `!~' operator"
msgstr "espressione regolare prima di operatore `~' o `!~'"
-#: awkgram.y:1675 awkgram.y:1825
+#: awkgram.y:1690 awkgram.y:1840
msgid "old awk does not support the keyword `in' except after `for'"
msgstr "il vecchio awk non supporta la parola-chiave `in' se non dopo `for'"
-#: awkgram.y:1685
+#: awkgram.y:1700
msgid "regular expression on right of comparison"
msgstr "espressione regolare a destra in un confronto"
-#: awkgram.y:1804
+#: awkgram.y:1819
#, c-format
msgid "non-redirected `getline' invalid inside `%s' rule"
msgstr "`getline' non ridiretta invalida all'interno della regola `%s'"
-#: awkgram.y:1807
+#: awkgram.y:1822
msgid "non-redirected `getline' undefined inside END action"
msgstr "`getline' non ri-diretta indefinita dentro `azione' END"
-#: awkgram.y:1827
+#: awkgram.y:1842
msgid "old awk does not support multidimensional arrays"
msgstr "il vecchio awk non supporta vettori multidimensionali"
-#: awkgram.y:1930
+#: awkgram.y:1945
msgid "call of `length' without parentheses is not portable"
msgstr "chiamata a `length' senza parentesi non-portabile"
-#: awkgram.y:2004
+#: awkgram.y:2019
msgid "indirect function calls are a gawk extension"
msgstr "chiamate indirette di funzione sono un'estensione gawk"
-#: awkgram.y:2017
+#: awkgram.y:2032
#, c-format
msgid "cannot use special variable `%s' for indirect function call"
msgstr ""
"non riesco a usare la variabile speciale `%s' in una chiamata indiretta di "
"funzione"
-#: awkgram.y:2050
+#: awkgram.y:2065
#, c-format
msgid "attempt to use non-function `%s' in function call"
msgstr "tentativo di usare la non-funzione `%s' in una chiamata di funzione"
-#: awkgram.y:2115
+#: awkgram.y:2130
msgid "invalid subscript expression"
msgstr "espressione indice invalida"
-#: awkgram.y:2488 awkgram.y:2508 gawkapi.c:265 gawkapi.c:282 msg.c:133
+#: awkgram.y:2504 awkgram.y:2524 gawkapi.c:269 gawkapi.c:286 msg.c:133
msgid "warning: "
msgstr "attenzione: "
-#: awkgram.y:2506 gawkapi.c:237 gawkapi.c:280 msg.c:165
+#: awkgram.y:2522 gawkapi.c:241 gawkapi.c:284 msg.c:165
msgid "fatal: "
msgstr "fatale: "
-#: awkgram.y:2559
+#: awkgram.y:2575
msgid "unexpected newline or end of string"
msgstr "carattere 'a capo' o fine stringa non previsti"
-#: awkgram.y:2580
+#: awkgram.y:2596
msgid ""
"source files / command-line arguments must contain complete functions or "
"rules"
@@ -267,270 +267,270 @@ msgstr ""
"i file sorgente / gli argomenti sulla riga di comando devono contenere "
"funzioni o regole complete"
-#: awkgram.y:2862 awkgram.y:2940 awkgram.y:3178 debug.c:545 debug.c:561
+#: awkgram.y:2878 awkgram.y:2956 awkgram.y:3194 debug.c:545 debug.c:561
#: debug.c:2840 debug.c:5206
#, c-format
msgid "cannot open source file `%s' for reading: %s"
msgstr "non riesco ad aprire file sorgente `%s' in lettura: %s"
-#: awkgram.y:2863 awkgram.y:3000
+#: awkgram.y:2879 awkgram.y:3016
#, c-format
msgid "cannot open shared library `%s' for reading: %s"
msgstr "non riesco ad aprire shared library `%s' in lettura: %s"
-#: awkgram.y:2865 awkgram.y:2941 awkgram.y:3001 builtin.c:150 debug.c:5357
+#: awkgram.y:2881 awkgram.y:2957 awkgram.y:3017 builtin.c:137 debug.c:5357
msgid "reason unknown"
msgstr "ragione indeterminata"
-#: awkgram.y:2874 awkgram.y:2898
+#: awkgram.y:2890 awkgram.y:2914
#, c-format
msgid "cannot include `%s' and use it as a program file"
msgstr "non riesco a includere `%s' per usarlo come file di programma"
-#: awkgram.y:2887
+#: awkgram.y:2903
#, c-format
msgid "already included source file `%s'"
-msgstr "file sorgente `%s' già incluso"
+msgstr "file sorgente `%s' già incluso"
-#: awkgram.y:2888
+#: awkgram.y:2904
#, c-format
msgid "already loaded shared library `%s'"
-msgstr "shared library `%s' già inclusa"
+msgstr "shared library `%s' già inclusa"
-#: awkgram.y:2925
+#: awkgram.y:2941
msgid "@include is a gawk extension"
-msgstr "@include è un'estensione gawk"
+msgstr "@include è un'estensione gawk"
-#: awkgram.y:2931
+#: awkgram.y:2947
msgid "empty filename after @include"
msgstr "nome-file mancante dopo @include"
-#: awkgram.y:2980
+#: awkgram.y:2996
msgid "@load is a gawk extension"
-msgstr "@load è un'estensione gawk"
+msgstr "@load è un'estensione gawk"
-#: awkgram.y:2987
+#: awkgram.y:3003
msgid "empty filename after @load"
msgstr "nome-file mancante dopo @include"
-#: awkgram.y:3130
+#: awkgram.y:3146
msgid "empty program text on command line"
msgstr "programma nullo sulla riga comandi"
-#: awkgram.y:3246 debug.c:470 debug.c:628
+#: awkgram.y:3262 debug.c:470 debug.c:628
#, c-format
msgid "cannot read source file `%s': %s"
msgstr "non riesco a leggere file sorgente `%s': %s"
-#: awkgram.y:3257
+#: awkgram.y:3273
#, c-format
msgid "source file `%s' is empty"
msgstr "file sorgente `%s' vuoto"
-#: awkgram.y:3317
+#: awkgram.y:3333
#, c-format
msgid "error: invalid character '\\%03o' in source code"
msgstr "errore: carattere invalido '\\%03o' nel codice sorgente"
-#: awkgram.y:3544
+#: awkgram.y:3560
msgid "source file does not end in newline"
msgstr "file sorgente non termina con carattere 'a capo'"
-#: awkgram.y:3665
+#: awkgram.y:3681
msgid "unterminated regexp ends with `\\' at end of file"
msgstr "espressione regolare non completata termina con `\\' a fine file"
-#: awkgram.y:3692
+#: awkgram.y:3708
#, c-format
msgid "%s: %d: tawk regex modifier `/.../%c' doesn't work in gawk"
msgstr ""
"%s: %d: modificatore di espressione regolare tawk `/.../%c' non valido in "
"gawk"
-#: awkgram.y:3696
+#: awkgram.y:3712
#, c-format
msgid "tawk regex modifier `/.../%c' doesn't work in gawk"
msgstr "modificatore di espressione regolare tawk `/.../%c' non valido in gawk"
-#: awkgram.y:3709
+#: awkgram.y:3725
msgid "unterminated regexp"
msgstr "espressione regolare non completa"
-#: awkgram.y:3713
+#: awkgram.y:3729
msgid "unterminated regexp at end of file"
msgstr "espressione regolare non completa a fine file"
-#: awkgram.y:3802
+#: awkgram.y:3818
msgid "use of `\\ #...' line continuation is not portable"
msgstr "uso di `\\ #...' continuazione riga non-portabile"
-#: awkgram.y:3824
+#: awkgram.y:3840
msgid "backslash not last character on line"
-msgstr "la barra inversa non è l'ultimo carattere della riga"
+msgstr "la barra inversa non è l'ultimo carattere della riga"
-#: awkgram.y:3871 awkgram.y:3873
+#: awkgram.y:3887 awkgram.y:3889
msgid "multidimensional arrays are a gawk extension"
msgstr "i vettori multidimensionali sono un'estensione gawk"
-#: awkgram.y:3898 awkgram.y:3909
+#: awkgram.y:3914 awkgram.y:3925
#, c-format
msgid "POSIX does not allow operator `%s'"
msgstr "POSIX non consente l'operatore `%s'"
-#: awkgram.y:3900 awkgram.y:3911 awkgram.y:3946 awkgram.y:3954
+#: awkgram.y:3916 awkgram.y:3927 awkgram.y:3962 awkgram.y:3970
#, c-format
msgid "operator `%s' is not supported in old awk"
msgstr "operatore `%s' non supportato nel vecchio awk"
-#: awkgram.y:4051 awkgram.y:4073 command.y:1188
+#: awkgram.y:4067 awkgram.y:4089 command.y:1188
msgid "unterminated string"
msgstr "stringa non delimitata"
-#: awkgram.y:4061 main.c:1223
+#: awkgram.y:4077 main.c:1223
msgid "POSIX does not allow physical newlines in string values"
msgstr ""
"POSIX non consente dei caratteri di ritorno a capo nei valori assegnati a "
"una stringa"
-#: awkgram.y:4063 node.c:453
+#: awkgram.y:4079 node.c:452
msgid "backslash string continuation is not portable"
msgstr "uso di barra inversa per continuazione stringa non-portabile"
-#: awkgram.y:4301
+#: awkgram.y:4320
#, c-format
msgid "invalid char '%c' in expression"
msgstr "carattere '%c' non valido in un'espressione"
-#: awkgram.y:4396
+#: awkgram.y:4415
#, c-format
msgid "`%s' is a gawk extension"
-msgstr "`%s' è un'estensione gawk"
+msgstr "`%s' è un'estensione gawk"
-#: awkgram.y:4401
+#: awkgram.y:4420
#, c-format
msgid "POSIX does not allow `%s'"
msgstr "POSIX non consente `%s'"
-#: awkgram.y:4409
+#: awkgram.y:4428
#, c-format
msgid "`%s' is not supported in old awk"
-msgstr "`%s' non è supportato nel vecchio awk"
+msgstr "`%s' non è supportato nel vecchio awk"
-#: awkgram.y:4507
+#: awkgram.y:4528
msgid "`goto' considered harmful!"
msgstr "`goto' considerato pericoloso!"
-#: awkgram.y:4576
+#: awkgram.y:4597
#, c-format
msgid "%d is invalid as number of arguments for %s"
msgstr "%d non valido come numero di argomenti per %s"
-#: awkgram.y:4611
+#: awkgram.y:4632
#, c-format
msgid "%s: string literal as last argument of substitute has no effect"
msgstr ""
"%s: una stringa di caratteri come ultimo argomento di substitute non ha "
"effetto"
-#: awkgram.y:4616
+#: awkgram.y:4637
#, c-format
msgid "%s third parameter is not a changeable object"
-msgstr "il terzo parametro di %s non è un oggetto modificabile"
+msgstr "il terzo parametro di %s non è un oggetto modificabile"
-#: awkgram.y:4720 awkgram.y:4723
+#: awkgram.y:4741 awkgram.y:4744
msgid "match: third argument is a gawk extension"
-msgstr "match: il terzo argomento è un'estensione gawk"
+msgstr "match: il terzo argomento è un'estensione gawk"
-#: awkgram.y:4777 awkgram.y:4780
+#: awkgram.y:4798 awkgram.y:4801
msgid "close: second argument is a gawk extension"
-msgstr "close: il secondo argomento è un'estensione gawk"
+msgstr "close: il secondo argomento è un'estensione gawk"
-#: awkgram.y:4792
+#: awkgram.y:4813
msgid "use of dcgettext(_\"...\") is incorrect: remove leading underscore"
msgstr ""
"uso scorretto di dcgettext(_\"...\"): togliere il carattere '_' iniziale"
-#: awkgram.y:4807
+#: awkgram.y:4828
msgid "use of dcngettext(_\"...\") is incorrect: remove leading underscore"
msgstr ""
"uso scorretto di dcngettext(_\"...\"): togliere il carattere '_' iniziale"
-#: awkgram.y:4826
+#: awkgram.y:4847
msgid "index: regexp constant as second argument is not allowed"
msgstr "index: espressione regolare come secondo argomento non consentita"
-#: awkgram.y:4879
+#: awkgram.y:4900
#, c-format
msgid "function `%s': parameter `%s' shadows global variable"
msgstr "funzione `%s': il parametro `%s' nasconde variabile globale"
-#: awkgram.y:4928 debug.c:4190 debug.c:4233 debug.c:5355 profile.c:110
+#: awkgram.y:4949 debug.c:4190 debug.c:4233 debug.c:5355 profile.c:110
#, c-format
msgid "could not open `%s' for writing: %s"
msgstr "non riesco ad aprire `%s' in scrittura: %s"
-#: awkgram.y:4929
+#: awkgram.y:4950
msgid "sending variable list to standard error"
msgstr "mando lista variabili a `standard error'"
-#: awkgram.y:4937
+#: awkgram.y:4958
#, c-format
msgid "%s: close failed: %s"
msgstr "%s: close non riuscita: %s"
-#: awkgram.y:4962
+#: awkgram.y:4983
msgid "shadow_funcs() called twice!"
msgstr "shadow_funcs() chiamata due volte!"
-#: awkgram.y:4970
+#: awkgram.y:4991
msgid "there were shadowed variables"
msgstr "erano presenti variabili nascoste"
-#: awkgram.y:5047
+#: awkgram.y:5068
#, c-format
msgid "function name `%s' previously defined"
msgstr "funzione di nome `%s' definita in precedenza"
-#: awkgram.y:5098
+#: awkgram.y:5119
#, c-format
msgid "function `%s': cannot use function name as parameter name"
-msgstr "funzione `%s': non si può usare nome di funzione come nome parametro"
+msgstr "funzione `%s': non si può usare nome di funzione come nome parametro"
-#: awkgram.y:5101
+#: awkgram.y:5122
#, c-format
msgid "function `%s': cannot use special variable `%s' as a function parameter"
msgstr ""
-"funzione `%s': non si può usare la variabile speciale `%s' come parametro di "
+"funzione `%s': non si può usare la variabile speciale `%s' come parametro di "
"funzione"
-#: awkgram.y:5105
+#: awkgram.y:5126
#, c-format
msgid "function `%s': parameter `%s' cannot contain a namespace"
-msgstr "funzione `%s': il parametro `%s' non può contenere un nome-di-spazio"
+msgstr "funzione `%s': il parametro `%s' non può contenere un nome-di-spazio"
-#: awkgram.y:5112
+#: awkgram.y:5133
#, c-format
msgid "function `%s': parameter #%d, `%s', duplicates parameter #%d"
msgstr "funzione `%s': il parametro #%d, `%s', duplica il parametro #%d"
-#: awkgram.y:5201
+#: awkgram.y:5222
#, c-format
msgid "function `%s' called but never defined"
msgstr "funzione `%s' chiamata ma mai definita"
-#: awkgram.y:5205
+#: awkgram.y:5226
#, c-format
msgid "function `%s' defined but never called directly"
msgstr "funzione `%s' definita ma mai chiamata direttamente"
-#: awkgram.y:5237
+#: awkgram.y:5258
#, c-format
msgid "regexp constant for parameter #%d yields boolean value"
msgstr ""
"espressione regolare di valore costante per parametro #%d genera valore "
"booleano"
-#: awkgram.y:5252
+#: awkgram.y:5273
#, c-format
msgid ""
"function `%s' called with space between name and `(',\n"
@@ -539,322 +539,326 @@ msgstr ""
"funzione `%s' chiamata con spazio tra il nome e `(',\n"
"o usata come variabile o vettore"
-#: awkgram.y:5471 mpfr.c:1513 mpfr.c:1548
+#: awkgram.y:5492 mpfr.c:1580 mpfr.c:1615
msgid "division by zero attempted"
msgstr "tentativo di dividere per zero"
-#: awkgram.y:5480 mpfr.c:1558
+#: awkgram.y:5501 mpfr.c:1625
#, c-format
msgid "division by zero attempted in `%%'"
msgstr "tentativo di dividere per zero in `%%'"
-#: awkgram.y:5825
+#: awkgram.y:5846
msgid ""
"cannot assign a value to the result of a field post-increment expression"
msgstr ""
"impossibile assegnare un valore al risultato di un'espressione di post-"
"incremento di un campo"
-#: awkgram.y:5828
+#: awkgram.y:5849
#, c-format
msgid "invalid target of assignment (opcode %s)"
msgstr "destinazione di assegnazione non valida (codice operativo %s)"
-#: awkgram.y:6212
+#: awkgram.y:6233
msgid "statement has no effect"
msgstr "l'istruzione non fa nulla"
-#: awkgram.y:6728
+#: awkgram.y:6749
#, c-format
msgid "identifier %s: qualified names not allowed in traditional / POSIX mode"
msgstr ""
"identificativo %s: nomi qualificati non consentiti in modo tradizionale / "
"POSIX"
-#: awkgram.y:6733
+#: awkgram.y:6754
#, c-format
msgid "identifier %s: namespace separator is two colons, not one"
msgstr ""
-"identificativo %s: il separatore dello spazio-dei-nomi è costituito da due "
+"identificativo %s: il separatore dello spazio-dei-nomi è costituito da due "
"caratteri ':', non da uno solo"
-#: awkgram.y:6739
+#: awkgram.y:6760
#, c-format
msgid "qualified identifier `%s' is badly formed"
-msgstr "l'identificativo qualificato `%s' non è nel formato richiesto"
+msgstr "l'identificativo qualificato `%s' non è nel formato richiesto"
-#: awkgram.y:6746
+#: awkgram.y:6767
#, c-format
msgid ""
"identifier `%s': namespace separator can only appear once in a qualified name"
msgstr ""
-"identificativo `%s': il separatore dello spazio-dei-nomi può apparire una "
+"identificativo `%s': il separatore dello spazio-dei-nomi può apparire una "
"sola volta in un identificativo qualificato"
-#: awkgram.y:6795 awkgram.y:6846
+#: awkgram.y:6816 awkgram.y:6867
#, c-format
msgid "using reserved identifier `%s' as a namespace is not allowed"
msgstr ""
-"l'uso dell'identificativo riservato `%s' come nome-di-spazio non è "
+"l'uso dell'identificativo riservato `%s' come nome-di-spazio non è "
"consentito"
-#: awkgram.y:6802 awkgram.y:6812
+#: awkgram.y:6823 awkgram.y:6833
#, c-format
msgid ""
"using reserved identifier `%s' as second component of a qualified name is "
"not allowed"
msgstr ""
"l'uso dell'identificativo riservato `%s' come secondo componente di un "
-"identificativo qualificato non è consentito"
+"identificativo qualificato non è consentito"
-#: awkgram.y:6830
+#: awkgram.y:6851
msgid "@namespace is a gawk extension"
-msgstr "@namespace è un'estensione gawk"
+msgstr "@namespace è un'estensione gawk"
-#: awkgram.y:6837
+#: awkgram.y:6858
#, c-format
msgid "namespace name `%s' must meet identifier naming rules"
msgstr ""
"il nome dello spazio-dei-nomi `%s' deve rispettare le regole di assegnazione "
"degli identificativi"
-#: builtin.c:144
+#: builtin.c:99 builtin.c:106
+msgid "%s: called with %d arguments"
+msgstr "%s: chiamata con %d argomenti"
+
+#: builtin.c:131
#, c-format
msgid "%s to \"%s\" failed: %s"
msgstr "%s a \"%s\" non riuscita: %s"
-#: builtin.c:148
+#: builtin.c:135
msgid "standard output"
msgstr "standard output"
-#: builtin.c:149
+#: builtin.c:136
msgid "standard error"
msgstr "standard error"
-#: builtin.c:163 builtin.c:493 builtin.c:583 builtin.c:1786 builtin.c:2510
-#: builtin.c:2526 builtin.c:2640 builtin.c:3627 mpfr.c:761
+#: builtin.c:196 builtin.c:532 builtin.c:632 builtin.c:1837 builtin.c:2579
+#: builtin.c:2597 builtin.c:2716 builtin.c:3725 mpfr.c:812
#, c-format
msgid "%s: received non-numeric argument"
msgstr "%s: ricevuto argomento non numerico"
-#: builtin.c:169
+#: builtin.c:202
#, c-format
msgid "exp: argument %g is out of range"
msgstr "exp: argomento %g fuori intervallo"
-#: builtin.c:246
+#: builtin.c:281
#, c-format
msgid "fflush: cannot flush: pipe `%.*s' opened for reading, not writing"
msgstr ""
"fflush: non riesco a scaricare: `pipe' `%.*s' aperta in lettura, non in "
"scrittura"
-#: builtin.c:249
+#: builtin.c:284
#, c-format
msgid "fflush: cannot flush: file `%.*s' opened for reading, not writing"
msgstr ""
"fflush: non riesco a scaricare: file `%.*s' aperto in lettura, non in "
"scrittura"
-#: builtin.c:260
+#: builtin.c:295
#, c-format
msgid "fflush: cannot flush file `%.*s': %s"
msgstr "fflush: non riesco a scaricare file `%.*s': %s"
-#: builtin.c:265
+#: builtin.c:300
#, c-format
msgid "fflush: cannot flush: two-way pipe `%.*s' has closed write end"
msgstr ""
"fflush: non riesco a scaricare: `pipe' bidirezionale `%.*s' ha chiuso il "
"lato in scrittura"
-#: builtin.c:271
+#: builtin.c:306
#, c-format
msgid "fflush: `%.*s' is not an open file, pipe or co-process"
-msgstr "fflush: `%.*s' non è un file aperto, una `pipe' o un co-processo"
+msgstr "fflush: `%.*s' non è un file aperto, una `pipe' o un co-processo"
-#: builtin.c:378 builtin.c:2023
+#: builtin.c:415 builtin.c:2078
#, c-format
msgid "%s: received non-string first argument"
-msgstr "%s: ricevuto primo argomento che non è una stringa"
+msgstr "%s: ricevuto primo argomento che non è una stringa"
-#: builtin.c:380
+#: builtin.c:417
#, c-format
msgid "%s: received non-string second argument"
-msgstr "%s: ricevuto secondo argomento che non è una stringa"
+msgstr "%s: ricevuto secondo argomento che non è una stringa"
-#: builtin.c:532
+#: builtin.c:575
msgid "length: received array argument"
-msgstr "length: ricevuto argomento che è un vettore"
+msgstr "length: ricevuto argomento che è un vettore"
-#: builtin.c:535
+#: builtin.c:578
msgid "`length(array)' is a gawk extension"
-msgstr "`length(array)' è un'estensione gawk"
+msgstr "`length(array)' è un'estensione gawk"
-#: builtin.c:554 builtin.c:2113 builtin.c:2173 builtin.c:2425 builtin.c:2456
+#: builtin.c:601 builtin.c:2172 builtin.c:2234 builtin.c:2488 builtin.c:2521
#, c-format
msgid "%s: received non-string argument"
-msgstr "%s: ricevuto argomento che non è una stringa"
+msgstr "%s: ricevuto argomento che non è una stringa"
-#: builtin.c:586 builtin.c:1790
+#: builtin.c:635 builtin.c:1841
#, c-format
msgid "%s: received negative argument %g"
msgstr "%s: ricevuto argomento negativo %g"
-#: builtin.c:791 builtin.c:796 builtin.c:950
+#: builtin.c:840 builtin.c:845 builtin.c:999
msgid "fatal: must use `count$' on all formats or none"
msgstr "fatale: `count$' va usato per tutti i formati o per nessuno"
-#: builtin.c:869
+#: builtin.c:918
#, c-format
msgid "field width is ignored for `%%' specifier"
msgstr "larghezza campo ignorata per la specifica `%%'"
-#: builtin.c:871
+#: builtin.c:920
#, c-format
msgid "precision is ignored for `%%' specifier"
msgstr "precisione ignorata per la specifica `%%'"
-#: builtin.c:873
+#: builtin.c:922
#, c-format
msgid "field width and precision are ignored for `%%' specifier"
msgstr "larghezza campo e precisone ignorate per la specifica `%%'"
-#: builtin.c:924
+#: builtin.c:973
msgid "fatal: `$' is not permitted in awk formats"
msgstr "fatale: operatore `$' non consentito nei formati awk"
-#: builtin.c:933
+#: builtin.c:982
msgid "fatal: argument index with `$' must be > 0"
msgstr "fatale: indice argomenti con `$' dev'essere > 0"
-#: builtin.c:937
+#: builtin.c:986
#, c-format
msgid ""
"fatal: argument index %ld greater than total number of supplied arguments"
msgstr ""
"fatale: indice argomenti %ld maggiore del numero totale argomenti specificati"
-#: builtin.c:941
+#: builtin.c:990
msgid "fatal: `$' not permitted after period in format"
msgstr "fatale: `$' non consentito dopo il punto in un formato"
-#: builtin.c:960
+#: builtin.c:1009
msgid "fatal: no `$' supplied for positional field width or precision"
msgstr "fatale: manca `$' per i campi posizionali larghezza o precisione"
-#: builtin.c:1035
+#: builtin.c:1084
#, c-format
msgid "`%c' is meaningless in awk formats; ignored"
msgstr "`%c' non ha senso nei formati awk; ignorato"
-#: builtin.c:1039
+#: builtin.c:1088
#, c-format
msgid "fatal: `%c' is not permitted in POSIX awk formats"
msgstr "fatale: `%c' non consentito nei formati POSIX awk"
-#: builtin.c:1070
+#: builtin.c:1119
#, c-format
msgid "[s]printf: value %g is too big for %%c format"
msgstr "[s]printf: valore %g troppo elevato per il formato %%c"
-#: builtin.c:1083
+#: builtin.c:1132
#, c-format
msgid "[s]printf: value %g is not a valid wide character"
-msgstr "[s]printf: valore %g non è un carattere multibyte valido "
+msgstr "[s]printf: valore %g non è un carattere multibyte valido "
-#: builtin.c:1475
+#: builtin.c:1524
#, c-format
msgid "[s]printf: value %g is out of range for `%%%c' format"
msgstr "[s]printf: valore %g fuori intervallo per il formato `%%%c'"
-#: builtin.c:1483
+#: builtin.c:1532
#, c-format
msgid "[s]printf: value %s is out of range for `%%%c' format"
msgstr "[s]printf: valore %s fuori intervallo per il formato `%%%c'"
-#: builtin.c:1508
+#: builtin.c:1557
#, c-format
msgid "%%%c format is POSIX standard but not portable to other awks"
-msgstr "il formato %%%c è nello standard POSIX ma non-portabile ad altri awk"
+msgstr "il formato %%%c è nello standard POSIX ma non-portabile ad altri awk"
-#: builtin.c:1619
+#: builtin.c:1668
#, c-format
msgid "ignoring unknown format specifier character `%c': no argument converted"
msgstr "carattere di formato ignoto `%c' ignorato: nessun argomento convertito"
-#: builtin.c:1624
+#: builtin.c:1673
msgid "fatal: not enough arguments to satisfy format string"
msgstr ""
"fatale: argomenti in numero minore di quelli richiesti dalla stringa di "
"formato"
-#: builtin.c:1626
+#: builtin.c:1675
msgid "^ ran out for this one"
msgstr "^ esauriti a questo punto"
-#: builtin.c:1633
+#: builtin.c:1682
msgid "[s]printf: format specifier does not have control letter"
msgstr "[s]printf: specifica di formato senza un carattere di controllo"
-#: builtin.c:1636
+#: builtin.c:1685
msgid "too many arguments supplied for format string"
msgstr "troppi argomenti specificati per questa stringa di formato"
-#: builtin.c:1696
+#: builtin.c:1745
msgid "sprintf: no arguments"
msgstr "sprintf: nessun argomento"
-#: builtin.c:1719 builtin.c:1730
+#: builtin.c:1768 builtin.c:1779
msgid "printf: no arguments"
msgstr "printf: nessun argomento"
-#: builtin.c:1745
+#: builtin.c:1794
msgid "printf: attempt to write to closed write end of two-way pipe"
msgstr ""
"printf: tentativo di scrivere al lato in scrittura, chiuso, di una `pipe' "
"bidirezionale"
-#: builtin.c:1821
+#: builtin.c:1874
#, c-format
msgid "substr: length %g is not >= 1"
msgstr "substr: lunghezza %g non >= 1"
-#: builtin.c:1823
+#: builtin.c:1876
#, c-format
msgid "substr: length %g is not >= 0"
msgstr "substr: lunghezza %g non >= 0"
-#: builtin.c:1837
+#: builtin.c:1890
#, c-format
msgid "substr: non-integer length %g will be truncated"
-msgstr "substr: lunghezza non intera %g: sarà troncata"
+msgstr "substr: lunghezza non intera %g: sarà troncata"
-#: builtin.c:1842
+#: builtin.c:1895
#, c-format
msgid "substr: length %g too big for string indexing, truncating to %g"
msgstr "substr: lunghezza %g troppo elevata per indice stringa, tronco a %g"
-#: builtin.c:1854
+#: builtin.c:1907
#, c-format
msgid "substr: start index %g is invalid, using 1"
msgstr "substr: indice di partenza %g non valido, uso 1"
-#: builtin.c:1859
+#: builtin.c:1912
#, c-format
msgid "substr: non-integer start index %g will be truncated"
-msgstr "substr: indice di partenza non intero %g: sarà troncato"
+msgstr "substr: indice di partenza non intero %g: sarà troncato"
-#: builtin.c:1882
+#: builtin.c:1935
msgid "substr: source string is zero length"
msgstr "substr: stringa di partenza lunga zero"
-#: builtin.c:1896
+#: builtin.c:1949
#, c-format
msgid "substr: start index %g is past end of string"
msgstr "substr: indice di partenza %g oltre la fine della stringa"
-#: builtin.c:1904
+#: builtin.c:1957
#, c-format
msgid ""
"substr: length %g at start index %g exceeds length of first argument (%lu)"
@@ -862,149 +866,156 @@ msgstr ""
"substr: lunghezza %g all'indice di partenza %g supera la lunghezza del primo "
"argomento (%lu)"
-#: builtin.c:1977
+#: builtin.c:2032
msgid "strftime: format value in PROCINFO[\"strftime\"] has numeric type"
msgstr ""
-"strftime: il valore del formato in PROCINFO[\"strftime\"] è di tipo numerico"
+"strftime: il valore del formato in PROCINFO[\"strftime\"] è di tipo numerico"
-#: builtin.c:1997 builtin.c:2491 builtin.c:3459 builtin.c:3498 builtin.c:4058
+#: builtin.c:2052 builtin.c:2558 builtin.c:3553 builtin.c:3594 builtin.c:4166
#, c-format
msgid "%s: received non-numeric second argument"
msgstr "%s: ricevuto secondo argomento non numerico"
-#: builtin.c:2007
+#: builtin.c:2062
msgid "strftime: second argument less than 0 or too big for time_t"
msgstr "strftime: secondo argomento minore di 0 o troppo elevato per time_t"
-#: builtin.c:2014
+#: builtin.c:2069
msgid "strftime: second argument out of range for time_t"
-msgstr "strftime: il secondo argomento è fuori intervallo per time_t"
+msgstr "strftime: il secondo argomento è fuori intervallo per time_t"
-#: builtin.c:2030
+#: builtin.c:2085
msgid "strftime: received empty format string"
msgstr "strftime: ricevuta stringa nulla come formato"
-#: builtin.c:2132
+#: builtin.c:2191
msgid "mktime: at least one of the values is out of the default range"
-msgstr "mktime: almeno un valore è fuori dall'intervallo di default"
+msgstr "mktime: almeno un valore è fuori dall'intervallo di default"
-#: builtin.c:2168
+#: builtin.c:2229
msgid "'system' function not allowed in sandbox mode"
msgstr "funzione 'system' non consentita in modo `sandbox'"
-#: builtin.c:2242 builtin.c:2317
+#: builtin.c:2303 builtin.c:2378
msgid "print: attempt to write to closed write end of two-way pipe"
msgstr ""
"print: tentativo di scrivere al lato in scrittura, chiuso, di una `pipe' "
"bidirezionale"
-#: builtin.c:2340
+#: builtin.c:2401
#, c-format
msgid "reference to uninitialized field `$%d'"
msgstr "riferimento a variabile non inizializzata `$%d'"
-#: builtin.c:2489 builtin.c:3457 builtin.c:3496 builtin.c:4056
+#: builtin.c:2556 builtin.c:3551 builtin.c:3592 builtin.c:4164
#, c-format
msgid "%s: received non-numeric first argument"
msgstr "%s: ricevuto primo argomento non numerico"
-#: builtin.c:2671
+#: builtin.c:2749
msgid "match: third argument is not an array"
-msgstr "match: il terzo argomento non è un vettore"
+msgstr "match: il terzo argomento non è un vettore"
-#: builtin.c:2673
+#: builtin.c:2751
#, c-format
msgid "%s: cannot use %s as third argument"
-msgstr "%s: non si può usare %s come terzo argomento"
+msgstr "%s: non si può usare %s come terzo argomento"
-#: builtin.c:2916
+#: builtin.c:2996
#, c-format
msgid "gensub: third argument `%.*s' treated as 1"
msgstr "gensub: il terzo argomento `%.*s' trattato come 1"
-#: builtin.c:3267
+#: builtin.c:3353
#, c-format
msgid "%s: can be called indirectly only with two arguments"
-msgstr "%s: può essere chiamata indirettamente solo con due argomenti"
+msgstr "%s: può essere chiamata indirettamente solo con due argomenti"
-#: builtin.c:3390
-#, c-format
-msgid "indirect call to %s requires at least two arguments"
-msgstr "chiamata indiretta a %s richiede almeno due argomenti"
+#: builtin.c:3376
+msgid "indirect call to gensub requires three to four arguments"
+msgstr "la chiamata indiretta a gensub richiede tre o quattro argomenti"
-#: builtin.c:3465
+#: builtin.c:3438
+msgid "indirect call to match requires two or three arguments"
+msgstr "la chiamata indiretta a match richiede due o tre argomenti"
+
+#: builtin.c:3482
+msgid "indirect call to %s requires two to four arguments"
+msgstr "la chiamata indiretta a %s richiede da due a quattro argomenti"
+
+#: builtin.c:3559
#, c-format
msgid "lshift(%f, %f): negative values are not allowed"
msgstr "lshift(%f, %f): valori negativi non sono consentiti"
-#: builtin.c:3469
+#: builtin.c:3563
#, c-format
msgid "lshift(%f, %f): fractional values will be truncated"
msgstr "lshift(%f, %f): valori decimali saranno troncati"
-#: builtin.c:3471
+#: builtin.c:3565
#, c-format
msgid "lshift(%f, %f): too large shift value will give strange results"
msgstr "lshift(%f, %f): valori troppo alti daranno risultati strani"
-#: builtin.c:3504
+#: builtin.c:3600
#, c-format
msgid "rshift(%f, %f): negative values are not allowed"
msgstr "rshift(%f, %f): valori negativi non sono consentiti"
-#: builtin.c:3508
+#: builtin.c:3604
#, c-format
msgid "rshift(%f, %f): fractional values will be truncated"
msgstr "rshift(%f, %f): valori decimali saranno troncati"
-#: builtin.c:3510
+#: builtin.c:3606
#, c-format
msgid "rshift(%f, %f): too large shift value will give strange results"
msgstr "rshift(%f, %f): valori troppo alti daranno risultati strani"
-#: builtin.c:3534 builtin.c:3565 builtin.c:3595
+#: builtin.c:3630 builtin.c:3661 builtin.c:3691
#, c-format
msgid "%s: called with less than two arguments"
msgstr "%s: chiamata con meno di due argomenti"
-#: builtin.c:3539 builtin.c:3570 builtin.c:3601
+#: builtin.c:3635 builtin.c:3666 builtin.c:3697
#, c-format
msgid "%s: argument %d is non-numeric"
msgstr "%s: argomento %d non numerico"
-#: builtin.c:3543 builtin.c:3574 builtin.c:3605
+#: builtin.c:3639 builtin.c:3670 builtin.c:3701
#, c-format
msgid "%s: argument %d negative value %g is not allowed"
msgstr "%s: argomento %d con valore negativo %g non consentito"
-#: builtin.c:3632
+#: builtin.c:3730
#, c-format
msgid "compl(%f): negative value is not allowed"
msgstr "compl(%f): valore negativo non consentito"
-#: builtin.c:3635
+#: builtin.c:3733
#, c-format
msgid "compl(%f): fractional value will be truncated"
msgstr "compl(%f): valori decimali saranno troncati"
-#: builtin.c:3821
+#: builtin.c:3921
#, c-format
msgid "dcgettext: `%s' is not a valid locale category"
-msgstr "dcgettext: `%s' non è una categoria `locale' valida"
+msgstr "dcgettext: `%s' non è una categoria `locale' valida"
-#: builtin.c:4048 mpfr.c:1261
+#: builtin.c:4156 mpfr.c:1328
msgid "intdiv: third argument is not an array"
-msgstr "intdiv: il terzo argomento non è un vettore"
+msgstr "intdiv: il terzo argomento non è un vettore"
-#: builtin.c:4067 mpfr.c:1310
+#: builtin.c:4175 mpfr.c:1377
msgid "intdiv: division by zero attempted"
msgstr "intdiv: tentativo di dividere per zero"
-#: builtin.c:4106
+#: builtin.c:4216
msgid "typeof: second argument is not an array"
-msgstr "typeof: il secondo argomento non è un vettore"
+msgstr "typeof: il secondo argomento non è un vettore"
-#: builtin.c:4178
+#: builtin.c:4291
#, c-format
msgid ""
"typeof detected invalid flags combination `%s'; please file a bug report"
@@ -1012,12 +1023,12 @@ msgstr ""
"typeof ha trovato una combinazione di flag `%s' non valida; siete pregati di "
"notificare questo bug"
-#: builtin.c:4198
+#: builtin.c:4332
#, c-format
msgid "typeof: invalid argument type `%s'"
msgstr "typeof: tipo di argomento sconosciuto `%s'"
-#: builtin.c:4202
+#: builtin.c:4336
#, c-format
msgid "typeof: unknown argument type `%s'"
msgstr "typeof: tipo di argomento sconosciuto `%s'"
@@ -1026,7 +1037,7 @@ msgstr "typeof: tipo di argomento sconosciuto `%s'"
#, c-format
msgid "cannot add a new file (%.*s) to ARGV in sandbox mode"
msgstr ""
-"non è consentito aggiungere un nuovo file (%.*s) ad ARGV in modo sandbox"
+"non è consentito aggiungere un nuovo file (%.*s) ad ARGV in modo sandbox"
#: command.y:228
#, c-format
@@ -1046,7 +1057,7 @@ msgstr "info: opzione non valida - `%s'"
#: command.y:324
#, c-format
msgid "source: `%s': already sourced"
-msgstr "sorgente: `%s': già immesso"
+msgstr "sorgente: `%s': già immesso"
#: command.y:329
#, c-format
@@ -1056,11 +1067,11 @@ msgstr "save: `%s': comando non consentito"
#: command.y:342
msgid "cannot use command `commands' for breakpoint/watchpoint commands"
msgstr ""
-"non si può usare il comando `commands' con comandi di breakpoint/watchpoint"
+"non si può usare il comando `commands' con comandi di breakpoint/watchpoint"
#: command.y:344
msgid "no breakpoint/watchpoint has been set yet"
-msgstr "non è stato ancora impostato alcun breakpoint/watchpoint"
+msgstr "non è stato ancora impostato alcun breakpoint/watchpoint"
#: command.y:346
msgid "invalid breakpoint/watchpoint number"
@@ -1095,7 +1106,7 @@ msgstr "condition: numero di breakpoint/watchpoint non valido"
#: command.y:452
msgid "argument not a string"
-msgstr "l'argomento non è una stringa"
+msgstr "l'argomento non è una stringa"
#: command.y:462 command.y:467
#, c-format
@@ -1133,8 +1144,8 @@ msgstr "valore intero diverso da zero"
msgid ""
"backtrace [N] - print trace of all or N innermost (outermost if N < 0) frames"
msgstr ""
-"backtrace [N] - stampa trace di tutti gli elementi o degli N più interni "
-"(degli N più esterni se N <0)"
+"backtrace [N] - stampa trace di tutti gli elementi o degli N più interni "
+"(degli N più esterni se N <0)"
#: command.y:822
msgid ""
@@ -1242,7 +1253,7 @@ msgstr ""
msgid ""
"nexti [COUNT] - step one instruction, but proceed through subroutine calls"
msgstr ""
-"nexti [COUNT] - esegui la prossima istruzione, anche se è una chiamate a "
+"nexti [COUNT] - esegui la prossima istruzione, anche se è una chiamate a "
"subroutine"
#: command.y:866
@@ -1290,7 +1301,7 @@ msgstr "source nome-file - esegui comandi contenuti nel file"
#: command.y:888
msgid "step [COUNT] - step program until it reaches a different source line"
msgstr ""
-"step [CONTATORE] - esegui il programma finché non arriva a un'istruzione con "
+"step [CONTATORE] - esegui il programma finché non arriva a un'istruzione con "
"numero di riga differente"
#: command.y:890
@@ -1315,7 +1326,7 @@ msgid ""
"until [[filename:]N|function] - execute until program reaches a different "
"line or line N within current frame"
msgstr ""
-"until [[nome-file:]N|funzione] - esegui finché il programma arriva una riga "
+"until [[nome-file:]N|funzione] - esegui finché il programma arriva una riga "
"differente, o alla riga N nell'elemento di stack corrente"
#: command.y:900
@@ -1336,9 +1347,9 @@ msgid ""
"if N < 0) frames"
msgstr ""
"where [N] - (equivale a backtrace) stampa traccia di tutti gli elementi o "
-"degli N più interni (degli N più esterni se N <0)"
+"degli N più interni (degli N più esterni se N <0)"
-#: command.y:1017 debug.c:423 gawkapi.c:251 msg.c:142
+#: command.y:1017 debug.c:423 gawkapi.c:255 msg.c:142
#, c-format
msgid "error: "
msgstr "errore: "
@@ -1413,7 +1424,7 @@ msgstr "programma non in esecuzione"
#: debug.c:475
#, c-format
msgid "source file `%s' is empty.\n"
-msgstr "il file sorgente `%s' è vuoto.\n"
+msgstr "il file sorgente `%s' è vuoto.\n"
#: debug.c:502
msgid "no current source file"
@@ -1556,7 +1567,7 @@ msgstr "nessun simbolo `%s' nel contesto corrente\n"
#: debug.c:1063 debug.c:1451
#, c-format
msgid "`%s' is not an array\n"
-msgstr "`%s' non è un vettore\n"
+msgstr "`%s' non è un vettore\n"
#: debug.c:1077
#, c-format
@@ -1576,12 +1587,12 @@ msgstr "indice \"%.*s\" non presente nel vettore `%s'\n"
#: debug.c:1197
#, c-format
msgid "`%s[\"%.*s\"]' is not an array\n"
-msgstr "`%s[\"%.*s\"]' non è un vettore\n"
+msgstr "`%s[\"%.*s\"]' non è un vettore\n"
#: debug.c:1258 debug.c:5115
#, c-format
msgid "`%s' is not a scalar variable"
-msgstr "`%s' non è una variabile scalare"
+msgstr "`%s' non è una variabile scalare"
#: debug.c:1281 debug.c:5145
#, c-format
@@ -1596,7 +1607,7 @@ msgstr "tentativo di usare scalare `%s[\"%.*s\"]' come vettore"
#: debug.c:1447
#, c-format
msgid "`%s' is a function"
-msgstr "`%s' è una funzione"
+msgstr "`%s' è una funzione"
#: debug.c:1489
#, c-format
@@ -1625,13 +1636,13 @@ msgstr "tentativo di usare valore scalare come vettore"
#: debug.c:1882
#, c-format
msgid "Watchpoint %d deleted because parameter is out of scope.\n"
-msgstr "Watchpoint %d cancellato perché il parametro è fuori intervallo.\n"
+msgstr "Watchpoint %d cancellato perché il parametro è fuori intervallo.\n"
#: debug.c:1893
#, c-format
msgid "Display %d deleted because parameter is out of scope.\n"
msgstr ""
-"Visualizzazione %d cancellata perché il parametro è fuori intervallo.\n"
+"Visualizzazione %d cancellata perché il parametro è fuori intervallo.\n"
#: debug.c:1926
#, c-format
@@ -1694,7 +1705,7 @@ msgstr "non riesco a impostare breakpoint nel file `%s'\n"
#: debug.c:2395
#, c-format
msgid "line number %d in file `%s' is out of range"
-msgstr "il numero riga %d nel file `%s' è fuori intervallo"
+msgstr "il numero riga %d nel file `%s' è fuori intervallo"
#: debug.c:2399
#, c-format
@@ -1714,7 +1725,7 @@ msgstr "non riesco a impostare breakpoint nella funzione `%s'\n"
#: debug.c:2431
#, c-format
msgid "breakpoint %d set at file `%s', line %d is unconditional\n"
-msgstr "breakpoint %d impostato al file `%s', riga %d è senza condizioni\n"
+msgstr "breakpoint %d impostato al file `%s', riga %d è senza condizioni\n"
#: debug.c:2520 debug.c:3378
#, c-format
@@ -1756,7 +1767,7 @@ msgstr "Prossimi %ld passaggi dal breakpoint %d ignorati.\n"
#: debug.c:2694
#, c-format
msgid "Will stop next time breakpoint %d is reached.\n"
-msgstr "Farò uno stop al prossimo passaggio dal breakpoint %d.\n"
+msgstr "Farò uno stop al prossimo passaggio dal breakpoint %d.\n"
#: debug.c:2811
#, c-format
@@ -1770,7 +1781,7 @@ msgstr "Non sono riuscito a far ripartire il debugger"
#: debug.c:2950
msgid "Program already running. Restart from beginning (y/n)? "
-msgstr "Programma già in esecuzione. Lo faccio ripartire dall'inizio (y/n)? "
+msgstr "Programma già in esecuzione. Lo faccio ripartire dall'inizio (y/n)? "
#: debug.c:2954
#, c-format
@@ -1804,7 +1815,7 @@ msgstr "Programma completato normalmente, valore in uscita: %d\n"
#: debug.c:3003
msgid "The program is running. Exit anyway (y/n)? "
-msgstr "Il programma è in esecuzione. Esco comunque (y/n)? "
+msgstr "Il programma è in esecuzione. Esco comunque (y/n)? "
#: debug.c:3038
#, c-format
@@ -1909,26 +1920,26 @@ msgstr "`return' non consentito nel contesto corrente; istruzione ignorata"
msgid "no symbol `%s' in current context"
msgstr "nessun simbolo `%s' nel contesto corrente"
-#: eval.c:403
+#: eval.c:401
#, c-format
msgid "unknown nodetype %d"
msgstr "tipo nodo sconosciuto %d"
-#: eval.c:414 eval.c:430
+#: eval.c:412 eval.c:428
#, c-format
msgid "unknown opcode %d"
msgstr "codice operativo sconosciuto %d"
-#: eval.c:427
+#: eval.c:425
#, c-format
msgid "opcode %s not an operator or keyword"
-msgstr "codice operativo %s non è un operatore o una parola chiave"
+msgstr "codice operativo %s non è un operatore o una parola chiave"
-#: eval.c:485
+#: eval.c:484
msgid "buffer overflow in genflags2str"
msgstr "superamento limiti buffer in 'genflags2str'"
-#: eval.c:689
+#: eval.c:688
#, c-format
msgid ""
"\n"
@@ -1939,71 +1950,71 @@ msgstr ""
"\t# `Stack' (Pila) Chiamate Funzione:\n"
"\n"
-#: eval.c:715
+#: eval.c:714
msgid "`IGNORECASE' is a gawk extension"
-msgstr "`IGNORECASE' è un'estensione gawk"
+msgstr "`IGNORECASE' è un'estensione gawk"
-#: eval.c:736
+#: eval.c:735
msgid "`BINMODE' is a gawk extension"
-msgstr "`BINMODE' è un'estensione gawk"
+msgstr "`BINMODE' è un'estensione gawk"
-#: eval.c:793
+#: eval.c:792
#, c-format
msgid "BINMODE value `%s' is invalid, treated as 3"
msgstr "valore di BINMODE `%s' non valido, considerato come 3"
-#: eval.c:916
+#: eval.c:915
#, c-format
msgid "bad `%sFMT' specification `%s'"
msgstr "specificazione invalida `%sFMT' `%s'"
-#: eval.c:986
+#: eval.c:985
msgid "turning off `--lint' due to assignment to `LINT'"
msgstr "disabilito `--lint' a causa di assegnamento a `LINT'"
-#: eval.c:1180
+#: eval.c:1179
#, c-format
msgid "reference to uninitialized argument `%s'"
msgstr "riferimento ad argomento non inizializzato `%s'"
-#: eval.c:1181
+#: eval.c:1180
#, c-format
msgid "reference to uninitialized variable `%s'"
msgstr "riferimento a variabile non inizializzata `%s'"
-#: eval.c:1199
+#: eval.c:1198
msgid "attempt to field reference from non-numeric value"
msgstr "tentativo di riferimento a un campo da valore non-numerico"
-#: eval.c:1201
+#: eval.c:1200
msgid "attempt to field reference from null string"
msgstr "tentativo di riferimento a un campo da una stringa nulla"
-#: eval.c:1209
+#: eval.c:1208
#, c-format
msgid "attempt to access field %ld"
msgstr "tentativo di accedere al campo %ld"
-#: eval.c:1218
+#: eval.c:1217
#, c-format
msgid "reference to uninitialized field `$%ld'"
msgstr "riferimento a campo non inizializzato `$%ld'"
-#: eval.c:1282
+#: eval.c:1281
#, c-format
msgid "function `%s' called with more arguments than declared"
-msgstr "funzione `%s' chiamata con più argomenti di quelli previsti"
+msgstr "funzione `%s' chiamata con più argomenti di quelli previsti"
-#: eval.c:1486
+#: eval.c:1485
#, c-format
msgid "unwind_stack: unexpected type `%s'"
msgstr "unwind_stack: tipo non previsto `%s'"
-#: eval.c:1579
+#: eval.c:1656
msgid "division by zero attempted in `/='"
msgstr "divisione per zero tentata in `/='"
-#: eval.c:1586
+#: eval.c:1663
#, c-format
msgid "division by zero attempted in `%%='"
msgstr "divisione per zero tentata in `%%='"
@@ -2066,29 +2077,29 @@ msgstr "make_builtin: non riesco a ridefinire funzione `%s'"
#: ext.c:130
#, c-format
msgid "make_builtin: function `%s' already defined"
-msgstr "make_builtin: funzione `%s' già definita"
+msgstr "make_builtin: funzione `%s' già definita"
-#: ext.c:134
+#: ext.c:135
#, c-format
msgid "make_builtin: function name `%s' previously defined"
msgstr "make_builtin: funzione di nome `%s' definita in precedenza"
-#: ext.c:138
+#: ext.c:139
#, c-format
msgid "make_builtin: negative argument count for function `%s'"
msgstr "make_builtin: contatore argomenti negativo per la funzione `%s'"
-#: ext.c:214
+#: ext.c:215
#, c-format
msgid "function `%s': argument #%d: attempt to use scalar as an array"
msgstr "funzione `%s': argomento #%d: tentativo di usare scalare come vettore"
-#: ext.c:218
+#: ext.c:219
#, c-format
msgid "function `%s': argument #%d: attempt to use array as a scalar"
msgstr "funzione `%s': argomento #%d: tentativo di usare vettore come scalare"
-#: ext.c:232
+#: ext.c:233
msgid "dynamic loading of libraries is not supported"
msgstr "caricamento dinamico di librerie non supportato"
@@ -2099,11 +2110,11 @@ msgstr "stat: non riesco a leggere il link simbolico `%s'"
#: extension/filefuncs.c:479
msgid "stat: first argument is not a string"
-msgstr "stat: il primo argomento non è una stringa"
+msgstr "stat: il primo argomento non è una stringa"
#: extension/filefuncs.c:484
msgid "stat: second argument is not an array"
-msgstr "stat: il secondo argomento non è un vettore"
+msgstr "stat: il secondo argomento non è un vettore"
#: extension/filefuncs.c:528
msgid "stat: bad parameters"
@@ -2149,15 +2160,15 @@ msgstr "fts: chiamata con numero di argomenti errato, 3 previsti"
#: extension/filefuncs.c:853
msgid "fts: first argument is not an array"
-msgstr "fts: il primo argomento non è un vettore"
+msgstr "fts: il primo argomento non è un vettore"
#: extension/filefuncs.c:859
msgid "fts: second argument is not a number"
-msgstr "fts: il secondo argomento non è un vettore"
+msgstr "fts: il secondo argomento non è un vettore"
#: extension/filefuncs.c:865
msgid "fts: third argument is not an array"
-msgstr "ftp: il terzo argomento non è un vettore"
+msgstr "ftp: il terzo argomento non è un vettore"
#: extension/filefuncs.c:872
msgid "fts: could not flatten array\n"
@@ -2198,11 +2209,11 @@ msgstr "fnmatch init: non riesco a installare vettore FNM"
#: extension/fork.c:92
msgid "fork: PROCINFO is not an array!"
-msgstr "fork: PROCINFO non è un vettore!"
+msgstr "fork: PROCINFO non è un vettore!"
#: extension/inplace.c:131
msgid "inplace::begin: in-place editing already active"
-msgstr "inplace::begin: modifica in-place già attiva"
+msgstr "inplace::begin: modifica in-place già attiva"
#: extension/inplace.c:134
#, c-format
@@ -2212,7 +2223,7 @@ msgstr "inplace::begin: 2 argumenti richiesti, ma chiamata con %d"
#: extension/inplace.c:137
msgid "inplace::begin: cannot retrieve 1st argument as a string filename"
msgstr ""
-"inplace::begin: non riesco a trovare il 1° argomento come stringa nome-file"
+"inplace::begin: non riesco a trovare il 1° argomento come stringa nome-file"
#: extension/inplace.c:145
#, c-format
@@ -2228,7 +2239,7 @@ msgstr "inplace::begin: Non riesco a trovare `%s' (%s)"
#: extension/inplace.c:159
#, c-format
msgid "inplace::begin: `%s' is not a regular file"
-msgstr "inplace::begin: `%s' non è un file regolare"
+msgstr "inplace::begin: `%s' non è un file regolare"
#: extension/inplace.c:170
#, c-format
@@ -2263,7 +2274,7 @@ msgstr "inplace::end: 2 argumenti richiesti, ma chiamata con %d"
#: extension/inplace.c:214
msgid "inplace::end: cannot retrieve 1st argument as a string filename"
msgstr ""
-"inplace::end: non riesco a trovare il 1° argomento come stringa nome-file"
+"inplace::end: non riesco a trovare il 1° argomento come stringa nome-file"
#: extension/inplace.c:221
msgid "inplace::end: in-place editing not active"
@@ -2296,18 +2307,18 @@ msgstr "inplace::end: rename(`%s', `%s') non riuscito (%s)"
#: extension/ordchr.c:72
msgid "ord: first argument is not a string"
-msgstr "ord: il primo argomento non è una stringa"
+msgstr "ord: il primo argomento non è una stringa"
#: extension/ordchr.c:99
msgid "chr: first argument is not a number"
-msgstr "chr: il primo argomento non è un vettore"
+msgstr "chr: il primo argomento non è un vettore"
#: extension/readdir.c:277
#, c-format
msgid "dir_take_control_of: opendir/fdopendir failed: %s"
msgstr "dir_take_control_of: opendir/fdopendir non riuscita: %s"
-#: extension/readfile.c:131
+#: extension/readfile.c:133
msgid "readfile: called with wrong kind of argument"
msgstr "readfile: chiamata con un tipo di argomento errato"
@@ -2315,64 +2326,77 @@ msgstr "readfile: chiamata con un tipo di argomento errato"
msgid "revoutput: could not initialize REVOUT variable"
msgstr "revoutput: non riesco a inizializzare la variabile REVOUT"
-#: extension/rwarray.c:119
-msgid "do_writea: first argument is not a string"
-msgstr "do_writea: il primo argomento non è una stringa"
+#: extension/rwarray.c:141 extension/rwarray.c:544
+msgid "%s: first argument is not a string"
+msgstr "%s: il primo argomento non è una stringa"
+
+#: extension/rwarray.c:185
+msgid "writea: second argument is not an array"
+msgstr "writea: il secondo argomento non è un vettore"
-#: extension/rwarray.c:125
-msgid "do_writea: second argument is not an array"
-msgstr "do_writea: il secondo argomento non è un vettore"
+#: extension/rwarray.c:202
+msgid "writeall: unable to find SYMTAB array"
+msgstr "writeall: non riesco a trovare vettore SYMTAB"
-#: extension/rwarray.c:172 extension/rwarray0.c:167
+#: extension/rwarray.c:222
msgid "write_array: could not flatten array"
msgstr "write_array: non sono riuscito ad appiattire un vettore"
-#: extension/rwarray.c:188 extension/rwarray0.c:181
+#: extension/rwarray.c:238
msgid "write_array: could not release flattened array"
msgstr "write_array: non sono riuscito a rilasciare un vettore appiattito"
-#: extension/rwarray.c:255
+#: extension/rwarray.c:303
#, c-format
msgid "array value has unknown type %d"
msgstr "valore di vettore di tipo sconosciuto %d"
-#: extension/rwarray.c:292
-msgid "do_reada: first argument is not a string"
-msgstr "do_reada: il primo argomento non è una stringa"
+#: extension/rwarray.c:394
+msgid ""
+"rwarray extension: received GMP/MPFR value but compiled without GMP/MPFR "
+"support."
+msgstr ""
+"estensione rwarray: ricevuto valore GMP/MPFR ma il supporto GMP/MPFR non "
+"è disponibile."
+
+#: extension/rwarray.c:431
+msgid "cannot free number with unknown type %d"
+msgstr "non posso liberare un numero di tipo sconosciuto %d"
-#: extension/rwarray.c:298
-msgid "do_reada: second argument is not an array"
-msgstr "do_reada: il secondo argomento non è un vettore"
+#: extension/rwarray.c:436
+msgid "cannot free value with unhandled type %d"
+msgstr "non posso liberare un valore di tipo non gestito %d"
-#: extension/rwarray.c:342 extension/rwarray0.c:317
-msgid "do_reada: clear_array failed"
-msgstr "do_reada: clear_array non riuscita"
+#: extension/rwarray.c:458
+#, c-format
+msgid "readall: unable to set %s"
+msgstr "readall: non riesco a impostare %s"
-#: extension/rwarray.c:379 extension/rwarray0.c:353
+#: extension/rwarray.c:521
+msgid "reada: clear_array failed"
+msgstr "reada: clear_array non riuscita"
+
+#: extension/rwarray.c:607
+msgid "reada: second argument is not an array"
+msgstr "reada: il secondo argomento non è un vettore"
+
+#: extension/rwarray.c:644
msgid "read_array: set_array_element failed"
msgstr "read_array: set_array_element non riuscita"
-#: extension/rwarray.c:489
+#: extension/rwarray.c:752
#, c-format
msgid "treating recovered value with unknown type code %d as a string"
msgstr ""
"valore recuperato, con codice di tipo sconosciuto %d, trattato come stringa"
-#: extension/rwarray0.c:114
-msgid "do_writea: argument 0 is not a string"
-msgstr "do_writea: l'argomento 0 non è una stringa"
-
-#: extension/rwarray0.c:120
-msgid "do_writea: argument 1 is not an array"
-msgstr "do_writea: l'argomento 1 non è un vettore"
-
-#: extension/rwarray0.c:267
-msgid "do_reada: argument 0 is not a string"
-msgstr "do_reada: argomento 0 non è una stringa"
-
-#: extension/rwarray0.c:273
-msgid "do_reada: argument 1 is not an array"
-msgstr "do_reada: l'argomento 1 non è un vettore"
+#: extension/rwarray.c:823
+msgid ""
+"rwarray extension: GMP/MPFR value in file but compiled without GMP/MPFR "
+"support."
+msgstr ""
+"estensione rwarray: trovato valore GMP/MPFR nel file ma il supporto "
+"GMP/MPFR non è disponibile."
#: extension/time.c:141
msgid "gettimeofday: not supported on this platform"
@@ -2384,7 +2408,7 @@ msgstr "sleep: manca necessario argomento numerico"
#: extension/time.c:168
msgid "sleep: argument is negative"
-msgstr "sleep: l'argomento è negativo"
+msgstr "sleep: l'argomento è negativo"
#: extension/time.c:202
msgid "sleep: not supported on this platform"
@@ -2400,126 +2424,126 @@ msgstr "NF impostato a un valore negativo"
#: field.c:413
msgid "decrementing NF is not portable to many awk versions"
-msgstr "diminuire NF è non-portabile a molte versioni awk"
+msgstr "diminuire NF è non-portabile a molte versioni awk"
#: field.c:861
msgid "accessing fields from an END rule may not be portable"
-msgstr "utilizzare campi da una regola END può essere non-portabile"
+msgstr "utilizzare campi da una regola END può essere non-portabile"
-#: field.c:986 field.c:995
+#: field.c:988 field.c:997
msgid "split: fourth argument is a gawk extension"
-msgstr "split: il quarto argomento è un'estensione gawk"
+msgstr "split: il quarto argomento è un'estensione gawk"
-#: field.c:990
+#: field.c:992
msgid "split: fourth argument is not an array"
-msgstr "split: il quarto argomento non è un vettore"
+msgstr "split: il quarto argomento non è un vettore"
-#: field.c:992 field.c:1089
+#: field.c:994 field.c:1093
#, c-format
msgid "%s: cannot use %s as fourth argument"
msgstr "%s: non consentito usare %s come quarto argomento"
-#: field.c:1002
+#: field.c:1004
msgid "split: second argument is not an array"
-msgstr "split: il secondo argomento non è un vettore"
+msgstr "split: il secondo argomento non è un vettore"
-#: field.c:1008
+#: field.c:1010
msgid "split: cannot use the same array for second and fourth args"
msgstr ""
-"split: non si può usare un unico vettore come secondo e quarto argomento"
+"split: non si può usare un unico vettore come secondo e quarto argomento"
-#: field.c:1013
+#: field.c:1015
msgid "split: cannot use a subarray of second arg for fourth arg"
msgstr ""
"split: non consentito un quarto argomento che sia un sottovettore del "
"secondo argomento"
-#: field.c:1016
+#: field.c:1018
msgid "split: cannot use a subarray of fourth arg for second arg"
msgstr ""
"split: non consentito un secondo argomento che sia un sottovettore del "
"quarto argomento"
-#: field.c:1050
+#: field.c:1052
msgid "split: null string for third arg is a non-standard extension"
-msgstr "split: la stringa nulla come terzo arg. è un'estensione non-standard"
+msgstr "split: la stringa nulla come terzo arg. è un'estensione non-standard"
-#: field.c:1087
+#: field.c:1091
msgid "patsplit: fourth argument is not an array"
-msgstr "patsplit: il quarto argomento non è un vettore"
+msgstr "patsplit: il quarto argomento non è un vettore"
-#: field.c:1094
+#: field.c:1098
msgid "patsplit: second argument is not an array"
-msgstr "patsplit: il secondo argomento non è un vettore"
+msgstr "patsplit: il secondo argomento non è un vettore"
-#: field.c:1105
+#: field.c:1109
msgid "patsplit: third argument must be non-null"
-msgstr "patsplit: il terzo argomento non può essere nullo"
+msgstr "patsplit: il terzo argomento non può essere nullo"
-#: field.c:1109
+#: field.c:1113
msgid "patsplit: cannot use the same array for second and fourth args"
msgstr ""
-"patsplit: non si può usare un unico vettore come secondo e quarto argomento"
+"patsplit: non si può usare un unico vettore come secondo e quarto argomento"
-#: field.c:1114
+#: field.c:1118
msgid "patsplit: cannot use a subarray of second arg for fourth arg"
msgstr ""
"patsplit: non consentito un quarto argomento che sia un sottovettore del "
"secondo argomento"
-#: field.c:1117
+#: field.c:1121
msgid "patsplit: cannot use a subarray of fourth arg for second arg"
msgstr ""
"patsplit: non consentito un secondo argomento che sia un sottovettore del "
"quarto argomento"
-#: field.c:1167
+#: field.c:1171
msgid "`FIELDWIDTHS' is a gawk extension"
-msgstr "`FIELDWIDTHS' è un'estensione gawk"
+msgstr "`FIELDWIDTHS' è un'estensione gawk"
-#: field.c:1236
+#: field.c:1240
msgid "`*' must be the last designator in FIELDWIDTHS"
msgstr "`*' deve essere l'ultimo elemento specificato per FIELDWIDTHS"
-#: field.c:1257
+#: field.c:1261
#, c-format
msgid "invalid FIELDWIDTHS value, for field %d, near `%s'"
msgstr "valore di FIELDWIDTHS non valido, per il campo %d, vicino a `%s'"
-#: field.c:1330
+#: field.c:1334
msgid "null string for `FS' is a gawk extension"
-msgstr "la stringa nulla usata come `FS' è un'estensione gawk"
+msgstr "la stringa nulla usata come `FS' è un'estensione gawk"
-#: field.c:1334
+#: field.c:1338
msgid "old awk does not support regexps as value of `FS'"
msgstr "il vecchio awk non supporta espressioni come valori di `FS'"
-#: field.c:1460
+#: field.c:1464
msgid "`FPAT' is a gawk extension"
-msgstr "`FPAT' è un'estensione gawk"
+msgstr "`FPAT' è un'estensione gawk"
#: gawkapi.c:154
msgid "awk_value_to_node: received null retval"
msgstr "awk_value_to_node: ricevuto retval nullo"
-#: gawkapi.c:171 gawkapi.c:182
+#: gawkapi.c:174 gawkapi.c:186
msgid "awk_value_to_node: not in MPFR mode"
-msgstr "awk_value_to_node: non in modalità MPFR"
+msgstr "awk_value_to_node: non in modalità MPFR"
-#: gawkapi.c:176 gawkapi.c:186
+#: gawkapi.c:180 gawkapi.c:190
msgid "awk_value_to_node: MPFR not supported"
msgstr "awk_value_to_node: MPFR non disponibile"
-#: gawkapi.c:190
+#: gawkapi.c:194
#, c-format
msgid "awk_value_to_node: invalid number type `%d'"
msgstr "awk_value_to_node: tipo di numero non valido `%d'"
-#: gawkapi.c:377
+#: gawkapi.c:381
msgid "add_ext_func: received NULL name_space parameter"
msgstr "add_ext_func: ricevuto come nome dello spazio-dei-nomi la stringa NULL"
-#: gawkapi.c:515
+#: gawkapi.c:519
#, c-format
msgid ""
"node_to_awk_value: detected invalid numeric flags combination `%s'; please "
@@ -2528,15 +2552,15 @@ msgstr ""
"node_to_awk_value: trovata combinazione numerica di flag non valida `%s'; "
"siete pregati di notificare questo bug"
-#: gawkapi.c:543
+#: gawkapi.c:557
msgid "node_to_awk_value: received null node"
msgstr "node_to_awk_value: ricevuto nodo nullo"
-#: gawkapi.c:546
+#: gawkapi.c:560
msgid "node_to_awk_value: received null val"
msgstr "node_to_awk_value: ricevuto valore nullo"
-#: gawkapi.c:602 gawkapi.c:636 gawkapi.c:663 gawkapi.c:696
+#: gawkapi.c:627 gawkapi.c:664 gawkapi.c:694 gawkapi.c:731
#, c-format
msgid ""
"node_to_awk_value detected invalid flags combination `%s'; please file a bug "
@@ -2545,35 +2569,35 @@ msgstr ""
"node_to_awk_value ha trovato la combinazione flag invalida `%s'; siete "
"pregati di notificare questo bug"
-#: gawkapi.c:1074
+#: gawkapi.c:1109
msgid "remove_element: received null array"
msgstr "remove_element: ricevuto vettore nullo"
-#: gawkapi.c:1077
+#: gawkapi.c:1112
msgid "remove_element: received null subscript"
msgstr "remove_element: ricevuto indice nullo"
-#: gawkapi.c:1209
+#: gawkapi.c:1244
#, c-format
msgid "api_flatten_array_typed: could not convert index %d to %s"
msgstr ""
"api_flatten_array_typed: non sono riuscito a convertire l'indice %d a %s"
-#: gawkapi.c:1214
+#: gawkapi.c:1249
#, c-format
msgid "api_flatten_array_typed: could not convert value %d to %s"
msgstr ""
"api_flatten_array_typed: non sono riuscito a convertire il valore %d a %s"
-#: gawkapi.c:1310 gawkapi.c:1327
+#: gawkapi.c:1345 gawkapi.c:1362
msgid "api_get_mpfr: MPFR not supported"
msgstr "api_get_mpfr: MPFR non disponibile"
-#: gawkapi.c:1358
+#: gawkapi.c:1393
msgid "cannot find end of BEGINFILE rule"
msgstr "non riesco a trovare la fine di una regola BEGINFILE"
-#: gawkapi.c:1412
+#: gawkapi.c:1447
#, c-format
msgid "cannot open unrecognized file type `%s' for `%s'"
msgstr "non riesco ad aprire file di tipo non riconosciuto `%s' per `%s'"
@@ -2581,7 +2605,7 @@ msgstr "non riesco ad aprire file di tipo non riconosciuto `%s' per `%s'"
#: io.c:426
#, c-format
msgid "command line argument `%s' is a directory: skipped"
-msgstr "l'argomento in riga comando `%s' è una directory: ignorata"
+msgstr "l'argomento in riga comando `%s' è una directory: ignorata"
#: io.c:429 io.c:543
#, c-format
@@ -2655,7 +2679,7 @@ msgstr "ri-direzione non consentita in modo `sandbox'"
#: io.c:847
#, c-format
msgid "expression in `%s' redirection is a number"
-msgstr "espressione nella ri-direzione `%s' è un numero"
+msgstr "espressione nella ri-direzione `%s' è un numero"
#: io.c:851
#, c-format
@@ -2667,7 +2691,7 @@ msgstr "espressione nella ri-direzione `%s' ha per valore la stringa nulla"
msgid ""
"filename `%.*s' for `%s' redirection may be result of logical expression"
msgstr ""
-"nome-file `%.*s' per la ri-direzione `%s' può essere il risultato di una "
+"nome-file `%.*s' per la ri-direzione `%s' può essere il risultato di una "
"espressione logica"
#: io.c:953 io.c:978
@@ -2732,221 +2756,221 @@ msgstr "close: il secondo argomento deve essere `a' o `da'"
#: io.c:1278
#, c-format
msgid "close: `%.*s' is not an open file, pipe or co-process"
-msgstr "close: `%.*s' non è un file aperto, una `pipe' o un co-processo"
+msgstr "close: `%.*s' non è un file aperto, una `pipe' o un co-processo"
#: io.c:1283
msgid "close of redirection that was never opened"
msgstr "chiusura di una ri-direzione mai aperta"
-#: io.c:1382
+#: io.c:1385
#, c-format
msgid "close: redirection `%s' not opened with `|&', second argument ignored"
msgstr "close: ri-direzione `%s' non aperta con `|&', ignoro secondo argomento"
-#: io.c:1399
+#: io.c:1402
#, c-format
msgid "failure status (%d) on pipe close of `%s': %s"
msgstr "errore ritornato (%d) dalla chiusura della `pipe' `%s': %s"
-#: io.c:1402
+#: io.c:1405
#, c-format
msgid "failure status (%d) on two-way pipe close of `%s': %s"
msgstr ""
"errore ritornato (%d) dalla chiusura della `pipe' bidirezionale `%s': %s"
-#: io.c:1405
+#: io.c:1408
#, c-format
msgid "failure status (%d) on file close of `%s': %s"
msgstr "errore ritornato (%d) dalla chiusura del file `%s': %s"
-#: io.c:1425
+#: io.c:1428
#, c-format
msgid "no explicit close of socket `%s' provided"
msgstr "nessuna chiusura esplicita richiesta per `socket' `%s'"
-#: io.c:1428
+#: io.c:1431
#, c-format
msgid "no explicit close of co-process `%s' provided"
msgstr "nessuna chiusura esplicita richiesta per co-processo `%s'"
-#: io.c:1431
+#: io.c:1434
#, c-format
msgid "no explicit close of pipe `%s' provided"
msgstr "nessuna chiusura esplicita richiesta per `pipe' `%s'"
-#: io.c:1434
+#: io.c:1437
#, c-format
msgid "no explicit close of file `%s' provided"
msgstr "nessuna chiusura esplicita richiesta per file `%s'"
-#: io.c:1471
+#: io.c:1472
#, c-format
msgid "fflush: cannot flush standard output: %s"
msgstr "fflush: non riesco a terminare lo standard output: %s"
-#: io.c:1472
+#: io.c:1473
#, c-format
msgid "fflush: cannot flush standard error: %s"
msgstr "fflush: non riesco a terminare lo standard error: %s"
-#: io.c:1477 io.c:1568 main.c:666 main.c:713
+#: io.c:1478 io.c:1567 main.c:669 main.c:714
#, c-format
msgid "error writing standard output: %s"
msgstr "errore scrivendo `standard output': %s"
-#: io.c:1478 io.c:1581 main.c:668
+#: io.c:1479 io.c:1578 main.c:671
#, c-format
msgid "error writing standard error: %s"
msgstr "errore scrivendo `standard error': %s"
-#: io.c:1517
+#: io.c:1518
#, c-format
msgid "pipe flush of `%s' failed: %s"
msgstr "scaricamento di `pipe' `%s' non riuscito: %s"
-#: io.c:1520
+#: io.c:1521
#, c-format
msgid "co-process flush of pipe to `%s' failed: %s"
msgstr "scaricamento da co-processo di `pipe' a `%s' non riuscito: %s"
-#: io.c:1523
+#: io.c:1524
#, c-format
msgid "file flush of `%s' failed: %s"
msgstr "scaricamento di file `%s' non riuscito: %s"
-#: io.c:1670
+#: io.c:1667
#, c-format
msgid "local port %s invalid in `/inet': %s"
msgstr "porta locale %s invalida in `/inet: %s'"
-#: io.c:1673
+#: io.c:1670
#, c-format
msgid "local port %s invalid in `/inet'"
msgstr "porta locale %s invalida in `/inet'"
-#: io.c:1696
+#: io.c:1693
#, c-format
msgid "remote host and port information (%s, %s) invalid: %s"
msgstr "host remoto e informazione di porta (%s, %s) invalidi: %s"
-#: io.c:1699
+#: io.c:1696
#, c-format
msgid "remote host and port information (%s, %s) invalid"
msgstr "host remoto e informazione di porta (%s, %s) invalidi"
-#: io.c:1941
+#: io.c:1938
msgid "TCP/IP communications are not supported"
msgstr "comunicazioni TCP/IP non supportate"
-#: io.c:2069 io.c:2112
+#: io.c:2066 io.c:2109
#, c-format
msgid "could not open `%s', mode `%s'"
msgstr "non riesco ad aprire `%s', modo `%s'"
-#: io.c:2077 io.c:2129
+#: io.c:2074 io.c:2126
#, c-format
msgid "close of master pty failed: %s"
msgstr "close di `pty' principale non riuscita: %s"
-#: io.c:2079 io.c:2131 io.c:2478 io.c:2722
+#: io.c:2076 io.c:2128 io.c:2475 io.c:2719
#, c-format
msgid "close of stdout in child failed: %s"
msgstr "close di `stdout' nel processo-figlio non riuscita: %s"
-#: io.c:2082 io.c:2134
+#: io.c:2079 io.c:2131
#, c-format
msgid "moving slave pty to stdout in child failed (dup: %s)"
msgstr ""
"trasferimento di `pty' secondaria a `stdout' nel processo-figlio non "
"riuscita (dup: %s)"
-#: io.c:2084 io.c:2136 io.c:2483
+#: io.c:2081 io.c:2133 io.c:2480
#, c-format
msgid "close of stdin in child failed: %s"
msgstr "close di `stdin' nel processo-figlio non riuscita: %s"
-#: io.c:2087 io.c:2139
+#: io.c:2084 io.c:2136
#, c-format
msgid "moving slave pty to stdin in child failed (dup: %s)"
msgstr ""
"trasferimento di `pty' secondaria a `stdin' nel processo-figlio non riuscito "
"(dup: %s)"
-#: io.c:2089 io.c:2141 io.c:2163
+#: io.c:2086 io.c:2138 io.c:2160
#, c-format
msgid "close of slave pty failed: %s"
msgstr "close di `pty' secondaria non riuscita: %s"
-#: io.c:2325
+#: io.c:2322
msgid "could not create child process or open pty"
msgstr "non riesco a creare processo-figlio o ad aprire `pty'"
-#: io.c:2413 io.c:2481 io.c:2693 io.c:2725
+#: io.c:2410 io.c:2478 io.c:2690 io.c:2722
#, c-format
msgid "moving pipe to stdout in child failed (dup: %s)"
msgstr ""
"passaggio di `pipe' a `stdout' nel processo-figlio non riuscito (dup: %s)"
-#: io.c:2420 io.c:2486
+#: io.c:2417 io.c:2483
#, c-format
msgid "moving pipe to stdin in child failed (dup: %s)"
msgstr ""
"passaggio di `pipe' a `stdin' nel processo-figlio non riuscito (dup: %s)"
-#: io.c:2446 io.c:2715
+#: io.c:2443 io.c:2712
msgid "restoring stdout in parent process failed"
msgstr "ripristino di `stdout' nel processo-padre non riuscito"
-#: io.c:2454
+#: io.c:2451
msgid "restoring stdin in parent process failed"
msgstr "ripristino di `stdin' nel processo-padre non riuscito"
-#: io.c:2489 io.c:2727 io.c:2742
+#: io.c:2486 io.c:2724 io.c:2739
#, c-format
msgid "close of pipe failed: %s"
msgstr "close di `pipe' non riuscita: %s"
-#: io.c:2548
+#: io.c:2545
msgid "`|&' not supported"
msgstr "`|&' non supportato"
-#: io.c:2678
+#: io.c:2675
#, c-format
msgid "cannot open pipe `%s': %s"
msgstr "non riesco ad aprire `pipe' `%s': %s"
-#: io.c:2736
+#: io.c:2733
#, c-format
msgid "cannot create child process for `%s' (fork: %s)"
msgstr "non riesco a creare processo-figlio per `%s' (fork: %s)"
-#: io.c:2874
+#: io.c:2871
msgid "getline: attempt to read from closed read end of two-way pipe"
msgstr ""
"getline: tentativo di elggere dal lato in scrittura, chiuso, di una `pipe' "
"bidirezionale"
-#: io.c:3199
+#: io.c:3196
msgid "register_input_parser: received NULL pointer"
msgstr "register_input_parser: ricevuto puntatore NULL"
-#: io.c:3227
+#: io.c:3224
#, c-format
msgid "input parser `%s' conflicts with previously installed input parser `%s'"
msgstr ""
"input parser `%s' in conflitto con l'input parser `%s' installato in "
"precedenza"
-#: io.c:3234
+#: io.c:3231
#, c-format
msgid "input parser `%s' failed to open `%s'"
-msgstr "l'input parser `%s' non è riuscito ad aprire `%s'"
+msgstr "l'input parser `%s' non è riuscito ad aprire `%s'"
-#: io.c:3254
+#: io.c:3251
msgid "register_output_wrapper: received NULL pointer"
msgstr "register_output_wrapper: ricevuto puntatore NULL"
-#: io.c:3282
+#: io.c:3279
#, c-format
msgid ""
"output wrapper `%s' conflicts with previously installed output wrapper `%s'"
@@ -2954,16 +2978,16 @@ msgstr ""
"output wrapper `%s' in conflitto con l'output wrapper `%s' installato in "
"precedenza"
-#: io.c:3289
+#: io.c:3286
#, c-format
msgid "output wrapper `%s' failed to open `%s'"
-msgstr "l'output wrapper `%s' non è riuscito ad aprire `%s'"
+msgstr "l'output wrapper `%s' non è riuscito ad aprire `%s'"
-#: io.c:3310
+#: io.c:3307
msgid "register_output_processor: received NULL pointer"
msgstr "register_output_processor: ricevuto puntatore NULL"
-#: io.c:3339
+#: io.c:3336
#, c-format
msgid ""
"two-way processor `%s' conflicts with previously installed two-way processor "
@@ -2972,216 +2996,220 @@ msgstr ""
"processore doppio `%s' in conflitto con il processore doppio installato in "
"precedenza `%s'"
-#: io.c:3348
+#: io.c:3345
#, c-format
msgid "two way processor `%s' failed to open `%s'"
-msgstr "il processore doppio `%s' non è riuscito ad aprire `%s'"
+msgstr "il processore doppio `%s' non è riuscito ad aprire `%s'"
-#: io.c:3472
+#: io.c:3469
#, c-format
msgid "data file `%s' is empty"
msgstr "file dati `%s' vuoto"
-#: io.c:3514 io.c:3522
+#: io.c:3511 io.c:3519
msgid "could not allocate more input memory"
msgstr "non riesco ad allocare ulteriore memoria per l'input"
-#: io.c:4140
+#: io.c:4137
msgid "multicharacter value of `RS' is a gawk extension"
-msgstr "valore multicarattere per `RS' è un'estensione gawk"
+msgstr "valore multicarattere per `RS' è un'estensione gawk"
-#: io.c:4294
+#: io.c:4291
msgid "IPv6 communication is not supported"
msgstr "comunicazioni IPv6 non supportate"
-#: main.c:338
+#: main.c:339
msgid "environment variable `POSIXLY_CORRECT' set: turning on `--posix'"
msgstr "variable d'ambiente `POSIXLY_CORRECT' impostata: attivo `--posix'"
-#: main.c:345
+#: main.c:346
msgid "`--posix' overrides `--traditional'"
msgstr "`--posix' annulla `--traditional'"
-#: main.c:356
+#: main.c:357
msgid "`--posix'/`--traditional' overrides `--non-decimal-data'"
msgstr "`--posix'/`--traditional' annulla `--non-decimal-data'"
-#: main.c:361
+#: main.c:362
msgid "`--posix' overrides `--characters-as-bytes'"
msgstr "`--posix' annulla `--characters-as-bytes'"
-#: main.c:371
+#: main.c:373
#, c-format
msgid "running %s setuid root may be a security problem"
-msgstr "eseguire %s con `setuid' root può essere un rischio per la sicurezza"
+msgstr "eseguire %s con `setuid' root può essere un rischio per la sicurezza"
+
+#: main.c:375
+msgid "The -r/--re-interval options no longer have any effect"
+msgstr "L'opzione -r/--re-interval non ha più alcun effetto"
-#: main.c:424
+#: main.c:429
#, c-format
msgid "cannot set binary mode on stdin: %s"
-msgstr "non è possibile impostare modalità binaria su `stdin': %s"
+msgstr "non è possibile impostare modalità binaria su `stdin': %s"
-#: main.c:427
+#: main.c:432
#, c-format
msgid "cannot set binary mode on stdout: %s"
-msgstr "non è possibile impostare modalità binaria su `stdout': %s"
+msgstr "non è possibile impostare modalità binaria su `stdout': %s"
-#: main.c:429
+#: main.c:434
#, c-format
msgid "cannot set binary mode on stderr: %s"
-msgstr "non è possibile impostare modalità binaria su `stderr': %s"
+msgstr "non è possibile impostare modalità binaria su `stderr': %s"
-#: main.c:491
+#: main.c:496
msgid "no program text at all!"
msgstr "manca del tutto il testo del programma!"
-#: main.c:585
+#: main.c:590
#, c-format
msgid "Usage: %s [POSIX or GNU style options] -f progfile [--] file ...\n"
msgstr "Uso: %s [opzioni in stile POSIX o GNU] -f file-prog. [--] file ...\n"
-#: main.c:587
+#: main.c:592
#, c-format
msgid "Usage: %s [POSIX or GNU style options] [--] %cprogram%c file ...\n"
msgstr "Usage: %s [opzioni in stile POSIX o GNU] [--] %cprogramma%c file ...\n"
-#: main.c:592
+#: main.c:597
msgid "POSIX options:\t\tGNU long options: (standard)\n"
msgstr "Opzioni POSIX:\t\topzioni lunghe GNU: (standard)\n"
-#: main.c:593
+#: main.c:598
msgid "\t-f progfile\t\t--file=progfile\n"
msgstr "\t-f fileprog\t\t--file=file-prog.\n"
-#: main.c:594
+#: main.c:599
msgid "\t-F fs\t\t\t--field-separator=fs\n"
msgstr "\t-F fs\t\t\t--field-separator=fs\n"
-#: main.c:595
+#: main.c:600
msgid "\t-v var=val\t\t--assign=var=val\n"
msgstr "\t-v var=valore\t\t--assign=var=valore\n"
-#: main.c:596
+#: main.c:601
msgid "Short options:\t\tGNU long options: (extensions)\n"
msgstr "Opzioni brevi:\t\topzioni lunghe GNU: (estensioni)\n"
-#: main.c:597
+#: main.c:602
msgid "\t-b\t\t\t--characters-as-bytes\n"
msgstr "\t-b\t\t\t--characters-as-bytes\n"
-#: main.c:598
+#: main.c:603
msgid "\t-c\t\t\t--traditional\n"
msgstr "\t-c\t\t\t--traditional\n"
-#: main.c:599
+#: main.c:604
msgid "\t-C\t\t\t--copyright\n"
msgstr "\t-C\t\t\t--copyright\n"
-#: main.c:600
+#: main.c:605
msgid "\t-d[file]\t\t--dump-variables[=file]\n"
msgstr "\t-d[file]\t\t--dump-variables[=file]\n"
-#: main.c:601
+#: main.c:606
msgid "\t-D[file]\t\t--debug[=file]\n"
msgstr "\t-D[file]\t\t--debug[=file]\n"
-#: main.c:602
+#: main.c:607
msgid "\t-e 'program-text'\t--source='program-text'\n"
msgstr "\t-e 'testo-del-programma'\t--source='testo-del-programma'\n"
-#: main.c:603
+#: main.c:608
msgid "\t-E file\t\t\t--exec=file\n"
msgstr "\t-E file\t\t\t--exec=file\n"
-#: main.c:604
+#: main.c:609
msgid "\t-g\t\t\t--gen-pot\n"
msgstr "\t-g\t\t\t--gen-pot\n"
-#: main.c:605
+#: main.c:610
msgid "\t-h\t\t\t--help\n"
msgstr "\t-h\t\t\t--help\n"
-#: main.c:606
+#: main.c:611
msgid "\t-i includefile\t\t--include=includefile\n"
msgstr "\t-i include_file\t\t--include=include_file\n"
-#: main.c:607
+#: main.c:612
msgid "\t-I\t\t\t--trace\n"
msgstr "\t-I\t\t\t--trace\n"
-#: main.c:608
+#: main.c:613
msgid "\t-l library\t\t--load=library\n"
msgstr "\t-l libreria\t\t--load=libreria\n"
#. TRANSLATORS: the "fatal", "invalid" and "no-ext" here are literal
#. values, they should not be translated. Thanks.
#.
-#: main.c:613
+#: main.c:618
msgid "\t-L[fatal|invalid|no-ext]\t--lint[=fatal|invalid|no-ext]\n"
msgstr "\t-L[fatal|invalid|no-ext]\t--lint[=fatal|invalid|no-ext]\n"
-#: main.c:614
+#: main.c:619
msgid "\t-M\t\t\t--bignum\n"
msgstr "\t-M\t\t\t--bignum\n"
-#: main.c:615
+#: main.c:620
msgid "\t-N\t\t\t--use-lc-numeric\n"
msgstr "\t-N\t\t\t--use-lc-numeric\n"
-#: main.c:616
+#: main.c:621
msgid "\t-n\t\t\t--non-decimal-data\n"
msgstr "\t-n\t\t\t--non-decimal-data\n"
-#: main.c:617
+#: main.c:622
msgid "\t-o[file]\t\t--pretty-print[=file]\n"
msgstr "\t-o[file]\t\t--pretty-print[=file]\n"
-#: main.c:618
+#: main.c:623
msgid "\t-O\t\t\t--optimize\n"
msgstr "\t-O\t\t\t--optimize\n"
-#: main.c:619
+#: main.c:624
msgid "\t-p[file]\t\t--profile[=file]\n"
msgstr "\t-p[file]\t\t--profile[=file]\n"
-#: main.c:620
+#: main.c:625
msgid "\t-P\t\t\t--posix\n"
msgstr "\t-P\t\t\t--posix\n"
-#: main.c:621
+#: main.c:626
msgid "\t-r\t\t\t--re-interval\n"
msgstr "\t-r\t\t\t--re-interval\n"
-#: main.c:622
+#: main.c:627
msgid "\t-s\t\t\t--no-optimize\n"
msgstr "\t-s\t\t\t--no-optimize\n"
-#: main.c:623
+#: main.c:628
msgid "\t-S\t\t\t--sandbox\n"
msgstr "\t-S\t\t\t--sandbox\n"
-#: main.c:624
+#: main.c:629
msgid "\t-t\t\t\t--lint-old\n"
msgstr "\t-t\t\t\t--lint-old\n"
-#: main.c:625
+#: main.c:630
msgid "\t-V\t\t\t--version\n"
msgstr "\t-V\t\t\t--version\n"
-#: main.c:627
+#: main.c:632
msgid "\t-W nostalgia\t\t--nostalgia\n"
msgstr "\t-W nostalgia\t\t--nostalgia\n"
-#: main.c:630
+#: main.c:635
msgid "\t-Y\t\t\t--parsedebug\n"
msgstr "\t-Y\t\t\t--parsedebug\n"
-#: main.c:633
+#: main.c:638
msgid "\t-Z locale-name\t\t--locale=locale-name\n"
msgstr "\t-Z locale-name\t\t--locale=locale-name\n"
#. TRANSLATORS: --help output (end)
#. no-wrap
-#: main.c:639
+#: main.c:644
msgid ""
"\n"
"To report bugs, see node `Bugs' in `gawk.info'\n"
@@ -3195,23 +3223,23 @@ msgstr ""
"\n"
"Per segnalare problemi, vedere nodo `Bugs' in `gawk.info', oppure la\n"
"sezione `Segnalazione di problemi e bug' nella versione a stampa.\n"
-"La stessa informazione è disponibile in\n"
+"La stessa informazione è disponibile in\n"
"https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.\n"
"Siete pregati di NON segnalare bug scrivendo a comp.lang.awk.\n"
"Per problemi di traduzione, contattare: azc100@gmail.com.\n"
"\n"
-#: main.c:647
+#: main.c:652
msgid ""
"gawk is a pattern scanning and processing language.\n"
"By default it reads standard input and writes standard output.\n"
"\n"
msgstr ""
-"gawk è un linguaggio per scandire e processare espressioni.\n"
+"gawk è un linguaggio per scandire e processare espressioni.\n"
"Senza parametri, legge da `standard input' e scrive su `standard output'.\n"
"\n"
-#: main.c:651
+#: main.c:656
#, c-format
msgid ""
"Examples:\n"
@@ -3222,7 +3250,7 @@ msgstr ""
"\t%s '{ sum += $1 }; END { print sum }' file\n"
"\t%s -F: '{ print $1 }' /etc/passwd\n"
-#: main.c:683
+#: main.c:686
#, c-format
msgid ""
"Copyright (C) 1989, 1991-%d Free Software Foundation.\n"
@@ -3235,13 +3263,13 @@ msgid ""
msgstr ""
"Copyright (C) 1989, 1991-%d Free Software Foundation.\n"
"\n"
-"Questo software è libero; lo puoi distribuire e/o modificare\n"
+"Questo software è libero; lo puoi distribuire e/o modificare\n"
"alle condizioni stabilite nella 'GNU General Public License' pubblicata\n"
"dalla Free Software Foundation; fai riferimento alla versione 3 della\n"
"Licenza, o (a tua scelta) a una qualsiasi versione successiva.\n"
"\n"
-#: main.c:691
+#: main.c:694
msgid ""
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
@@ -3249,22 +3277,22 @@ msgid ""
"GNU General Public License for more details.\n"
"\n"
msgstr ""
-"Questo programma è distribuito con la speranza che sia utile,\n"
+"Questo programma è distribuito con la speranza che sia utile,\n"
"ma SENZA ALCUNA GARANZIA; senza neppure la garanzia implicita\n"
-"di COMMERCIABILITÀ o IDONEITÀ AD UN PARTICOLARE SCOPO.\n"
+"di COMMERCIABILITÀ o IDONEITÀ AD UN PARTICOLARE SCOPO.\n"
"Vedi la 'GNU General Public License' per ulteriori dettagli.\n"
"\n"
-#: main.c:697
+#: main.c:700
msgid ""
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see http://www.gnu.org/licenses/.\n"
msgstr ""
"Dovresti aver ricevuto una copia della GNU General Public License\n"
-"assieme a questo programma; se non è così, vedi http://www.gnu.org/"
+"assieme a questo programma; se non è così, vedi http://www.gnu.org/"
"licenses/.\n"
-#: main.c:738
+#: main.c:739
msgid "-Ft does not set FS to tab in POSIX awk"
msgstr "-Ft non imposta FS a `tab' nell'awk POSIX"
@@ -3280,12 +3308,12 @@ msgstr ""
#: main.c:1179
#, c-format
msgid "`%s' is not a legal variable name"
-msgstr "`%s' non è un nome di variabile ammesso"
+msgstr "`%s' non è un nome di variabile ammesso"
#: main.c:1182
#, c-format
msgid "`%s' is not a variable name, looking for file `%s=%s'"
-msgstr "`%s' non è un nome di variabile, cerco il file `%s=%s'"
+msgstr "`%s' non è un nome di variabile, cerco il file `%s=%s'"
#: main.c:1196
#, c-format
@@ -3295,7 +3323,7 @@ msgstr "nome funzione interna gawk `%s' non ammesso come nome variabile"
#: main.c:1201
#, c-format
msgid "cannot use function `%s' as variable name"
-msgstr "non è possibile usare nome di funzione `%s' come nome di variabile"
+msgstr "non è possibile usare nome di funzione `%s' come nome di variabile"
#: main.c:1280
msgid "floating point exception"
@@ -3335,103 +3363,103 @@ msgstr "`--profile' annulla `--pretty-print'"
msgid "-M ignored: MPFR/GMP support not compiled in"
msgstr "-M ignorato: supporto per MPFR/GMP non generato"
-#: main.c:1711
+#: main.c:1713
#, c-format
msgid "%s: option `-W %s' unrecognized, ignored\n"
msgstr "%s: opzione `-W %s' non riconosciuta, ignorata\n"
-#: main.c:1764
+#: main.c:1766
#, c-format
msgid "%s: option requires an argument -- %c\n"
msgstr "%s: l'opzione richiede un argomento -- %c\n"
-#: mpfr.c:605
+#: mpfr.c:652
#, c-format
msgid "PREC value `%.*s' is invalid"
msgstr "valore PREC `%.*s' non valido"
-#: mpfr.c:664
+#: mpfr.c:711
#, c-format
msgid "ROUNDMODE value `%.*s' is invalid"
msgstr "valore di ROUNDMODE `%.*s' non valido"
-#: mpfr.c:728
+#: mpfr.c:777
msgid "atan2: received non-numeric first argument"
msgstr "atan2: ricevuto primo argomento non numerico"
-#: mpfr.c:730
+#: mpfr.c:779
msgid "atan2: received non-numeric second argument"
msgstr "atan2: ricevuto secondo argomento non numerico"
-#: mpfr.c:767
+#: mpfr.c:818
#, c-format
msgid "%s: received negative argument %.*s"
msgstr "%s: ricevuto argomento negativo %.*s"
-#: mpfr.c:832
+#: mpfr.c:885
msgid "int: received non-numeric argument"
msgstr "int: ricevuto argomento non numerico"
-#: mpfr.c:862
+#: mpfr.c:917
msgid "compl: received non-numeric argument"
msgstr "compl: ricevuto argomento non numerico"
-#: mpfr.c:874
+#: mpfr.c:929
msgid "compl(%Rg): negative value is not allowed"
msgstr "compl(%Rg): valore negativo non consentito"
-#: mpfr.c:879
+#: mpfr.c:934
msgid "comp(%Rg): fractional value will be truncated"
-msgstr "comp(%Rg): valore decimale sarà troncato"
+msgstr "comp(%Rg): valore decimale sarà troncato"
-#: mpfr.c:890
+#: mpfr.c:945
#, c-format
msgid "compl(%Zd): negative values are not allowed"
msgstr "compl(%Zd): non sono consentiti valori negativi"
-#: mpfr.c:908
+#: mpfr.c:963
#, c-format
msgid "%s: received non-numeric argument #%d"
msgstr "%s: ricevuto argomento non numerico #%d"
-#: mpfr.c:918
+#: mpfr.c:973
msgid "%s: argument #%d has invalid value %Rg, using 0"
msgstr "%s: argomento #%d con valore non valido %Rg, uso 0"
-#: mpfr.c:929
+#: mpfr.c:984
msgid "%s: argument #%d negative value %Rg is not allowed"
msgstr "%s: argomento #%d con valore negativo %Rg non consentito"
-#: mpfr.c:936
+#: mpfr.c:991
msgid "%s: argument #%d fractional value %Rg will be truncated"
-msgstr "%s: argomento #%d, valore decimale sarà troncato"
+msgstr "%s: argomento #%d, valore decimale sarà troncato"
-#: mpfr.c:950
+#: mpfr.c:1005
#, c-format
msgid "%s: argument #%d negative value %Zd is not allowed"
msgstr "%s: argomento #%d con valore negativo %Zd non consentito"
-#: mpfr.c:1040
+#: mpfr.c:1099
msgid "and: called with less than two arguments"
msgstr "and: chiamata con meno di due argomenti"
-#: mpfr.c:1072
+#: mpfr.c:1131
msgid "or: called with less than two arguments"
msgstr "or: chiamata con meno di due argomenti"
-#: mpfr.c:1103
+#: mpfr.c:1162
msgid "xor: called with less than two arguments"
msgstr "xor: chiamata con meno di due argomenti"
-#: mpfr.c:1227
+#: mpfr.c:1292
msgid "srand: received non-numeric argument"
msgstr "srand: ricevuto argomento non numerico"
-#: mpfr.c:1269
+#: mpfr.c:1336
msgid "intdiv: received non-numeric first argument"
msgstr "intdiv: ricevuto primo argomento non numerico"
-#: mpfr.c:1271
+#: mpfr.c:1338
msgid "intdiv: received non-numeric second argument"
msgstr "intdiv: ricevuto secondo argomento non numerico"
@@ -3440,24 +3468,24 @@ msgstr "intdiv: ricevuto secondo argomento non numerico"
msgid "cmd. line:"
msgstr "riga com.:"
-#: node.c:481
+#: node.c:480
msgid "could not make typed regex"
msgstr "non sono riuscito a creare una `typed regex'"
-#: node.c:554
+#: node.c:553
#, c-format
msgid "old awk does not support the `\\%c' escape sequence"
msgstr "il vecchio awk non supporta la sequenza di protezione '\\%c'"
-#: node.c:605
+#: node.c:604
msgid "POSIX does not allow `\\x' escapes"
msgstr "POSIX non consente escape `\\x'"
-#: node.c:611
+#: node.c:610
msgid "no hex digits in `\\x' escape sequence"
msgstr "niente cifre esadecimali nella sequenza di protezione `\\x'"
-#: node.c:632
+#: node.c:631
#, c-format
msgid ""
"hex escape \\x%.*s of %d characters probably not interpreted the way you "
@@ -3466,17 +3494,17 @@ msgstr ""
"sequenza di escape esadec.\\x%.*s di %d caratteri probabilmente non "
"interpretata nel modo previsto"
-#: node.c:647
+#: node.c:646
#, c-format
msgid "escape sequence `\\%c' treated as plain `%c'"
msgstr "sequenza di protezione `\\%c' considerata come semplice `%c'"
-#: node.c:783
+#: node.c:782
msgid ""
"Invalid multibyte data detected. There may be a mismatch between your data "
"and your locale"
msgstr ""
-"Trovati dati multi-byte invalidi. Può esserci una differenza tra i dati e la "
+"Trovati dati multi-byte invalidi. Può esserci una differenza tra i dati e la "
"codifica locale"
#: posix/gawkmisc.c:177
@@ -3572,7 +3600,7 @@ msgid ""
"POSIX"
msgstr ""
"la regola per la corrispondenza di un'espressione regolare che contiene dei "
-"caratteri NUL non è definita in POSIX"
+"caratteri NUL non è definita in POSIX"
#: re.c:127
msgid "invalid NUL byte in dynamic regexp"
@@ -3587,10 +3615,10 @@ msgstr "la sequenza di protezione `\\%c' considerata come semplice `%c'"
#, c-format
msgid "regexp escape sequence `\\%c' is not a known regexp operator"
msgstr ""
-"la sequenza di protezione `\\%c' non è un operatore noto per un'espressione "
+"la sequenza di protezione `\\%c' non è un operatore noto per un'espressione "
"regolare"
-#: re.c:663
+#: re.c:669
#, c-format
msgid "regexp component `%.*s' should probably be `[%.*s]'"
msgstr ""
@@ -3606,7 +3634,7 @@ msgstr "character class non valida"
#: support/dfa.c:1143
msgid "character class syntax is [[:space:]], not [:space:]"
-msgstr "sintassi character class è [[:spazio:]], non [:spazio:]"
+msgstr "sintassi character class è [[:spazio:]], non [:spazio:]"
#: support/dfa.c:1210
msgid "unfinished \\ escape"
@@ -3635,7 +3663,7 @@ msgstr ") non aperta"
#: support/getopt.c:605 support/getopt.c:634
#, c-format
msgid "%s: option '%s' is ambiguous; possibilities:"
-msgstr "%s: opzione '%s' ambigua; possibilità:"
+msgstr "%s: opzione '%s' ambigua; possibilità:"
#: support/getopt.c:680 support/getopt.c:684
#, c-format
@@ -3676,7 +3704,7 @@ msgstr "%s: l'opzione richiede un argomento -- '%c'\n"
#: support/getopt.c:990 support/getopt.c:1006
#, c-format
msgid "%s: option '-W %s' is ambiguous\n"
-msgstr "%s: l'opzione '-W %s' è ambigua\n"
+msgstr "%s: l'opzione '-W %s' è ambigua\n"
#: support/getopt.c:1030 support/getopt.c:1048
#, c-format
@@ -3688,84 +3716,102 @@ msgstr "%s: l'opzione '-W %s' non ammette un argomento\n"
msgid "%s: option '-W %s' requires an argument\n"
msgstr "%s: l'opzione '-W %s' richiede un argomento\n"
-#: support/regcomp.c:135
+#: support/regcomp.c:122
msgid "Success"
msgstr "Successo"
-#: support/regcomp.c:138
+#: support/regcomp.c:125
msgid "No match"
msgstr "Nessuna corrispondenza"
-#: support/regcomp.c:141
+#: support/regcomp.c:128
msgid "Invalid regular expression"
msgstr "Espressione regolare invalida"
-#: support/regcomp.c:144
+#: support/regcomp.c:131
msgid "Invalid collation character"
msgstr "Carattere di ordinamento non valido"
-#: support/regcomp.c:147
+#: support/regcomp.c:134
msgid "Invalid character class name"
msgstr "Nome di 'classe di caratteri' non valido"
-#: support/regcomp.c:150
+#: support/regcomp.c:137
msgid "Trailing backslash"
msgstr "'\\' finale"
-#: support/regcomp.c:153
+#: support/regcomp.c:140
msgid "Invalid back reference"
msgstr "Riferimento indietro non valido"
-#: support/regcomp.c:156
+#: support/regcomp.c:143
msgid "Unmatched [, [^, [:, [., or [="
msgstr "[, [^, [:, [. o [= non chiusa"
-#: support/regcomp.c:159
+#: support/regcomp.c:146
msgid "Unmatched ( or \\("
msgstr "( o \\( non chiusa"
-#: support/regcomp.c:162
+#: support/regcomp.c:149
msgid "Unmatched \\{"
msgstr "\\{ non chiusa"
-#: support/regcomp.c:165
+#: support/regcomp.c:152
msgid "Invalid content of \\{\\}"
msgstr "Contenuto di \\{\\} non valido"
-#: support/regcomp.c:168
+#: support/regcomp.c:155
msgid "Invalid range end"
msgstr "Fine di intervallo non valido"
-#: support/regcomp.c:171
+#: support/regcomp.c:158
msgid "Memory exhausted"
msgstr "Memoria esaurita"
-#: support/regcomp.c:174
+#: support/regcomp.c:161
msgid "Invalid preceding regular expression"
msgstr "Espressione regolare precedente invalida"
-#: support/regcomp.c:177
+#: support/regcomp.c:164
msgid "Premature end of regular expression"
msgstr "Fine di espressione regolare inaspettata"
-#: support/regcomp.c:180
+#: support/regcomp.c:167
msgid "Regular expression too big"
msgstr "Espressione regolare troppo complessa"
-#: support/regcomp.c:183
+#: support/regcomp.c:170
msgid "Unmatched ) or \\)"
msgstr ") o \\) non aperta"
-#: support/regcomp.c:676
+#: support/regcomp.c:650
msgid "No previous regular expression"
msgstr "Nessuna espressione regolare precedente"
-#: symbol.c:698
+#: symbol.c:702
#, c-format
msgid "function `%s': cannot use function `%s' as a parameter name"
msgstr ""
-"funzione `%s': non è possibile usare nome funzione `%s' come nome parametro"
+"funzione `%s': non è possibile usare nome funzione `%s' come nome parametro"
-#: symbol.c:828
+#: symbol.c:832
msgid "cannot pop main context"
-msgstr "non posso salire più in alto nel contesto di esecuzione"
+msgstr "non posso salire più in alto nel contesto di esecuzione"
+
+#~ msgid "do_writea: first argument is not a string"
+#~ msgstr "do_writea: il primo argomento non è una stringa"
+
+#~ msgid "do_reada: first argument is not a string"
+#~ msgstr "do_reada: il primo argomento non è una stringa"
+
+#~ msgid "do_writea: argument 0 is not a string"
+#~ msgstr "do_writea: l'argomento 0 non è una stringa"
+
+#~ msgid "do_writea: argument 1 is not an array"
+#~ msgstr "do_writea: l'argomento 1 non è un vettore"
+
+#~ msgid "do_reada: argument 0 is not a string"
+#~ msgstr "do_reada: argomento 0 non è una stringa"
+
+#~ msgid "do_reada: argument 1 is not an array"
+#~ msgstr "do_reada: l'argomento 1 non è un vettore"
diff --git a/re.c b/re.c
index 1caa57e9..544e9944 100644
--- a/re.c
+++ b/re.c
@@ -478,10 +478,16 @@ resetup()
/*
* Interval expressions are now on by default, as POSIX is
- * wide-spread enough that people want it. The do_intervals
- * variable remains for use with --traditional.
+ * wide-spread enough that people want it.
+ *
+ * 2/2022: BWK awk has supported interval expressions since
+ * March 2019, with an important fix added in Januay 2020.
+ * So we add that support even for --traditional. It's easier to
+ * do it here than to try to get the GLIBC / GNULIB folks to change
+ * the definition of RE_SYNTAX_AWK, which likely would cause
+ * binary compatibility issues.
*/
- if (do_intervals)
+ if (do_traditional)
syn |= RE_INTERVALS | RE_INVALID_INTERVAL_ORD | RE_NO_BK_BRACES;
(void) re_set_syntax(syn);
diff --git a/str_array.c b/str_array.c
index f6e4deeb..08704312 100644
--- a/str_array.c
+++ b/str_array.c
@@ -95,6 +95,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;
@@ -112,8 +113,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);
@@ -773,6 +779,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 5fdab3de..7fa46da5 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -64,6 +64,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 ddae26ea..44a0e951 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,8 +1,16 @@
+2022-02-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * badargs.ok: Updated after code change.
+
2022-02-10 Andrew J. Schorr <aschorr@telemetry-investments.com>
* Makefile.am (EXTRA_DIST): close_status, new test.
* close_status.awk, close_status.ok: New files.
+2022-02-10 Arnold D. Robbins <arnold@skeeve.com>
+
+ * nsidentifier.ok: Update after code changes.
+
2022-02-09 Arnold D. Robbins <arnold@skeeve.com>
* Makefile.am (EXTRA_DIST): indirectbuiltin2, new test.
@@ -13,6 +21,23 @@
* Makefile.am (EXTRA_DIST): nsidentifier, new test.
* nsidentifier.awk, nsidentifier.ok: New files.
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (EXTRA_DIST): Add readall1.awk, readall2.awk, and
+ readall.ok.
+ (SHLIB_TESTS): Add readall.
+ (GENTESTS_UNUSED): Add readall1.awk and readall2.awk.
+ (readall): Add new test of the writeall and readall functions.
+ * readall1.awk, readall2.awk, readall.ok: New files.
+
+2021-12-08 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (testext): Change awk pattern to include functions in
+ testext.awk.
+ (diffout): If running MPFR tests and there's an mpfr.ok file, compare
+ to that instead of to the regular ok file.
+ * testext.ok, testext-mpfr.ok: Update for new test_array_create test.
+
2021-12-07 Andrew J. Schorr <aschorr@telemetry-investments.com>
* iolint.awk, iolint.ok: Reorder "cat" pipe/output file test to reduce
@@ -147,16 +172,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 96dd3027..ddca3f59 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 \
@@ -1035,6 +1037,9 @@ EXTRA_DIST = \
range1.ok \
range2.awk \
range2.ok \
+ readall1.awk \
+ readall2.awk \
+ readall.ok \
readbuf.awk \
readbuf.ok \
readdir.awk \
@@ -1443,35 +1448,36 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
- arraysort2 arraytype backw badargs beginfile1 beginfile2 binmode1 \
- charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 commas crlf dbugeval dbugeval2 dbugeval3 \
- dbugtypedre1 dbugtypedre2 delsub devfd devfd1 devfd2 dfacheck1 \
- dumpvars errno exit fieldwdth forcenum fpat1 fpat2 fpat3 fpat4 \
- fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs funlen functab1 \
- functab2 functab3 functab6 fwtest fwtest2 fwtest3 fwtest4 fwtest5 \
- fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 getlndir \
- gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
- ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
- incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
+ arraysort2 arraytype asortbool backw badargs beginfile1 \
+ beginfile2 binmode1 charasbytes clos1way clos1way2 clos1way3 \
+ clos1way4 clos1way5 clos1way6 colonwarn commas crlf dbugeval \
+ dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub devfd \
+ devfd1 devfd2 dfacheck1 dumpvars errno exit fieldwdth forcenum \
+ fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \
+ fsfwfs functab1 functab2 functab3 functab6 funlen fwtest fwtest2 \
+ fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub \
+ gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \
+ icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase \
+ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
+ include include2 indirectbuiltin indirectcall indirectcall2 \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
- isarrayunset lint lintexp lintindex lintint lintlength lintplus \
- lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
- mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
- next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
- nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
- printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
- profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
- profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
- profile14 profile15 profile16 pty1 pty2 rebuf regexsub regnul1 regnul2 \
- regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \
+ inf-nan-torture intarray iolint isarrayunset lint lintexp \
+ lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
+ modifiers muldimposix nastyparm negtime next nondec nondec2 \
+ nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
+ nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
+ profile1 profile10 profile11 profile12 profile13 profile14 \
+ profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
+ profile7 profile8 profile9 pty1 pty2 rebuf regexsub reginttrad \
+ regnul1 regnul2 regx8bit reint reint2 rsgetline rsglstdin rsstart1 \
rsstart2 rsstart3 rstest6 sandbox1 shadow shadowbuiltin sortfor \
sortfor2 sortu sourcesplit split_after_fpat splitarg4 strftfld \
strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
- switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
- symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+ switch2 symtab1 symtab10 symtab11 symtab2 symtab3 symtab4 symtab5 \
+ symtab6 symtab7 symtab8 symtab9 timeout typedregex1 typedregex2 \
typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
typeof3 typeof4 typeof5 typeof6 watchpoint1
@@ -1495,6 +1501,7 @@ SHLIB_TESTS = \
getfile \
inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \
ordchr ordchr2 \
+ readall \
readdir readdir_test readdir_retest readfile readfile2 revout \
revtwoway rwarray \
testext time
@@ -1602,7 +1609,8 @@ ZOS_FAIL = @ZOS_FAIL@
GENTESTS_UNUSED = Makefile.in checknegtime.awk dtdgport.awk fix-fmtspcl.awk \
fmtspcl-mpfr.ok fmtspcl.awk fmtspcl.tok gtlnbufv.awk hello.awk \
inchello.awk inclib.awk inplace.1.in inplace.2.in inplace.in \
- printfloat.awk readdir0.awk valgrind.awk xref.awk
+ printfloat.awk readdir0.awk valgrind.awk xref.awk \
+ readall1.awk readall2.awk
# List of tests on MinGW or DJGPP that need a different cmp program
NEED_TESTOUTCMP = \
@@ -2286,7 +2294,7 @@ inplace3bcomp::
testext::
@echo $@
- @-$(AWK) ' /^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
+ @-$(AWK) ' /^(@load|BEGIN|function)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
@-$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null; \
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ testext.awk testexttmp.txt ; \
@@ -2322,6 +2330,13 @@ readdir_retest:
@-$(AWK) -lreaddir_test -F/ -f "$(srcdir)"/$@.awk "$(top_srcdir)" > _$@
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
+readall:
+ @echo $@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@1.awk -v "ofile=readall.state" > _$@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@2.awk -v "ifile=readall.state" >> _$@
+ @-$(CMP) $@.ok _$@ && rm -f _$@
+ @-$(RM) -f readall.state
+
fts:
@echo $@
@-case `uname` in \
@@ -2530,7 +2545,11 @@ diffout:
if [ "$$i" != "_*" ]; then \
echo ============== $$i ============= ; \
base=`echo $$i | sed 's/^_//'` ; \
- if [ -r $${base}.ok ]; then \
+ if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r $${base}-mpfr.ok ]; then \
+ diff -u $${base}-mpfr.ok $$i ; \
+ elif echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r "$(srcdir)"/$${base}-mpfr.ok ]; then \
+ diff -u "$(srcdir)"/$${base}-mpfr.ok $$i ; \
+ elif [ -r $${base}.ok ]; then \
diff -u $${base}.ok $$i ; \
else \
diff -u "$(srcdir)"/$${base}.ok $$i ; \
diff --git a/test/Makefile.in b/test/Makefile.in
index 94699c32..d974a98c 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 \
@@ -1301,6 +1303,9 @@ EXTRA_DIST = \
range1.ok \
range2.awk \
range2.ok \
+ readall1.awk \
+ readall2.awk \
+ readall.ok \
readbuf.awk \
readbuf.ok \
readdir.awk \
@@ -1709,35 +1714,36 @@ UNIX_TESTS = \
GAWK_EXT_TESTS = \
aadelete1 aadelete2 aarray1 aasort aasorti argtest arraysort \
- arraysort2 arraytype backw badargs beginfile1 beginfile2 binmode1 \
- charasbytes colonwarn clos1way clos1way2 clos1way3 clos1way4 \
- clos1way5 clos1way6 commas crlf dbugeval dbugeval2 dbugeval3 \
- dbugtypedre1 dbugtypedre2 delsub devfd devfd1 devfd2 dfacheck1 \
- dumpvars errno exit fieldwdth forcenum fpat1 fpat2 fpat3 fpat4 \
- fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull fsfwfs funlen functab1 \
- functab2 functab3 functab6 fwtest fwtest2 fwtest3 fwtest4 fwtest5 \
- fwtest6 fwtest7 fwtest8 genpot gensub gensub2 gensub3 getlndir \
- gnuops2 gnuops3 gnureops gsubind icasefs icasers id igncdym igncfs \
- ignrcas2 ignrcas4 ignrcase incdupe incdupe2 incdupe3 incdupe4 \
- incdupe5 incdupe6 incdupe7 include include2 indirectbuiltin \
+ arraysort2 arraytype asortbool backw badargs beginfile1 \
+ beginfile2 binmode1 charasbytes clos1way clos1way2 clos1way3 \
+ clos1way4 clos1way5 clos1way6 colonwarn commas crlf dbugeval \
+ dbugeval2 dbugeval3 dbugtypedre1 dbugtypedre2 delsub devfd \
+ devfd1 devfd2 dfacheck1 dumpvars errno exit fieldwdth forcenum \
+ fpat1 fpat2 fpat3 fpat4 fpat5 fpat6 fpat7 fpat8 fpat9 fpatnull \
+ fsfwfs functab1 functab2 functab3 functab6 funlen fwtest fwtest2 \
+ fwtest3 fwtest4 fwtest5 fwtest6 fwtest7 fwtest8 genpot gensub \
+ gensub2 gensub3 getlndir gnuops2 gnuops3 gnureops gsubind \
+ icasefs icasers id igncdym igncfs ignrcas2 ignrcas4 ignrcase \
+ incdupe incdupe2 incdupe3 incdupe4 incdupe5 incdupe6 incdupe7 \
+ include include2 indirectbuiltin indirectcall indirectcall2 \
indirectbuiltin2 \
- indirectcall indirectcall2 inf-nan-torture intarray iolint \
- isarrayunset lint lintexp lintindex lintint lintlength lintplus \
- lintold lintset lintwarn manyfiles match1 match2 match3 mbstr1 \
- mbstr2 mixed1 mktime modifiers muldimposix nastyparm negtime \
- next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b \
- nsawk1c nsawk2a nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse \
- nsidentifier nsindirect1 nsindirect2 nsprof1 nsprof2 octdec patsplit posix \
- printfbad1 printfbad2 printfbad3 printfbad4 printhuge procinfs \
- profile0 profile1 profile2 profile3 profile4 profile5 profile6 \
- profile7 profile8 profile9 profile10 profile11 profile12 profile13 \
- profile14 profile15 profile16 pty1 pty2 rebuf regexsub regnul1 regnul2 \
- regx8bit reginttrad reint reint2 rsgetline rsglstdin rsstart1 \
+ inf-nan-torture intarray iolint isarrayunset lint lintexp \
+ lintindex lintint lintlength lintold lintplus lintset lintwarn \
+ manyfiles match1 match2 match3 mbstr1 mbstr2 mixed1 mktime \
+ modifiers muldimposix nastyparm negtime next nondec nondec2 \
+ nonfatal1 nonfatal2 nonfatal3 nsawk1a nsawk1b nsawk1c nsawk2a \
+ nsawk2b nsbad nsbad_cmd nsforloop nsfuncrecurse nsindirect1 \
+ nsidentifier nsindirect2 nsprof1 nsprof2 octdec patsplit posix printfbad1 \
+ printfbad2 printfbad3 printfbad4 printhuge procinfs profile0 \
+ profile1 profile10 profile11 profile12 profile13 profile14 \
+ profile15 profile16 profile2 profile3 profile4 profile5 profile6 \
+ profile7 profile8 profile9 pty1 pty2 rebuf regexsub reginttrad \
+ regnul1 regnul2 regx8bit reint reint2 rsgetline rsglstdin rsstart1 \
rsstart2 rsstart3 rstest6 sandbox1 shadow shadowbuiltin sortfor \
sortfor2 sortu sourcesplit split_after_fpat splitarg4 strftfld \
strftime strtonum strtonum1 stupid1 stupid2 stupid3 stupid4 stupid5 \
- switch2 symtab1 symtab2 symtab3 symtab4 symtab5 symtab6 symtab7 \
- symtab8 symtab9 symtab10 symtab11 timeout typedregex1 typedregex2 \
+ switch2 symtab1 symtab10 symtab11 symtab2 symtab3 symtab4 symtab5 \
+ symtab6 symtab7 symtab8 symtab9 timeout typedregex1 typedregex2 \
typedregex3 typedregex4 typedregex5 typedregex6 typeof1 typeof2 \
typeof3 typeof4 typeof5 typeof6 watchpoint1
@@ -1757,6 +1763,7 @@ SHLIB_TESTS = \
getfile \
inplace1 inplace2 inplace2bcomp inplace3 inplace3bcomp \
ordchr ordchr2 \
+ readall \
readdir readdir_test readdir_retest readfile readfile2 revout \
revtwoway rwarray \
testext time
@@ -1869,7 +1876,8 @@ EXPECTED_FAIL_ZOS = \
GENTESTS_UNUSED = Makefile.in checknegtime.awk dtdgport.awk fix-fmtspcl.awk \
fmtspcl-mpfr.ok fmtspcl.awk fmtspcl.tok gtlnbufv.awk hello.awk \
inchello.awk inclib.awk inplace.1.in inplace.2.in inplace.in \
- printfloat.awk readdir0.awk valgrind.awk xref.awk
+ printfloat.awk readdir0.awk valgrind.awk xref.awk \
+ readall1.awk readall2.awk
# List of tests on MinGW or DJGPP that need a different cmp program
@@ -2740,7 +2748,7 @@ inplace3bcomp::
testext::
@echo $@
- @-$(AWK) ' /^(@load|BEGIN)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
+ @-$(AWK) ' /^(@load|BEGIN|function)/,/^}/' "$(top_srcdir)"/extension/testext.c > testext.awk
@-$(AWK) -f ./testext.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null; \
then $(CMP) "$(srcdir)"/$@-mpfr.ok _$@ && rm -f _$@ testext.awk testexttmp.txt ; \
@@ -2776,6 +2784,13 @@ readdir_retest:
@-$(AWK) -lreaddir_test -F/ -f "$(srcdir)"/$@.awk "$(top_srcdir)" > _$@
@-$(CMP) $@.ok _$@ && rm -f $@.ok _$@
+readall:
+ @echo $@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@1.awk -v "ofile=readall.state" > _$@
+ @-$(AWK) -lrwarray -f "$(srcdir)"/$@2.awk -v "ifile=readall.state" >> _$@
+ @-$(CMP) $@.ok _$@ && rm -f _$@
+ @-$(RM) -f readall.state
+
fts:
@echo $@
@-case `uname` in \
@@ -4287,6 +4302,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: $$? >>_$@
@@ -4434,11 +4454,6 @@ fsfwfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-funlen:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
functab1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -4459,6 +4474,11 @@ functab6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+funlen:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fwtest:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -4640,14 +4660,14 @@ lintlength:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintplus:
+lintold:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintold:
+lintplus:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
lintset:
@@ -4747,12 +4767,12 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsidentifier:
+nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsindirect1:
+nsidentifier:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -4813,47 +4833,47 @@ procinfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile4:
+profile10:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile8:
+profile11:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile9:
+profile13:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile10:
+profile14:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile11:
+profile15:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile13:
+profile16:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile14:
+profile4:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile15:
+profile8:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile16:
+profile9:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -4999,6 +5019,16 @@ symtab1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+symtab10:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+symtab11:
+ @echo $@ $(ZOS_FAIL)
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
symtab2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -5024,16 +5054,6 @@ symtab7:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-symtab10:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-symtab11:
- @echo $@ $(ZOS_FAIL)
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
timeout:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -5362,7 +5382,11 @@ diffout:
if [ "$$i" != "_*" ]; then \
echo ============== $$i ============= ; \
base=`echo $$i | sed 's/^_//'` ; \
- if [ -r $${base}.ok ]; then \
+ if echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r $${base}-mpfr.ok ]; then \
+ diff -u $${base}-mpfr.ok $$i ; \
+ elif echo "$$GAWK_TEST_ARGS" | egrep -e '-M|--bignum' > /dev/null && [ -r "$(srcdir)"/$${base}-mpfr.ok ]; then \
+ diff -u "$(srcdir)"/$${base}-mpfr.ok $$i ; \
+ elif [ -r $${base}.ok ]; then \
diff -u $${base}.ok $$i ; \
else \
diff -u "$(srcdir)"/$${base}.ok $$i ; \
diff --git a/test/Maketests b/test/Maketests
index 26831128..10ef252f 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -1335,6 +1335,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: $$? >>_$@
@@ -1482,11 +1487,6 @@ fsfwfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-funlen:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
functab1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1507,6 +1507,11 @@ functab6:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+funlen:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fwtest:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -1688,14 +1693,14 @@ lintlength:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintplus:
+lintold:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-lintold:
+lintplus:
@echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint-old < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --lint >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
lintset:
@@ -1795,12 +1800,12 @@ nsfuncrecurse:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsidentifier:
+nsindirect1:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-nsindirect1:
+nsidentifier:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -1861,47 +1866,47 @@ procinfs:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile4:
+profile10:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile8:
+profile11:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile9:
+profile13:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile10:
+profile14:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile11:
+profile15:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile13:
+profile16:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile14:
+profile4:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile15:
+profile8:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-profile16:
+profile9:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
@@ -2047,6 +2052,16 @@ symtab1:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+symtab10:
+ @echo $@
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
+symtab11:
+ @echo $@ $(ZOS_FAIL)
+ @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
symtab2:
@echo $@
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@@ -2072,16 +2087,6 @@ symtab7:
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk < "$(srcdir)"/$@.in >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-symtab10:
- @echo $@
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
-symtab11:
- @echo $@ $(ZOS_FAIL)
- @-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
- @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
-
timeout:
@echo $@ $(ZOS_FAIL)
@-AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 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/badargs.ok b/test/badargs.ok
index 5ec0558c..ea022461 100644
--- a/test/badargs.ok
+++ b/test/badargs.ok
@@ -32,7 +32,8 @@ Short options: GNU long options: (extensions)
-t --lint-old
-V --version
-To report bugs, see node `Bugs' in `gawk.info'
+To report bugs, use the `gawkbug' program.
+For full instructions, see the node `Bugs' in `gawk.info'
which is section `Reporting Problems and Bugs' in the
printed version. This same information may be found at
https://www.gnu.org/software/gawk/manual/html_node/Bugs.html.
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/nsidentifier.ok b/test/nsidentifier.ok
index 5743f94c..5bd7e7b2 100644
--- a/test/nsidentifier.ok
+++ b/test/nsidentifier.ok
@@ -90,6 +90,7 @@ list
log
lshift
match
+mkbool
mktime
n
ns::ns1
diff --git a/test/readall.ok b/test/readall.ok
new file mode 100644
index 00000000..b343af59
--- /dev/null
+++ b/test/readall.ok
@@ -0,0 +1,7 @@
+1
+1
+5.9 3 -2.327
+zebra[archie] = banana
+zebra[0] = apple
+zebra[3][foo] = bar
+zebra[3][bar] = foo
diff --git a/test/readall1.awk b/test/readall1.awk
new file mode 100644
index 00000000..2888d157
--- /dev/null
+++ b/test/readall1.awk
@@ -0,0 +1,10 @@
+BEGIN {
+ x = 5.9
+ y = 3
+ z = -2.327
+ zebra[0] = "apple"
+ zebra["archie"] = "banana"
+ zebra[3]["foo"] = "bar"
+ zebra[3]["bar"] = "foo"
+ print writeall(ofile)
+}
diff --git a/test/readall2.awk b/test/readall2.awk
new file mode 100644
index 00000000..8b79849a
--- /dev/null
+++ b/test/readall2.awk
@@ -0,0 +1,15 @@
+function printarray(n, x, i) {
+ for (i in x) {
+ if (isarray(x[i]))
+ printarray((n "[" i "]"), x[i])
+ else
+ printf "%s[%s] = %s\n", n, i, x[i]
+ }
+}
+
+BEGIN {
+ print readall(ifile)
+ print x, y, z
+ #print zebra[0], zebra[3]["foo"], zebra[3]["bar"]
+ printarray("zebra", zebra)
+}
diff --git a/test/rwarray.awk b/test/rwarray.awk
index c06fec21..dfd74ce0 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)
+
dict["x"] = "x"
dict["42"] = 42
@@ -56,4 +59,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
diff --git a/test/testext-mpfr.ok b/test/testext-mpfr.ok
index 2c616c67..ec584216 100644
--- a/test/testext-mpfr.ok
+++ b/test/testext-mpfr.ok
@@ -48,6 +48,8 @@ test_array_param: argument is not undefined (1)
test_array_param() returned 0
isarray(a_scalar) = 0
+test_array_create returned 1
+good: we have an array
Initial value of LINT is 0
print_do_lint: lint = 0
print_do_lint() returned 1
diff --git a/test/testext.ok b/test/testext.ok
index fbc3c263..1d058302 100644
--- a/test/testext.ok
+++ b/test/testext.ok
@@ -48,6 +48,8 @@ test_array_param: argument is not undefined (1)
test_array_param() returned 0
isarray(a_scalar) = 0
+test_array_create returned 1
+good: we have an array
Initial value of LINT is 0
print_do_lint: lint = 0
print_do_lint() returned 1