aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/CMakeLists.txt95
-rw-r--r--doc/ChangeLog82
-rw-r--r--doc/awkcard.in31
-rw-r--r--doc/gawk.114
-rw-r--r--doc/gawk.info1436
-rw-r--r--doc/gawk.texi452
-rw-r--r--doc/gawktexi.in452
-rw-r--r--doc/it/ChangeLog51
-rwxr-xr-x[-rw-r--r--]doc/it/gawk.116
-rwxr-xr-x[-rw-r--r--]doc/it/gawktexi.in1424
-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.tex191
-rw-r--r--doc/wordlist1
15 files changed, 3582 insertions, 1287 deletions
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 fc1bcae1..9213557a 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -5,12 +5,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.
@@ -22,10 +59,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.
@@ -96,12 +149,39 @@
* gawkworkflow.texi: Add an additional web resource.
* gawktexi.in: More edits in sample programs chapter.
+2020-11-20 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): Correct the description of what
+ happens with infinity. Thanks to Antonio Columbo for pointing
+ out the problem.
+
2020-11-16 Arnold D. Robbins <arnold@skeeve.com>
* gawktexi.in (Nextfile Statement): Clarify what happens in
a BEGINFILE rule.
* gawktexi.in: Additional small fixes.
+2020-11-15 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): Add test programs inside
+ @ignore; extracted to example directory.
+
+2020-11-09 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in: Samll improvement in strange numbers section.
+
+2020-11-04 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Strange values): New section on NaN and infinity.
+ Update some other bits to point to it.
+ * wordlist: Updated with more words.
+
+2020-11-16 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawktexi.in (Nextfile Statement): Clarify what happens in
+ a BEGINFILE rule.
+>>>>>>> master
+
2020-10-31 Arnold D. Robbins <arnold@skeeve.com>
* texinfo.tex: Updated from GNULIB.
diff --git a/doc/awkcard.in b/doc/awkcard.in
index 7cf90cc7..659a4a72 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -2,7 +2,7 @@
.\"
.\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
.\" 2005, 2007, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018,
-.\" 2019, 2020
+.\" 2019, 2020, 2021
.\" Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
@@ -100,7 +100,7 @@ Variables 5\*(CX
\*(CD
.SL
.nf
-\*(FRCopyright \(co 1996\(en2005, 2007, 2009\(en2020
+\*(FRCopyright \(co 1996\(en2005, 2007, 2009\(en2021
Free Software Foundation, Inc.
.nf
.BT
@@ -1916,6 +1916,19 @@ See the manual for details.\*(CB
.EB "\s+2\f(HBDYNAMIC EXTENSIONS (\*(GK\f(HB)\*(FR\s0"
.BT
+.\" --- Generator Functions
+.ES
+.fi
+.in +.2i
+.ti -.2i
+\*(CD\*(FCmkbool(\*(FIexpression\*(FC)\*(FR
+.br
+Return a Boolean-typed value based on the Boolean value
+of \*(FIexpression\fP. True values have a numeric value of one.
+False values have a numeric value of zero.\*(CB
+.in -.2i
+.EB "\s+2\f(HBGENERATOR FUNCTIONS (\*(GK\f(HB)\*(FR\s0"
+.sp .5
.\" --- Type Functions
.ES
.fi
@@ -1959,11 +1972,6 @@ Return the translation of \*(FIstring\*(FR in text domain
\*(FIdomain\*(FR for locale category \*(FIcategory\*(FR.
The default value for \*(FIdomain\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR.
The default value for \*(FIcategory\*(FR is \*(FC"LC_MESSAGES"\*(FR.
-.sp .5
-If you supply a value for \*(FIcategory\*(FR, it must be a string equal to
-one of the known locale categories.
-You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR
-to use the current domain.
.ti -.2i
\*(FCdcngettext(\*(FIstring1\*(FC, \*(FIstring2\*(FC, \*(FInumber\*(FR [\*(FC, \*(FIdom \*(FR[\*(FC, \*(FIcat\*(FR]]\*(FC)\*(FR
.br
@@ -1971,12 +1979,7 @@ Return the plural form used for \*(FInumber\*(FR of the translation of
\*(FIstring1\*(FR and \*(FIstring2\*(FR in text domain
\*(FIdom\*(FR for locale category \*(FIcat\*(FR.
The default value for \*(FIdom\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR.
-The default for \*(FIcat\*(FR is \*(FC"LC_MESSAGES"\*(FR.
-.sp .5
-If you supply a value for \*(FIcat\*(FR, it must be a string equal to
-one of the known locale categories.
-You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR
-to use the current domain.\*(CB
+The default for \*(FIcat\*(FR is \*(FC"LC_MESSAGES"\*(FR.\*(CB
.in -.2i
.EB "\s+2\f(HBINTERNATIONALIZATION (\*(GK\f(HB)\*(FR\s0"
.sp .5
@@ -2012,7 +2015,7 @@ maintains it.\*(CX
.ES
.fi
\*(CDCopyright \(co 1996\(en2005,
-2007, 2009\(en2020 Free Software Foundation, Inc.
+2007, 2009\(en2021 Free Software Foundation, Inc.
.sp .5
Permission is granted to make and distribute verbatim copies of this
reference card provided the copyright notice and this permission notice
diff --git a/doc/gawk.1 b/doc/gawk.1
index a8cf39f6..6c72a887 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Aug 31 2020" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "May 30 2021" "Free Software Foundation" "Utility Commands"
.SH NAME
gawk \- pattern scanning and processing language
.SH SYNOPSIS
@@ -3480,6 +3480,16 @@ in \*(EP.
You must also supply a text domain. Use
.B TEXTDOMAIN
if you want to use the current domain.
+.SS Boolean Valued Functions
+You can create special Boolean-typed values; see the manual for how
+they work and why they exist.
+.TP
+.BI mkbool( expression\^ )
+Based on the boolean value of
+.I expression
+return either a true value or a false value.
+True values have numeric value one.
+False values have numeric value zero.
.SH USER-DEFINED FUNCTIONS
Functions in \*(AK are defined as follows:
.PP
@@ -4265,7 +4275,7 @@ 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,
+2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
diff --git a/doc/gawk.info b/doc/gawk.info
index ea5ff5b4..33a8326e 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -381,6 +381,8 @@ in (a) below. A copy of the license is included in the section entitled
* Arrays Summary:: Summary of arrays.
* Built-in:: Summarizes the built-in functions.
* Calling Built-in:: How to call built-in functions.
+* Boolean Functions:: A function that returns Boolean
+ values.
* Numeric Functions:: Functions that work with numbers,
including 'int()', 'sin()'
and 'rand()'.
@@ -488,6 +490,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 'bool' type.
* Array Sorting:: Facilities for controlling array
traversal and sorting arrays.
* Controlling Array Traversal:: How to use PROCINFO["sorted_in"].
@@ -551,6 +554,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.
@@ -3219,7 +3223,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
@@ -6970,8 +6976,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
@@ -12779,6 +12785,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
@@ -12791,7 +12798,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
--------------------------------
@@ -12835,9 +12842,24 @@ six, and then 12, and 'atan2()' is called with the two arguments six and
10, then 11, and 'atan2()' is called with the two arguments 11 and 10.

-File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Calling Built-in, Up: Built-in
+File: gawk.info, Node: Boolean Functions, Next: Numeric Functions, Prev: Calling Built-in, Up: Built-in
-9.1.2 Numeric Functions
+9.1.2 Generating Boolean Values
+-------------------------------
+
+This function is specific to 'gawk'. It is not available in
+compatibility mode (*note Options::):
+
+'mkbool(EXPRESSION)'
+ Return a Boolean-typed value based on the regular Boolean value of
+ EXPRESSION. Boolean "true" values have numeric value one. Boolean
+ "false" values have numeric zero. This is discussed in more detail
+ in *note Boolean Typed Values::.
+
+
+File: gawk.info, Node: Numeric Functions, Next: String Functions, Prev: Boolean Functions, Up: Built-in
+
+9.1.3 Numeric Functions
-----------------------
The following list describes all of the built-in functions that work
@@ -12863,7 +12885,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()'
@@ -12961,7 +12983,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
@@ -13529,7 +13551,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.
@@ -13675,7 +13697,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
@@ -13892,7 +13914,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
@@ -14209,7 +14231,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.
@@ -14391,7 +14413,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
@@ -14415,6 +14437,9 @@ contexts.
'"number"'
X is a number.
+ '"number|bool"'
+ X is a Boolean typed value (*note Boolean Typed Values::).
+
'"string"'
X is a string.
@@ -14476,7 +14501,7 @@ arguments from untyped to unassigned.

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
@@ -15155,7 +15180,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
@@ -20870,6 +20895,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.
@@ -20879,7 +20905,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
===================================
@@ -20922,9 +20948,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).)
-12.2 Controlling Array Traversal and Array Sorting
+ 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 'bool()'.
+
+ The 'typeof()' function (*note Type Functions::) returns
+'"number|bool"' for these values.
+
+ Thus Boolean-typed values _are_ numbers as far as 'gawk' is
+concerned, except that extension code can treat them as Booleans if
+desired.
+
+ While it would have been possible to add two new built-in variables
+of Boolean type named 'TRUE' and 'FALSE', doing so would undoubtedly
+have broken many existing 'awk' programs. Instead, having a "generator"
+function that creates Boolean values gives flexibility, without breaking
+as much existing code.
+
+
+File: gawk.info, Node: Array Sorting, Next: Two-way I/O, Prev: Boolean Typed Values, Up: Advanced Features
+
+12.3 Controlling Array Traversal and Array Sorting
==================================================
'gawk' lets you control the order in which a 'for (INDX in ARRAY)' loop
@@ -20943,7 +21013,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
@@ -21182,7 +21252,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
@@ -21322,7 +21392,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
@@ -21517,7 +21587,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':
@@ -21597,7 +21667,7 @@ complete introduction and discussion, as well as extensive examples.

File: gawk.info, Node: Profiling, Next: Extension Philosophy, Prev: TCP/IP Networking, Up: Advanced Features
-12.5 Profiling Your 'awk' Programs
+12.6 Profiling Your 'awk' Programs
==================================
You may produce execution traces of your 'awk' programs. This is done
@@ -21859,7 +21929,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
@@ -21895,7 +21965,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
@@ -24246,18 +24316,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.
@@ -24316,11 +24378,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
@@ -24413,6 +24470,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
@@ -24477,7 +24535,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
..........................
@@ -24525,6 +24583,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
@@ -25471,7 +25587,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'.
@@ -25484,6 +25601,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
@@ -25499,6 +25617,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.
@@ -25809,6 +25928,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
@@ -26534,16 +26658,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
@@ -33122,8 +33247,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
@@ -35280,6 +35405,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)
@@ -36868,6 +36994,7 @@ Index
* metacharacters, escape sequences for: Escape Sequences. (line 140)
* metacharacters, in regular expressions: Regexp Operators. (line 6)
* minimum precision required by MPFR library: Auto-set. (line 279)
+* mkbool: Boolean Functions. (line 10)
* mktime: Time Functions. (line 25)
* modifiers, in format specifiers: Format Modifiers. (line 6)
* module, definition of: Global Namespace. (line 18)
@@ -38086,603 +38213,606 @@ Index

Tag Table:
Node: Top1200
-Node: Foreword344780
-Node: Foreword449222
-Node: Preface50754
-Ref: Preface-Footnote-153613
-Ref: Preface-Footnote-253722
-Ref: Preface-Footnote-353956
-Node: History54098
-Node: Names56450
-Ref: Names-Footnote-157554
-Node: This Manual57701
-Ref: This Manual-Footnote-164340
-Node: Conventions64440
-Node: Manual History66809
-Ref: Manual History-Footnote-169806
-Ref: Manual History-Footnote-269847
-Node: How To Contribute69921
-Node: Acknowledgments70847
-Node: Getting Started75784
-Node: Running gawk78223
-Node: One-shot79413
-Node: Read Terminal80676
-Node: Long82669
-Node: Executable Scripts84182
-Ref: Executable Scripts-Footnote-186815
-Node: Comments86918
-Node: Quoting89402
-Node: DOS Quoting94928
-Node: Sample Data Files96984
-Node: Very Simple99579
-Node: Two Rules105681
-Node: More Complex107566
-Node: Statements/Lines109898
-Ref: Statements/Lines-Footnote-1114382
-Node: Other Features114647
-Node: When115583
-Ref: When-Footnote-1117337
-Node: Intro Summary117402
-Node: Invoking Gawk118286
-Node: Command Line119800
-Node: Options120598
-Ref: Options-Footnote-1138512
-Ref: Options-Footnote-2138743
-Node: Other Arguments138768
-Node: Naming Standard Input142779
-Node: Environment Variables143989
-Node: AWKPATH Variable144547
-Ref: AWKPATH Variable-Footnote-1147959
-Ref: AWKPATH Variable-Footnote-2147993
-Node: AWKLIBPATH Variable148364
-Ref: AWKLIBPATH Variable-Footnote-1150061
-Node: Other Environment Variables150436
-Node: Exit Status154257
-Node: Include Files154934
-Node: Loading Shared Libraries158624
-Node: Obsolete160052
-Node: Undocumented160744
-Node: Invoking Summary161041
-Node: Regexp163882
-Node: Regexp Usage165336
-Node: Escape Sequences167373
-Node: Regexp Operators173614
-Node: Regexp Operator Details174099
-Ref: Regexp Operator Details-Footnote-1181463
-Node: Interval Expressions181610
-Ref: Interval Expressions-Footnote-1183031
-Node: Bracket Expressions183129
-Ref: table-char-classes185605
-Node: Leftmost Longest188931
-Node: Computed Regexps190234
-Node: GNU Regexp Operators193661
-Node: Case-sensitivity197398
-Ref: Case-sensitivity-Footnote-1200264
-Ref: Case-sensitivity-Footnote-2200499
-Node: Regexp Summary200607
-Node: Reading Files202073
-Node: Records204342
-Node: awk split records205417
-Node: gawk split records210117
-Ref: gawk split records-Footnote-1215191
-Node: Fields215228
-Node: Nonconstant Fields217969
-Ref: Nonconstant Fields-Footnote-1220205
-Node: Changing Fields220409
-Node: Field Separators226440
-Node: Default Field Splitting229138
-Node: Regexp Field Splitting230256
-Node: Single Character Fields233933
-Node: Command Line Field Separator234993
-Node: Full Line Fields238211
-Ref: Full Line Fields-Footnote-1239733
-Ref: Full Line Fields-Footnote-2239779
-Node: Field Splitting Summary239880
-Node: Constant Size241954
-Node: Fixed width data242686
-Node: Skipping intervening246153
-Node: Allowing trailing data246951
-Node: Fields with fixed data247988
-Node: Splitting By Content249506
-Ref: Splitting By Content-Footnote-1253289
-Node: More CSV253452
-Node: Testing field creation255044
-Node: Multiple Line256669
-Node: Getline262946
-Node: Plain Getline265415
-Node: Getline/Variable267988
-Node: Getline/File269139
-Node: Getline/Variable/File270527
-Ref: Getline/Variable/File-Footnote-1272132
-Node: Getline/Pipe272220
-Node: Getline/Variable/Pipe274924
-Node: Getline/Coprocess276059
-Node: Getline/Variable/Coprocess277326
-Node: Getline Notes278068
-Node: Getline Summary280865
-Ref: table-getline-variants281289
-Node: Read Timeout282037
-Ref: Read Timeout-Footnote-1285943
-Node: Retrying Input286001
-Node: Command-line directories287200
-Node: Input Summary288106
-Node: Input Exercises291278
-Node: Printing291712
-Node: Print293546
-Node: Print Examples295003
-Node: Output Separators297783
-Node: OFMT299800
-Node: Printf301156
-Node: Basic Printf301941
-Node: Control Letters303515
-Node: Format Modifiers308679
-Node: Printf Examples314694
-Node: Redirection317180
-Node: Special FD324021
-Ref: Special FD-Footnote-1327189
-Node: Special Files327263
-Node: Other Inherited Files327880
-Node: Special Network328881
-Node: Special Caveats329741
-Node: Close Files And Pipes330690
-Ref: table-close-pipe-return-values337597
-Ref: Close Files And Pipes-Footnote-1338410
-Ref: Close Files And Pipes-Footnote-2338558
-Node: Nonfatal338710
-Node: Output Summary341048
-Node: Output Exercises342270
-Node: Expressions342949
-Node: Values344137
-Node: Constants344815
-Node: Scalar Constants345506
-Ref: Scalar Constants-Footnote-1348016
-Node: Nondecimal-numbers348266
-Node: Regexp Constants351267
-Node: Using Constant Regexps351793
-Node: Standard Regexp Constants352415
-Node: Strong Regexp Constants355603
-Node: Variables358615
-Node: Using Variables359272
-Node: Assignment Options361182
-Node: Conversion363653
-Node: Strings And Numbers364177
-Ref: Strings And Numbers-Footnote-1367240
-Node: Locale influences conversions367349
-Ref: table-locale-affects370107
-Node: All Operators370725
-Node: Arithmetic Ops371354
-Node: Concatenation374070
-Ref: Concatenation-Footnote-1376917
-Node: Assignment Ops377024
-Ref: table-assign-ops382015
-Node: Increment Ops383328
-Node: Truth Values and Conditions386788
-Node: Truth Values387862
-Node: Typing and Comparison388910
-Node: Variable Typing389730
-Ref: Variable Typing-Footnote-1396193
-Ref: Variable Typing-Footnote-2396265
-Node: Comparison Operators396342
-Ref: table-relational-ops396761
-Node: POSIX String Comparison400256
-Ref: POSIX String Comparison-Footnote-1401951
-Ref: POSIX String Comparison-Footnote-2402090
-Node: Boolean Ops402174
-Ref: Boolean Ops-Footnote-1406656
-Node: Conditional Exp406748
-Node: Function Calls408484
-Node: Precedence412361
-Node: Locales416020
-Node: Expressions Summary417652
-Node: Patterns and Actions420225
-Node: Pattern Overview421345
-Node: Regexp Patterns423022
-Node: Expression Patterns423564
-Node: Ranges427345
-Node: BEGIN/END430453
-Node: Using BEGIN/END431214
-Ref: Using BEGIN/END-Footnote-1433968
-Node: I/O And BEGIN/END434074
-Node: BEGINFILE/ENDFILE436387
-Node: Empty439618
-Node: Using Shell Variables439935
-Node: Action Overview442209
-Node: Statements444534
-Node: If Statement446382
-Node: While Statement447877
-Node: Do Statement449905
-Node: For Statement451053
-Node: Switch Statement454224
-Node: Break Statement456665
-Node: Continue Statement458757
-Node: Next Statement460584
-Node: Nextfile Statement462967
-Node: Exit Statement465656
-Node: Built-in Variables468059
-Node: User-modified469192
-Node: Auto-set476959
-Ref: Auto-set-Footnote-1493766
-Ref: Auto-set-Footnote-2493972
-Node: ARGC and ARGV494028
-Node: Pattern Action Summary498241
-Node: Arrays500671
-Node: Array Basics502000
-Node: Array Intro502844
-Ref: figure-array-elements504819
-Ref: Array Intro-Footnote-1507523
-Node: Reference to Elements507651
-Node: Assigning Elements510115
-Node: Array Example510606
-Node: Scanning an Array512365
-Node: Controlling Scanning515387
-Ref: Controlling Scanning-Footnote-1521843
-Node: Numeric Array Subscripts522159
-Node: Uninitialized Subscripts524343
-Node: Delete525962
-Ref: Delete-Footnote-1528714
-Node: Multidimensional528771
-Node: Multiscanning531866
-Node: Arrays of Arrays533457
-Node: Arrays Summary538225
-Node: Functions540318
-Node: Built-in541356
-Node: Calling Built-in542437
-Node: Numeric Functions544433
-Ref: Numeric Functions-Footnote-1548461
-Ref: Numeric Functions-Footnote-2549109
-Ref: Numeric Functions-Footnote-3549157
-Node: String Functions549429
-Ref: String Functions-Footnote-1573570
-Ref: String Functions-Footnote-2573698
-Ref: String Functions-Footnote-3573946
-Node: Gory Details574033
-Ref: table-sub-escapes575824
-Ref: table-sub-proposed577343
-Ref: table-posix-sub578706
-Ref: table-gensub-escapes580247
-Ref: Gory Details-Footnote-1581070
-Node: I/O Functions581224
-Ref: table-system-return-values587678
-Ref: I/O Functions-Footnote-1589758
-Ref: I/O Functions-Footnote-2589906
-Node: Time Functions590026
-Ref: Time Functions-Footnote-1600697
-Ref: Time Functions-Footnote-2600765
-Ref: Time Functions-Footnote-3600923
-Ref: Time Functions-Footnote-4601034
-Ref: Time Functions-Footnote-5601146
-Ref: Time Functions-Footnote-6601373
-Node: Bitwise Functions601639
-Ref: table-bitwise-ops602233
-Ref: Bitwise Functions-Footnote-1608296
-Ref: Bitwise Functions-Footnote-2608469
-Node: Type Functions608660
-Node: I18N Functions611523
-Node: User-defined613174
-Node: Definition Syntax613986
-Ref: Definition Syntax-Footnote-1619680
-Node: Function Example619751
-Ref: Function Example-Footnote-1622673
-Node: Function Calling622695
-Node: Calling A Function623283
-Node: Variable Scope624241
-Node: Pass By Value/Reference627235
-Node: Function Caveats629879
-Ref: Function Caveats-Footnote-1631926
-Node: Return Statement632046
-Node: Dynamic Typing635025
-Node: Indirect Calls635955
-Ref: Indirect Calls-Footnote-1646207
-Node: Functions Summary646335
-Node: Library Functions649040
-Ref: Library Functions-Footnote-1652647
-Ref: Library Functions-Footnote-2652790
-Node: Library Names652961
-Ref: Library Names-Footnote-1656628
-Ref: Library Names-Footnote-2656851
-Node: General Functions656937
-Node: Strtonum Function658040
-Node: Assert Function661062
-Node: Round Function664388
-Node: Cliff Random Function665928
-Node: Ordinal Functions666944
-Ref: Ordinal Functions-Footnote-1670007
-Ref: Ordinal Functions-Footnote-2670259
-Node: Join Function670469
-Ref: Join Function-Footnote-1672239
-Node: Getlocaltime Function672439
-Node: Readfile Function676181
-Node: Shell Quoting678158
-Node: Data File Management679559
-Node: Filetrans Function680191
-Node: Rewind Function684287
-Node: File Checking686196
-Ref: File Checking-Footnote-1687530
-Node: Empty Files687731
-Node: Ignoring Assigns689710
-Node: Getopt Function691260
-Ref: Getopt Function-Footnote-1706471
-Node: Passwd Functions706671
-Ref: Passwd Functions-Footnote-1715510
-Node: Group Functions715598
-Ref: Group Functions-Footnote-1723496
-Node: Walking Arrays723703
-Node: Library Functions Summary726711
-Node: Library Exercises728117
-Node: Sample Programs728582
-Node: Running Examples729352
-Node: Clones730080
-Node: Cut Program731304
-Node: Egrep Program741444
-Node: Id Program750445
-Node: Split Program760392
-Ref: Split Program-Footnote-1770282
-Node: Tee Program770455
-Node: Uniq Program773245
-Node: Wc Program780833
-Node: Bytes vs. Characters781220
-Node: Using extensions782768
-Node: wc program783522
-Node: Miscellaneous Programs788387
-Node: Dupword Program789600
-Node: Alarm Program791630
-Node: Translate Program796485
-Ref: Translate Program-Footnote-1801050
-Node: Labels Program801320
-Ref: Labels Program-Footnote-1804671
-Node: Word Sorting804755
-Node: History Sorting808827
-Node: Extract Program811052
-Node: Simple Sed819106
-Node: Igawk Program822180
-Ref: Igawk Program-Footnote-1836511
-Ref: Igawk Program-Footnote-2836713
-Ref: Igawk Program-Footnote-3836835
-Node: Anagram Program836950
-Node: Signature Program840012
-Node: Programs Summary841259
-Node: Programs Exercises842473
-Ref: Programs Exercises-Footnote-1846603
-Node: Advanced Features846689
-Node: Nondecimal Data848756
-Node: Array Sorting850347
-Node: Controlling Array Traversal851047
-Ref: Controlling Array Traversal-Footnote-1859415
-Node: Array Sorting Functions859533
-Ref: Array Sorting Functions-Footnote-1864624
-Node: Two-way I/O864820
-Ref: Two-way I/O-Footnote-1872541
-Ref: Two-way I/O-Footnote-2872728
-Node: TCP/IP Networking872810
-Node: Profiling875928
-Node: Extension Philosophy885237
-Node: Advanced Features Summary886716
-Node: Internationalization888731
-Node: I18N and L10N890211
-Node: Explaining gettext890898
-Ref: Explaining gettext-Footnote-1896790
-Ref: Explaining gettext-Footnote-2896975
-Node: Programmer i18n897140
-Ref: Programmer i18n-Footnote-1902089
-Node: Translator i18n902138
-Node: String Extraction902932
-Ref: String Extraction-Footnote-1904064
-Node: Printf Ordering904150
-Ref: Printf Ordering-Footnote-1906936
-Node: I18N Portability907000
-Ref: I18N Portability-Footnote-1909456
-Node: I18N Example909519
-Ref: I18N Example-Footnote-1912794
-Ref: I18N Example-Footnote-2912867
-Node: Gawk I18N912976
-Node: I18N Summary913625
-Node: Debugger914966
-Node: Debugging915966
-Node: Debugging Concepts916407
-Node: Debugging Terms918216
-Node: Awk Debugging920791
-Ref: Awk Debugging-Footnote-1921736
-Node: Sample Debugging Session921868
-Node: Debugger Invocation922402
-Node: Finding The Bug923788
-Node: List of Debugger Commands930262
-Node: Breakpoint Control931595
-Node: Debugger Execution Control935289
-Node: Viewing And Changing Data938651
-Node: Execution Stack942192
-Node: Debugger Info943829
-Node: Miscellaneous Debugger Commands947900
-Node: Readline Support952962
-Node: Limitations953858
-Node: Debugging Summary956412
-Node: Namespaces957691
-Node: Global Namespace958802
-Node: Qualified Names960200
-Node: Default Namespace961199
-Node: Changing The Namespace961940
-Node: Naming Rules963554
-Node: Internal Name Management965402
-Node: Namespace Example966444
-Node: Namespace And Features969006
-Node: Namespace Summary970441
-Node: Arbitrary Precision Arithmetic971918
-Node: Computer Arithmetic973405
-Ref: table-numeric-ranges977171
-Ref: table-floating-point-ranges977664
-Ref: Computer Arithmetic-Footnote-1978322
-Node: Math Definitions978379
-Ref: table-ieee-formats981695
-Ref: Math Definitions-Footnote-1982298
-Node: MPFR features982403
-Node: FP Math Caution984121
-Ref: FP Math Caution-Footnote-1985193
-Node: Inexactness of computations985562
-Node: Inexact representation986522
-Node: Comparing FP Values987882
-Node: Errors accumulate989123
-Node: Getting Accuracy990556
-Node: Try To Round993266
-Node: Setting precision994165
-Ref: table-predefined-precision-strings994862
-Node: Setting the rounding mode996692
-Ref: table-gawk-rounding-modes997066
-Ref: Setting the rounding mode-Footnote-11000997
-Node: Arbitrary Precision Integers1001176
-Ref: Arbitrary Precision Integers-Footnote-11004351
-Node: Checking for MPFR1004500
-Node: POSIX Floating Point Problems1005974
-Ref: POSIX Floating Point Problems-Footnote-11010259
-Node: Floating point summary1010297
-Node: Dynamic Extensions1012487
-Node: Extension Intro1014040
-Node: Plugin License1015306
-Node: Extension Mechanism Outline1016103
-Ref: figure-load-extension1016542
-Ref: figure-register-new-function1018107
-Ref: figure-call-new-function1019199
-Node: Extension API Description1021261
-Node: Extension API Functions Introduction1022974
-Ref: table-api-std-headers1024810
-Node: General Data Types1029059
-Ref: General Data Types-Footnote-11037689
-Node: Memory Allocation Functions1037988
-Ref: Memory Allocation Functions-Footnote-11042489
-Node: Constructor Functions1042588
-Node: API Ownership of MPFR and GMP Values1046054
-Node: Registration Functions1047367
-Node: Extension Functions1048067
-Node: Exit Callback Functions1053389
-Node: Extension Version String1054639
-Node: Input Parsers1055302
-Node: Output Wrappers1068023
-Node: Two-way processors1072535
-Node: Printing Messages1074800
-Ref: Printing Messages-Footnote-11075971
-Node: Updating ERRNO1076124
-Node: Requesting Values1076863
-Ref: table-value-types-returned1077600
-Node: Accessing Parameters1078536
-Node: Symbol Table Access1079773
-Node: Symbol table by name1080285
-Ref: Symbol table by name-Footnote-11083309
-Node: Symbol table by cookie1083437
-Ref: Symbol table by cookie-Footnote-11087622
-Node: Cached values1087686
-Ref: Cached values-Footnote-11091222
-Node: Array Manipulation1091375
-Ref: Array Manipulation-Footnote-11092466
-Node: Array Data Types1092503
-Ref: Array Data Types-Footnote-11095161
-Node: Array Functions1095253
-Node: Flattening Arrays1099751
-Node: Creating Arrays1106727
-Node: Redirection API1111494
-Node: Extension API Variables1114327
-Node: Extension Versioning1115038
-Ref: gawk-api-version1115467
-Node: Extension GMP/MPFR Versioning1117198
-Node: Extension API Informational Variables1118826
-Node: Extension API Boilerplate1119899
-Node: Changes from API V11123873
-Node: Finding Extensions1125445
-Node: Extension Example1126004
-Node: Internal File Description1126802
-Node: Internal File Ops1130882
-Ref: Internal File Ops-Footnote-11142232
-Node: Using Internal File Ops1142372
-Ref: Using Internal File Ops-Footnote-11144755
-Node: Extension Samples1145029
-Node: Extension Sample File Functions1146558
-Node: Extension Sample Fnmatch1154207
-Node: Extension Sample Fork1155694
-Node: Extension Sample Inplace1156912
-Node: Extension Sample Ord1160538
-Node: Extension Sample Readdir1161374
-Ref: table-readdir-file-types1162263
-Node: Extension Sample Revout1163330
-Node: Extension Sample Rev2way1163919
-Node: Extension Sample Read write array1164659
-Node: Extension Sample Readfile1166601
-Node: Extension Sample Time1167696
-Node: Extension Sample API Tests1169448
-Node: gawkextlib1169940
-Node: Extension summary1172858
-Node: Extension Exercises1176560
-Node: Language History1177802
-Node: V7/SVR3.11179458
-Node: SVR41181610
-Node: POSIX1183044
-Node: BTL1184425
-Node: POSIX/GNU1185154
-Node: Feature History1190932
-Node: Common Extensions1208013
-Node: Ranges and Locales1209296
-Ref: Ranges and Locales-Footnote-11213912
-Ref: Ranges and Locales-Footnote-21213939
-Ref: Ranges and Locales-Footnote-31214174
-Node: Contributors1214397
-Node: History summary1220394
-Node: Installation1221774
-Node: Gawk Distribution1222718
-Node: Getting1223202
-Node: Extracting1224165
-Node: Distribution contents1225803
-Node: Unix Installation1232283
-Node: Quick Installation1232965
-Node: Shell Startup Files1235379
-Node: Additional Configuration Options1236468
-Node: Configuration Philosophy1238783
-Node: Non-Unix Installation1241152
-Node: PC Installation1241612
-Node: PC Binary Installation1242450
-Node: PC Compiling1242885
-Node: PC Using1244002
-Node: Cygwin1247555
-Node: MSYS1248779
-Node: VMS Installation1249381
-Node: VMS Compilation1250172
-Ref: VMS Compilation-Footnote-11251401
-Node: VMS Dynamic Extensions1251459
-Node: VMS Installation Details1253144
-Node: VMS Running1255397
-Node: VMS GNV1259676
-Node: VMS Old Gawk1260411
-Node: Bugs1260882
-Node: Bug address1261545
-Node: Usenet1264527
-Node: Maintainers1265531
-Node: Other Versions1266716
-Node: Installation summary1274581
-Node: Notes1275790
-Node: Compatibility Mode1276584
-Node: Additions1277366
-Node: Accessing The Source1278291
-Node: Adding Code1279728
-Node: New Ports1285947
-Node: Derived Files1290322
-Ref: Derived Files-Footnote-11295982
-Ref: Derived Files-Footnote-21296017
-Ref: Derived Files-Footnote-31296615
-Node: Future Extensions1296729
-Node: Implementation Limitations1297387
-Node: Extension Design1298597
-Node: Old Extension Problems1299741
-Ref: Old Extension Problems-Footnote-11301259
-Node: Extension New Mechanism Goals1301316
-Ref: Extension New Mechanism Goals-Footnote-11304680
-Node: Extension Other Design Decisions1304869
-Node: Extension Future Growth1306982
-Node: Notes summary1307588
-Node: Basic Concepts1308746
-Node: Basic High Level1309427
-Ref: figure-general-flow1309709
-Ref: figure-process-flow1310394
-Ref: Basic High Level-Footnote-11313695
-Node: Basic Data Typing1313880
-Node: Glossary1317208
-Node: Copying1349093
-Node: GNU Free Documentation License1386636
-Node: Index1411756
+Node: Foreword345044
+Node: Foreword449486
+Node: Preface51018
+Ref: Preface-Footnote-153877
+Ref: Preface-Footnote-253986
+Ref: Preface-Footnote-354220
+Node: History54362
+Node: Names56714
+Ref: Names-Footnote-157818
+Node: This Manual57965
+Ref: This Manual-Footnote-164604
+Node: Conventions64704
+Node: Manual History67073
+Ref: Manual History-Footnote-170070
+Ref: Manual History-Footnote-270111
+Node: How To Contribute70185
+Node: Acknowledgments71111
+Node: Getting Started76048
+Node: Running gawk78487
+Node: One-shot79677
+Node: Read Terminal80940
+Node: Long82933
+Node: Executable Scripts84446
+Ref: Executable Scripts-Footnote-187079
+Node: Comments87182
+Node: Quoting89666
+Node: DOS Quoting95192
+Node: Sample Data Files97248
+Node: Very Simple99843
+Node: Two Rules105945
+Node: More Complex107830
+Node: Statements/Lines110162
+Ref: Statements/Lines-Footnote-1114646
+Node: Other Features114911
+Node: When115847
+Ref: When-Footnote-1117601
+Node: Intro Summary117666
+Node: Invoking Gawk118550
+Node: Command Line120064
+Node: Options120862
+Ref: Options-Footnote-1138776
+Ref: Options-Footnote-2139007
+Node: Other Arguments139032
+Node: Naming Standard Input143043
+Node: Environment Variables144253
+Node: AWKPATH Variable144811
+Ref: AWKPATH Variable-Footnote-1148223
+Ref: AWKPATH Variable-Footnote-2148257
+Node: AWKLIBPATH Variable148628
+Ref: AWKLIBPATH Variable-Footnote-1150325
+Node: Other Environment Variables150700
+Node: Exit Status154652
+Node: Include Files155329
+Node: Loading Shared Libraries159019
+Node: Obsolete160447
+Node: Undocumented161139
+Node: Invoking Summary161436
+Node: Regexp164277
+Node: Regexp Usage165731
+Node: Escape Sequences167768
+Node: Regexp Operators174009
+Node: Regexp Operator Details174494
+Ref: Regexp Operator Details-Footnote-1181858
+Node: Interval Expressions182005
+Ref: Interval Expressions-Footnote-1183426
+Node: Bracket Expressions183524
+Ref: table-char-classes186000
+Node: Leftmost Longest189326
+Node: Computed Regexps190629
+Node: GNU Regexp Operators194056
+Node: Case-sensitivity197793
+Ref: Case-sensitivity-Footnote-1200659
+Ref: Case-sensitivity-Footnote-2200894
+Node: Regexp Summary201002
+Node: Reading Files202468
+Node: Records204737
+Node: awk split records205812
+Node: gawk split records210512
+Ref: gawk split records-Footnote-1215586
+Node: Fields215623
+Node: Nonconstant Fields218364
+Ref: Nonconstant Fields-Footnote-1220600
+Node: Changing Fields220804
+Node: Field Separators226835
+Node: Default Field Splitting229533
+Node: Regexp Field Splitting230651
+Node: Single Character Fields234328
+Node: Command Line Field Separator235388
+Node: Full Line Fields238606
+Ref: Full Line Fields-Footnote-1240128
+Ref: Full Line Fields-Footnote-2240174
+Node: Field Splitting Summary240275
+Node: Constant Size242349
+Node: Fixed width data243081
+Node: Skipping intervening246548
+Node: Allowing trailing data247346
+Node: Fields with fixed data248383
+Node: Splitting By Content249901
+Ref: Splitting By Content-Footnote-1253684
+Node: More CSV253847
+Node: Testing field creation255439
+Node: Multiple Line257064
+Node: Getline263341
+Node: Plain Getline265810
+Node: Getline/Variable268383
+Node: Getline/File269534
+Node: Getline/Variable/File270922
+Ref: Getline/Variable/File-Footnote-1272527
+Node: Getline/Pipe272615
+Node: Getline/Variable/Pipe275319
+Node: Getline/Coprocess276454
+Node: Getline/Variable/Coprocess277721
+Node: Getline Notes278463
+Node: Getline Summary281260
+Ref: table-getline-variants281684
+Node: Read Timeout282432
+Ref: Read Timeout-Footnote-1286338
+Node: Retrying Input286396
+Node: Command-line directories287595
+Node: Input Summary288501
+Node: Input Exercises291673
+Node: Printing292107
+Node: Print293941
+Node: Print Examples295398
+Node: Output Separators298178
+Node: OFMT300195
+Node: Printf301551
+Node: Basic Printf302336
+Node: Control Letters303910
+Node: Format Modifiers309072
+Node: Printf Examples315087
+Node: Redirection317573
+Node: Special FD324414
+Ref: Special FD-Footnote-1327582
+Node: Special Files327656
+Node: Other Inherited Files328273
+Node: Special Network329274
+Node: Special Caveats330134
+Node: Close Files And Pipes331083
+Ref: table-close-pipe-return-values337990
+Ref: Close Files And Pipes-Footnote-1338803
+Ref: Close Files And Pipes-Footnote-2338951
+Node: Nonfatal339103
+Node: Output Summary341441
+Node: Output Exercises342663
+Node: Expressions343342
+Node: Values344530
+Node: Constants345208
+Node: Scalar Constants345899
+Ref: Scalar Constants-Footnote-1348409
+Node: Nondecimal-numbers348659
+Node: Regexp Constants351660
+Node: Using Constant Regexps352186
+Node: Standard Regexp Constants352808
+Node: Strong Regexp Constants355996
+Node: Variables359008
+Node: Using Variables359665
+Node: Assignment Options361575
+Node: Conversion364046
+Node: Strings And Numbers364570
+Ref: Strings And Numbers-Footnote-1367633
+Node: Locale influences conversions367742
+Ref: table-locale-affects370500
+Node: All Operators371118
+Node: Arithmetic Ops371747
+Node: Concatenation374463
+Ref: Concatenation-Footnote-1377310
+Node: Assignment Ops377417
+Ref: table-assign-ops382408
+Node: Increment Ops383721
+Node: Truth Values and Conditions387181
+Node: Truth Values388255
+Node: Typing and Comparison389303
+Node: Variable Typing390123
+Ref: Variable Typing-Footnote-1396586
+Ref: Variable Typing-Footnote-2396658
+Node: Comparison Operators396735
+Ref: table-relational-ops397154
+Node: POSIX String Comparison400649
+Ref: POSIX String Comparison-Footnote-1402344
+Ref: POSIX String Comparison-Footnote-2402483
+Node: Boolean Ops402567
+Ref: Boolean Ops-Footnote-1407049
+Node: Conditional Exp407141
+Node: Function Calls408877
+Node: Precedence412754
+Node: Locales416413
+Node: Expressions Summary418045
+Node: Patterns and Actions420618
+Node: Pattern Overview421738
+Node: Regexp Patterns423415
+Node: Expression Patterns423957
+Node: Ranges427738
+Node: BEGIN/END430846
+Node: Using BEGIN/END431607
+Ref: Using BEGIN/END-Footnote-1434361
+Node: I/O And BEGIN/END434467
+Node: BEGINFILE/ENDFILE436780
+Node: Empty440011
+Node: Using Shell Variables440328
+Node: Action Overview442602
+Node: Statements444927
+Node: If Statement446775
+Node: While Statement448270
+Node: Do Statement450298
+Node: For Statement451446
+Node: Switch Statement454617
+Node: Break Statement457058
+Node: Continue Statement459150
+Node: Next Statement460977
+Node: Nextfile Statement463360
+Node: Exit Statement466049
+Node: Built-in Variables468452
+Node: User-modified469585
+Node: Auto-set477352
+Ref: Auto-set-Footnote-1494159
+Ref: Auto-set-Footnote-2494365
+Node: ARGC and ARGV494421
+Node: Pattern Action Summary498634
+Node: Arrays501064
+Node: Array Basics502393
+Node: Array Intro503237
+Ref: figure-array-elements505212
+Ref: Array Intro-Footnote-1507916
+Node: Reference to Elements508044
+Node: Assigning Elements510508
+Node: Array Example510999
+Node: Scanning an Array512758
+Node: Controlling Scanning515780
+Ref: Controlling Scanning-Footnote-1522236
+Node: Numeric Array Subscripts522552
+Node: Uninitialized Subscripts524736
+Node: Delete526355
+Ref: Delete-Footnote-1529107
+Node: Multidimensional529164
+Node: Multiscanning532259
+Node: Arrays of Arrays533850
+Node: Arrays Summary538618
+Node: Functions540711
+Node: Built-in541749
+Node: Calling Built-in542902
+Node: Boolean Functions544898
+Node: Numeric Functions545452
+Ref: Numeric Functions-Footnote-1549479
+Ref: Numeric Functions-Footnote-2550127
+Ref: Numeric Functions-Footnote-3550175
+Node: String Functions550447
+Ref: String Functions-Footnote-1574588
+Ref: String Functions-Footnote-2574716
+Ref: String Functions-Footnote-3574964
+Node: Gory Details575051
+Ref: table-sub-escapes576842
+Ref: table-sub-proposed578361
+Ref: table-posix-sub579724
+Ref: table-gensub-escapes581265
+Ref: Gory Details-Footnote-1582088
+Node: I/O Functions582242
+Ref: table-system-return-values588696
+Ref: I/O Functions-Footnote-1590776
+Ref: I/O Functions-Footnote-2590924
+Node: Time Functions591044
+Ref: Time Functions-Footnote-1601715
+Ref: Time Functions-Footnote-2601783
+Ref: Time Functions-Footnote-3601941
+Ref: Time Functions-Footnote-4602052
+Ref: Time Functions-Footnote-5602164
+Ref: Time Functions-Footnote-6602391
+Node: Bitwise Functions602657
+Ref: table-bitwise-ops603251
+Ref: Bitwise Functions-Footnote-1609314
+Ref: Bitwise Functions-Footnote-2609487
+Node: Type Functions609678
+Node: I18N Functions612632
+Node: User-defined614283
+Node: Definition Syntax615095
+Ref: Definition Syntax-Footnote-1620789
+Node: Function Example620860
+Ref: Function Example-Footnote-1623782
+Node: Function Calling623804
+Node: Calling A Function624392
+Node: Variable Scope625350
+Node: Pass By Value/Reference628344
+Node: Function Caveats630988
+Ref: Function Caveats-Footnote-1633035
+Node: Return Statement633155
+Node: Dynamic Typing636134
+Node: Indirect Calls637064
+Ref: Indirect Calls-Footnote-1647319
+Node: Functions Summary647447
+Node: Library Functions650152
+Ref: Library Functions-Footnote-1653759
+Ref: Library Functions-Footnote-2653902
+Node: Library Names654073
+Ref: Library Names-Footnote-1657740
+Ref: Library Names-Footnote-2657963
+Node: General Functions658049
+Node: Strtonum Function659152
+Node: Assert Function662174
+Node: Round Function665500
+Node: Cliff Random Function667040
+Node: Ordinal Functions668056
+Ref: Ordinal Functions-Footnote-1671119
+Ref: Ordinal Functions-Footnote-2671371
+Node: Join Function671581
+Ref: Join Function-Footnote-1673351
+Node: Getlocaltime Function673551
+Node: Readfile Function677293
+Node: Shell Quoting679270
+Node: Data File Management680671
+Node: Filetrans Function681303
+Node: Rewind Function685399
+Node: File Checking687308
+Ref: File Checking-Footnote-1688642
+Node: Empty Files688843
+Node: Ignoring Assigns690822
+Node: Getopt Function692372
+Ref: Getopt Function-Footnote-1707583
+Node: Passwd Functions707783
+Ref: Passwd Functions-Footnote-1716622
+Node: Group Functions716710
+Ref: Group Functions-Footnote-1724608
+Node: Walking Arrays724815
+Node: Library Functions Summary727823
+Node: Library Exercises729229
+Node: Sample Programs729694
+Node: Running Examples730464
+Node: Clones731192
+Node: Cut Program732416
+Node: Egrep Program742556
+Node: Id Program751557
+Node: Split Program761504
+Ref: Split Program-Footnote-1771394
+Node: Tee Program771567
+Node: Uniq Program774357
+Node: Wc Program781945
+Node: Bytes vs. Characters782332
+Node: Using extensions783880
+Node: wc program784634
+Node: Miscellaneous Programs789499
+Node: Dupword Program790712
+Node: Alarm Program792742
+Node: Translate Program797597
+Ref: Translate Program-Footnote-1802162
+Node: Labels Program802432
+Ref: Labels Program-Footnote-1805783
+Node: Word Sorting805867
+Node: History Sorting809939
+Node: Extract Program812164
+Node: Simple Sed820218
+Node: Igawk Program823292
+Ref: Igawk Program-Footnote-1837623
+Ref: Igawk Program-Footnote-2837825
+Ref: Igawk Program-Footnote-3837947
+Node: Anagram Program838062
+Node: Signature Program841124
+Node: Programs Summary842371
+Node: Programs Exercises843585
+Ref: Programs Exercises-Footnote-1847715
+Node: Advanced Features847801
+Node: Nondecimal Data849932
+Node: Boolean Typed Values851530
+Node: Array Sorting853409
+Node: Controlling Array Traversal854114
+Ref: Controlling Array Traversal-Footnote-1862482
+Node: Array Sorting Functions862600
+Ref: Array Sorting Functions-Footnote-1867691
+Node: Two-way I/O867887
+Ref: Two-way I/O-Footnote-1875608
+Ref: Two-way I/O-Footnote-2875795
+Node: TCP/IP Networking875877
+Node: Profiling878995
+Node: Extension Philosophy888304
+Node: Advanced Features Summary889783
+Node: Internationalization891798
+Node: I18N and L10N893278
+Node: Explaining gettext893965
+Ref: Explaining gettext-Footnote-1899857
+Ref: Explaining gettext-Footnote-2900042
+Node: Programmer i18n900207
+Ref: Programmer i18n-Footnote-1905156
+Node: Translator i18n905205
+Node: String Extraction905999
+Ref: String Extraction-Footnote-1907131
+Node: Printf Ordering907217
+Ref: Printf Ordering-Footnote-1910003
+Node: I18N Portability910067
+Ref: I18N Portability-Footnote-1912523
+Node: I18N Example912586
+Ref: I18N Example-Footnote-1915861
+Ref: I18N Example-Footnote-2915934
+Node: Gawk I18N916043
+Node: I18N Summary916692
+Node: Debugger918033
+Node: Debugging919033
+Node: Debugging Concepts919474
+Node: Debugging Terms921283
+Node: Awk Debugging923858
+Ref: Awk Debugging-Footnote-1924803
+Node: Sample Debugging Session924935
+Node: Debugger Invocation925469
+Node: Finding The Bug926855
+Node: List of Debugger Commands933329
+Node: Breakpoint Control934662
+Node: Debugger Execution Control938356
+Node: Viewing And Changing Data941718
+Node: Execution Stack945259
+Node: Debugger Info946896
+Node: Miscellaneous Debugger Commands950967
+Node: Readline Support956029
+Node: Limitations956925
+Node: Debugging Summary959479
+Node: Namespaces960758
+Node: Global Namespace961869
+Node: Qualified Names963267
+Node: Default Namespace964266
+Node: Changing The Namespace965007
+Node: Naming Rules966621
+Node: Internal Name Management968469
+Node: Namespace Example969511
+Node: Namespace And Features972073
+Node: Namespace Summary973508
+Node: Arbitrary Precision Arithmetic974985
+Node: Computer Arithmetic976472
+Ref: table-numeric-ranges980238
+Ref: table-floating-point-ranges980731
+Ref: Computer Arithmetic-Footnote-1981389
+Node: Math Definitions981446
+Ref: table-ieee-formats984422
+Node: MPFR features984989
+Node: FP Math Caution986707
+Ref: FP Math Caution-Footnote-1987779
+Node: Inexactness of computations988148
+Node: Inexact representation989179
+Node: Comparing FP Values990539
+Node: Errors accumulate991780
+Node: Strange values993236
+Ref: Strange values-Footnote-1995824
+Node: Getting Accuracy995929
+Node: Try To Round998639
+Node: Setting precision999538
+Ref: table-predefined-precision-strings1000235
+Node: Setting the rounding mode1002065
+Ref: table-gawk-rounding-modes1002439
+Ref: Setting the rounding mode-Footnote-11006370
+Node: Arbitrary Precision Integers1006549
+Ref: Arbitrary Precision Integers-Footnote-11009724
+Node: Checking for MPFR1009873
+Node: POSIX Floating Point Problems1011347
+Ref: POSIX Floating Point Problems-Footnote-11015632
+Node: Floating point summary1015670
+Node: Dynamic Extensions1017860
+Node: Extension Intro1019413
+Node: Plugin License1020679
+Node: Extension Mechanism Outline1021476
+Ref: figure-load-extension1021915
+Ref: figure-register-new-function1023480
+Ref: figure-call-new-function1024572
+Node: Extension API Description1026634
+Node: Extension API Functions Introduction1028347
+Ref: table-api-std-headers1030183
+Node: General Data Types1034432
+Ref: General Data Types-Footnote-11043138
+Node: Memory Allocation Functions1043437
+Ref: Memory Allocation Functions-Footnote-11047938
+Node: Constructor Functions1048037
+Node: API Ownership of MPFR and GMP Values1051690
+Node: Registration Functions1053003
+Node: Extension Functions1053703
+Node: Exit Callback Functions1059025
+Node: Extension Version String1060275
+Node: Input Parsers1060938
+Node: Output Wrappers1073659
+Node: Two-way processors1078171
+Node: Printing Messages1080436
+Ref: Printing Messages-Footnote-11081607
+Node: Updating ERRNO1081760
+Node: Requesting Values1082499
+Ref: table-value-types-returned1083236
+Node: Accessing Parameters1084344
+Node: Symbol Table Access1085581
+Node: Symbol table by name1086093
+Ref: Symbol table by name-Footnote-11089117
+Node: Symbol table by cookie1089245
+Ref: Symbol table by cookie-Footnote-11093430
+Node: Cached values1093494
+Ref: Cached values-Footnote-11097030
+Node: Array Manipulation1097183
+Ref: Array Manipulation-Footnote-11098274
+Node: Array Data Types1098311
+Ref: Array Data Types-Footnote-11100969
+Node: Array Functions1101061
+Node: Flattening Arrays1105559
+Node: Creating Arrays1112535
+Node: Redirection API1117302
+Node: Extension API Variables1120135
+Node: Extension Versioning1120846
+Ref: gawk-api-version1121275
+Node: Extension GMP/MPFR Versioning1123006
+Node: Extension API Informational Variables1124634
+Node: Extension API Boilerplate1125707
+Node: Changes from API V11129681
+Node: Finding Extensions1131253
+Node: Extension Example1131812
+Node: Internal File Description1132610
+Node: Internal File Ops1136690
+Ref: Internal File Ops-Footnote-11148040
+Node: Using Internal File Ops1148180
+Ref: Using Internal File Ops-Footnote-11150563
+Node: Extension Samples1150837
+Node: Extension Sample File Functions1152366
+Node: Extension Sample Fnmatch1160015
+Node: Extension Sample Fork1161502
+Node: Extension Sample Inplace1162720
+Node: Extension Sample Ord1166346
+Node: Extension Sample Readdir1167182
+Ref: table-readdir-file-types1168071
+Node: Extension Sample Revout1169138
+Node: Extension Sample Rev2way1169727
+Node: Extension Sample Read write array1170467
+Node: Extension Sample Readfile1172409
+Node: Extension Sample Time1173504
+Node: Extension Sample API Tests1175256
+Node: gawkextlib1175748
+Node: Extension summary1178666
+Node: Extension Exercises1182368
+Node: Language History1183610
+Node: V7/SVR3.11185266
+Node: SVR41187418
+Node: POSIX1188852
+Node: BTL1190233
+Node: POSIX/GNU1190962
+Node: Feature History1196740
+Node: Common Extensions1213821
+Node: Ranges and Locales1215104
+Ref: Ranges and Locales-Footnote-11219720
+Ref: Ranges and Locales-Footnote-21219747
+Ref: Ranges and Locales-Footnote-31219982
+Node: Contributors1220205
+Node: History summary1226202
+Node: Installation1227582
+Node: Gawk Distribution1228526
+Node: Getting1229010
+Node: Extracting1229973
+Node: Distribution contents1231611
+Node: Unix Installation1238091
+Node: Quick Installation1238773
+Node: Shell Startup Files1241187
+Node: Additional Configuration Options1242276
+Node: Configuration Philosophy1244591
+Node: Non-Unix Installation1246960
+Node: PC Installation1247420
+Node: PC Binary Installation1248258
+Node: PC Compiling1248693
+Node: PC Using1249810
+Node: Cygwin1253363
+Node: MSYS1254587
+Node: VMS Installation1255189
+Node: VMS Compilation1255980
+Ref: VMS Compilation-Footnote-11257209
+Node: VMS Dynamic Extensions1257267
+Node: VMS Installation Details1258952
+Node: VMS Running1261205
+Node: VMS GNV1265484
+Node: VMS Old Gawk1266219
+Node: Bugs1266690
+Node: Bug address1267353
+Node: Usenet1270335
+Node: Maintainers1271339
+Node: Other Versions1272524
+Node: Installation summary1280389
+Node: Notes1281598
+Node: Compatibility Mode1282392
+Node: Additions1283174
+Node: Accessing The Source1284099
+Node: Adding Code1285536
+Node: New Ports1291755
+Node: Derived Files1296130
+Ref: Derived Files-Footnote-11301790
+Ref: Derived Files-Footnote-21301825
+Ref: Derived Files-Footnote-31302423
+Node: Future Extensions1302537
+Node: Implementation Limitations1303195
+Node: Extension Design1304405
+Node: Old Extension Problems1305549
+Ref: Old Extension Problems-Footnote-11307067
+Node: Extension New Mechanism Goals1307124
+Ref: Extension New Mechanism Goals-Footnote-11310488
+Node: Extension Other Design Decisions1310677
+Node: Extension Future Growth1312790
+Node: Notes summary1313396
+Node: Basic Concepts1314554
+Node: Basic High Level1315235
+Ref: figure-general-flow1315517
+Ref: figure-process-flow1316202
+Ref: Basic High Level-Footnote-11319503
+Node: Basic Data Typing1319688
+Node: Glossary1323016
+Node: Copying1354903
+Node: GNU Free Documentation License1392446
+Node: Index1417566

End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 9caec483..bb891ea3 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -754,6 +754,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()}.
@@ -861,6 +863,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{bool} type.
* Array Sorting:: Facilities for controlling array
traversal and sorting arrays.
* Controlling Array Traversal:: How to use PROCINFO["sorted_in"].
@@ -924,6 +927,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.
@@ -3140,11 +3144,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
@@ -4844,7 +4849,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
@@ -10199,7 +10207,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
@@ -18302,6 +18310,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
@@ -18371,6 +18380,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
@@ -18435,7 +18463,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.
@@ -20893,6 +20921,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.
@@ -21771,7 +21802,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
@@ -29380,6 +29411,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.
@@ -29446,6 +29478,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{bool()}.
+
+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
@@ -33781,21 +33856,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
@@ -33964,6 +34027,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
@@ -34085,6 +34149,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
@@ -35356,7 +35656,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}.
@@ -35369,6 +35670,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.''
@@ -35384,6 +35686,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.
@@ -35711,6 +36014,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
@@ -36511,7 +36819,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>
@@ -36521,6 +36830,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>
@@ -36533,6 +36843,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>
@@ -36545,6 +36856,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>
@@ -36553,6 +36865,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>
@@ -36561,6 +36874,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>
@@ -36568,11 +36882,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>
@@ -36583,6 +36909,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>
@@ -36593,6 +36920,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>
@@ -36605,6 +36933,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>
@@ -36621,43 +36950,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
@@ -44998,8 +45330,8 @@ internationalized program to work in a particular language.
@item Logical Expression
An expression using the operators for logic, AND, OR, and NOT, written
-@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called Boolean
-expressions, after the mathematician who pioneered this kind of
+@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called @dfn{Boolean
+expressions}, after the mathematician who pioneered this kind of
mathematical logic.
@item Lvalue
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 60b1f1c3..c6b8d552 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -749,6 +749,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()}.
@@ -856,6 +858,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"].
@@ -919,6 +922,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.
@@ -3050,11 +3054,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
@@ -4710,7 +4715,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
@@ -9668,7 +9676,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
@@ -17443,6 +17451,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
@@ -17512,6 +17521,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
@@ -17576,7 +17604,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.
@@ -19805,6 +19833,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.
@@ -20683,7 +20714,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
@@ -28262,6 +28293,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.
@@ -28328,6 +28360,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
@@ -32663,21 +32738,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
@@ -32846,6 +32909,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
@@ -32967,6 +33031,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
@@ -34199,7 +34499,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}.
@@ -34212,6 +34513,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.''
@@ -34227,6 +34529,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.
@@ -34554,6 +34857,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
@@ -35354,7 +35662,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>
@@ -35364,6 +35673,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>
@@ -35376,6 +35686,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>
@@ -35388,6 +35699,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>
@@ -35396,6 +35708,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>
@@ -35404,6 +35717,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>
@@ -35411,11 +35725,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>
@@ -35426,6 +35752,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>
@@ -35436,6 +35763,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>
@@ -35448,6 +35776,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>
@@ -35464,43 +35793,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
@@ -43841,8 +44173,8 @@ internationalized program to work in a particular language.
@item Logical Expression
An expression using the operators for logic, AND, OR, and NOT, written
-@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called Boolean
-expressions, after the mathematician who pioneered this kind of
+@samp{&&}, @samp{||}, and @samp{!} in @command{awk}. Often called @dfn{Boolean
+expressions}, after the mathematician who pioneered this kind of
mathematical logic.
@item Lvalue
diff --git a/doc/it/ChangeLog b/doc/it/ChangeLog
index 863eef47..6f031c32 100644
--- a/doc/it/ChangeLog
+++ b/doc/it/ChangeLog
@@ -1,3 +1,54 @@
+2021-05-31 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gawk.1: Updated.
+
+2021-05-28 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * gawk.1: Updated.
+
+2021-05-16 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-04-06 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-04-01 Antonio Giovanni Colombo <azc100@gmail.com>
+ Marco Curreli <marcocurreli@tiscali.it>
+
+ * gawktexi.in: Updated.
+ * gendocs.sh: Added.
+ * gendocs_template: Added.
+ * genera_formati.sh: Added.
+
+2021-03-21 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-03-20 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * texinfo.tex: Updated.
+
+2021-02-01 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2021-01-25 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+ * texinfo.tex: Updated.
+
+2021-01-22 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
+2020-11-20 Antonio Giovanni Colombo <azc100@gmail.com>
+
+ * gawktexi.in: Updated.
+
2020-11-01 Antonio Giovanni Colombo <azc100@gmail.com>
* texinfo.tex: Updated.
diff --git a/doc/it/gawk.1 b/doc/it/gawk.1
index c5c76023..4002c2ef 100644..100755
--- a/doc/it/gawk.1
+++ b/doc/it/gawk.1
@@ -14,6 +14,7 @@
.\"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
.ds PX \s-1POSIX\s+1
.ds UX \s-1UNIX\s+1
@@ -30,7 +31,7 @@
. if \w'\(rq' .ds rq "\(rq
. \}
.\}
-.TH GAWK 1 "Aug 31 2020" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "May 30 2021" "Free Software Foundation" "Utility Commands"
.SH NOME
gawk \- linguaggio per il riconoscimento e il trattamento di espressioni
regolari
@@ -3496,6 +3497,17 @@ in \*(EP.
Occorre anche fornire un dominio di testo. Si usi
.B TEXTDOMAIN
se ci si vuole servire del dominio corrente.
+.SS Funzioni con valori booleani
+È possibile creare valori speciali di tipo booleani;
+vedere il manuale per sapere come funzionano e
+perché sono stati resi disponibili.
+.TP
+.BI mkbool( espressione\^ )
+A seconda del valore booleano di
+.I espressione
+restituisce un valore di true [vero] o false [falso].
+True ha come valore numerico uno.
+False ha come valore numerico zero.
.SH FUNZIONI DEFINITE DALL'UTENTE
Le funzioni in \*(AK sono definite in questo modo:
.PP
@@ -4289,7 +4301,7 @@ Lo ringraziamo.
.SH COPYING PERMISSIONS
Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996,
1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2009,
-2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020,
+2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021,
Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
diff --git a/doc/it/gawktexi.in b/doc/it/gawktexi.in
index fe7c6b29..053cae43 100644..100755
--- a/doc/it/gawktexi.in
+++ b/doc/it/gawktexi.in
@@ -56,7 +56,7 @@
@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 Gennaio 2021
@set VERSION 5.1
@set PATCHLEVEL 0
@@ -76,6 +76,7 @@
@iftex
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -93,11 +94,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 +107,7 @@
@ifhtml
@set DOCUMENT Documento
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -117,6 +120,7 @@
@ifdocbook
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -129,6 +133,7 @@
@ifxml
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -141,6 +146,7 @@
@ifplaintext
@set DOCUMENT libro
@set CHAPTER capitolo
+@set CHAPTERS capitoli
@set APPENDIX appendice
@set SECTION sezione
@set SECTIONS sezioni
@@ -309,7 +315,7 @@ Some comments on the layout for TeX.
Tel.: +1-617-542-5942 Fax: +1-617-542-2652 Email: <email>gnu@@gnu.org</email>
URL: <ulink url="https://www.gnu.org">https://www.gnu.org/</ulink></literallayout>
-<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2020
+<literallayout class="normal">Copyright &copy; 1989, 1991, 1992, 1993, 1996&ndash;2005, 2007, 2009&ndash;2021
Free Software Foundation, Inc.
All Rights Reserved.
</literallayout>
@@ -331,7 +337,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 +345,7 @@ All Rights Reserved.
@ifnotdocbook
@iftex
-Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2020 @*
+Copyright @copyright{} 1989, 1991, 1992, 1993, 1996--2005, 2007, 2009--2021 @*
Free Software Foundation, Inc.
@end iftex
@end ifnotdocbook
@@ -687,7 +693,7 @@ Copyright dell'edizione italiana @copyright{} 2016 -- Free Software Foundation,
* Separazione in base al contenuto:: Definire campi dal loro contenuto.
* File CSV:: Ancora sui file CSV.
* Controllare la creazione di campi:: Controllare come @command{gawk} sta
- dividendo i record.
+ suddividendo i record.
* Righe multiple:: Record su righe multiple
* Getline:: Richiedere input usando @code{getline}.
* Getline semplice:: Usare @code{getline} senza argomenti.
@@ -877,6 +883,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()}
@@ -968,6 +976,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 +1005,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 +1017,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 +1046,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 +1078,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 +1098,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.
@@ -1779,7 +1793,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
@@ -2710,7 +2738,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 +3035,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 +3293,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 +3372,12 @@ persona @`e un amico [Friend]. Una @samp{R} vuol dire che quella persona @`e
un parente [Relative]:
@example
-@c system if test ! -d eg ; then mkdir eg ; fi
-@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
-@c system if test ! -d eg/data ; then mkdir eg/data ; fi
-@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
-@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg ; then mkdir eg ; fi
+@c system if test ! -d eg/lib ; then mkdir eg/lib ; fi
+@c system if test ! -d eg/data ; then mkdir eg/data ; fi
+@c system if test ! -d eg/prog ; then mkdir eg/prog ; fi
+@c system if test ! -d eg/misc ; then mkdir eg/misc ; fi
+@c system if test ! -d eg/test-programs ; then mkdir eg/test-programs ; fi
@c file eg/data/mail-list
Amelia 555-5553 amelia.zodiacusque@@gmail.com F
Anthony 555-3412 anthony.asserturo@@hotmail.com A
@@ -3689,7 +3724,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 +3733,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 +3753,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 +3978,7 @@ e buttati via. Poich@'e i programmi @command{awk} sono interpretati, si pu@`o
evitare la (normalmente laboriosa) parte di compilazione nel ciclo tipico
dello sviluppo software, ossia edita-compila-prova-correggi.
-@cindex BWK @command{awk} @seeentry{Brian Kernighan @subentry @command{awk} di}
+@cindex BWK @command{awk} @seeentry{Brian Kernighan, @command{awk} di}
@cindex Brian Kernighan @subentry @command{awk} di
In @command{awk} sono stati scritti programmi complessi, compreso un assembler
completo, pluri-piattaforma per
@@ -4429,7 +4470,7 @@ informazioni.
@cindex codice-byte interno @subentry tracciatura del
Stampa i nomi del codice-byte generato internamente, nell'ordine
in cui sono incontrati durante l'esecuzione del programma.
-Questa trace @`e stampata sullo standard error.
+Questa tracciatura @`e stampata sullo standard error.
Ogni ``codice operativo'' @`e preceduto da un segno @code{+}
nell'output.
@@ -4534,7 +4575,7 @@ Forza l'uso del carattere di separazione decimale della localizzazione
quando analizza i dati in input
(@pxref{Localizzazioni}).
-@cindex stampa elegante
+@cindex stampa-elegante
@item @option{-o}[@var{file}]
@itemx @option{--pretty-print}[@code{=}@var{file}]
@cindex @option{-o} (opzione)
@@ -5018,7 +5059,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 +5067,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 +5233,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 +5431,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 +6164,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 +6359,47 @@ nella @dfn{regexp}. Per esempio, @code{/+/} individua un semplice segno
pi@`u. Tuttavia, molte altre versioni di @command{awk} trattano una
tale notazione come un errore di sintassi.
+@sidebar E se la @dfn{regexp} @`e vuota?
+@cindex vuote @subentry @dfn{regexps}
+@cindex @dfn{regexp} @subentry vuote
+Viene qui descritto un uso avanzato delle @dfn{regexp}.
+Pu@`o essere saltato in una prima lettura.
+
+Si pu@`o specificare una costante @dfn{regexp} vuota (@samp{//}) in ogni
+posto in cui ci si aspetta di trova una @dfn{regexp}.
+Pu@`o servire a qualcosa farlo? A cosa corrisponde?
+
+Ha senso farlo. Corrisponde alla stringa vuota (invisibile),
+all'inizio e alla fine di una stringa di caratteri, come pure
+alla stringa vuota tra un carattere e l'altro. Lo si vede bene
+con la funzione @code{gsub()}, che si usa per fare delle sostituzioni
+globali (@pxref{Funzioni per stringhe}). L'uso normale di @code{gsub()}
+@`e del tipo:
+
+@example
+$ @kbd{awk '}
+> @kbd{BEGIN @{}
+> @kbd{ x = "ABC_CBA"}
+> @kbd{ gsub(/B/, "bb", x)}
+> @kbd{ print x}
+> @kbd{@}'}
+@print{} AbbC_CbbA
+@end example
+
+Possiamo usare @code{gsub()} per verificare dove sono situate le stringhe
+vuote che corrispondono alla @dfn{regexp} vuote:
+
+@example
+$ @kbd{awk '}
+> @kbd{BEGIN @{}
+> @kbd{ x = "ABC"}
+> @kbd{ gsub(//, "x", x)}
+> @kbd{ print x}
+> @kbd{@}'}
+@print{} xAxBxCx
+@end example
+@end sidebar
+
@node Espressioni di intervallo
@subsection Alcune note sulle espressioni di intervallo
@@ -6384,7 +6470,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 +6609,7 @@ sono equivalenti). Queste sequenze sono:
@cindex espressioni @subentry tra parentesi quadre @subentry elementi di collazione
@cindex elementi @subentry di collazione
@item elementi di collazione
-Elementi di collazione multi-byte racchiusi fra
+Elementi di collazione multibyte racchiusi fra
@samp{[.} e @samp{.]}. Per esempio, se @samp{ch} @`e un elemento di collazione,
@samp{[[.ch.]]} @`e una @dfn{regexp} che individua questo elemento di
collazione, mentre @samp{[ch]} @`e una @dfn{regexp} che individua le lettere
@@ -7096,7 +7182,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 +7360,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 +7456,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 +7464,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 +8004,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 +8117,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
@@ -8592,6 +8684,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 +8806,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 +8885,20 @@ $ @kbd{gawk -v fpat=2 -f test-csv.awk sample.csv}
@print{} NF = 3 <p><><s>
@end example
+@cindex Collado, Manuel
+@cindex @code{CSVMODE}, libreria per @command{gawk}
+@cindex libreria @code{CSVMODE} per @command{gawk}
+@cindex dati CSV (valori separati da virgole) @subentry analizzare con libreria @code{CSVMODE}
+@cindex CSV (valori separati da virgole) come dati @subentry analizzare con libreria @code{CSVMODE}
+@cindex valori separati da virgole (CSV) come dati @subentry analizzare con libreria @code{CSVMODE}
+In generale, usare @code{FPAT} per effettuare l'analisi di dati in formato CSV
+@`e come utilizzare un lenzuolo troppo corto. Rimane sempre un angolo che non
+@`e coperto. Si raccomanda, in alternativa, di usare la libreria @code{CSVMODE}
+messa a disposizione da Manuel Collado. Vedere:
+@uref{http://mcollado.z15.es/xgawk/, @code{CSVMODE} libreria per @command{gawk}}.
+
@node Controllare la creazione di campi
-@section Controllare come @command{gawk} sta dividendo i record
+@section Controllare come @command{gawk} sta suddividendo i record
@cindex @command{gawk} @subentry separazione in campi e
Come visto sopra, @command{gawk} fornisce tre metodi indipendenti per
@@ -10449,9 +10557,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 +10581,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 +10654,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 +11889,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
@@ -12452,7 +12581,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 +13296,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 +13469,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 +15141,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 +15273,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 +15340,7 @@ modalit@`a compatibile (@pxref{Opzioni}), non sono regole speciali.
@node Vuoto
@subsection Il criterio di ricerca vuoto
-@cindex vuoto @subentry criterio di ricerca
+@cindex vuoti @subentry criteri di ricerca
@cindex criteri di ricerca @subentry vuoti
Un criterio di ricerca vuoto (cio@`e omesso) corrisponde a
@emph{ogni} record in input. Per esempio, il programma:
@@ -16060,16 +16206,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 +16350,14 @@ maniera desiderata. Altre variabili sono impostate automaticamente da
informazioni sul modo di procedere interno di @command{awk}.
@cindex @command{gawk} @subentry variabili predefinite e
-Questa @value{SECTION} documenta tutte le variabili predefinite di
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+documenta tutte le variabili predefinite di
@command{gawk}; molte di queste variabili sono anche documentate nei
@value{CHAPTER} che descrivono le loro aree di influenza.
@@ -16694,7 +16848,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 +17545,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 +19063,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 +19165,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 +19255,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 +19380,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
@@ -21497,6 +21709,9 @@ Restituisce una delle stringhe seguenti, a seconda del tipo di @var{x}:
@item "number"
@var{x} @`e un numero.
+@item "number|bool"
+@var{x} @`e un valore di tipo booleano (@pxref{Valori di tipo booleano}).
+
@item "string"
@var{x} @`e una stringa.
@@ -21778,8 +21993,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 +22676,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 +22753,7 @@ usando la chiamata indiretta di funzioni:
@example
@c file eg/prog/indirectcall.awk
-# chiamataindiretta.awk --- esempio di chiamata indiretta di funzioni
+# indirectcall.awk --- esempio di chiamata indiretta di funzioni
@c endfile
@ignore
@c file eg/prog/indirectcall.awk
@@ -23187,7 +23415,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 +23436,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
@@ -24067,8 +24310,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
@@ -25109,11 +25358,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 +25368,10 @@ main(int argc, char **argv)
@c endfile
@ignore
@c file eg/lib/pwcat.c
+#else
+ printf("%s:*:%ld:%ld:%s:%s\n",
+ p->pw_name, (long) p->pw_uid,
+ (long) p->pw_gid, p->pw_dir, p->pw_shell);
#endif
@c endfile
@end ignore
@@ -26138,7 +26387,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 +26455,13 @@ possono essere separati da virgole, e intervalli di caratteri possono essere
separated da trattini. La lista
@samp{1-8,15,22-35} specifica i caratteri da 1 a 8, 15, e da 22 a 35.
-@item -f @var{lista}
-Usare @var{lista} come lista di campi da ritagliare.
-
@item -d @var{delimitatore}
Usare @var{delimitatore} come carattere che separa i campi invece del
carattere TAB.
+@item -f @var{lista}
+Usare @var{lista} come lista di campi da ritagliare.
+
@item -s
Evita la stampa di righe che non contengono il delimitatore di campo.
@end table
@@ -26216,6 +26472,12 @@ di libreria @code{getopt()}
e la funzione di libreria @code{join()}
(@pxref{Funzione join}).
+La versione POSIX corrente del comando @command{cut} prevede opzioni
+per ritagliare dei campi che possono essere sia byte che caratteri
+[possibilmente multibyte]. Questa versione non tenta di implementare
+tali opzioni, poich@'e @command{awk} lavora esclusivamente in termini
+di caratteri.
+
Il programma inizia con un commento che descrive le opzioni, le funzioni
di libreria necessarie, e una funzione @code{sintassi()} che stampa un
messaggio ed esce. @code{sintassi()} @`e chiamato se si specificano degli
@@ -26237,9 +26499,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 +26577,7 @@ un semplice spazio (@code{@w{" "}}) come valore per @code{FS} @`e
sbagliato: @command{awk} separerebbe i campi con serie di spazi,
TAB, e/o ritorni a capo, mentre devono essere separati solo da uno spazio.
Per far questo, salviamo il carattere di spazio originale nella variabile
-@code{fs} per un uso futuro; dopo aver impostato @code{FS} a @code{"[ ]"} non
+@code{fs} per un uso futuro; dopo aver impostato @code{FS} a @code{@w{"[ ]"}} non
@`e possibile usarlo direttamente per vedere se il carattere delimitatore di
campo @`e nella stringa.
@@ -26595,11 +26857,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 +26895,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 +26959,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 +26999,9 @@ verificando i valori delle variabili @code{RSTART} e @code{RLENGTH}.
Se questi indicano che la corrispondenza non coincide con l'intera
riga, la variabile @code{corrisponde} @`e impostata a zero (falsa).
-Se l'utente chiede invece le righe che @emph{non} corrispondono,
-il senso di @code{corrisponde} @`e invertito, usando l'operatore @samp{!}.
-@code{contatore_file} @`e incrementato con il valore di
+Se l'utente chiede invece le righe che non corrispondono, si inverte
+il senso di @code{corrisponde}, usando l'operatore @samp{!}.
+Poi, @code{contatore_file} @`e incrementato con il valore di
@code{corrisponde}, che vale uno o zero, a seconda che la corrispondenza sia
stata trovata oppure no. Se la riga non corrisponde, l'istruzione
@code{next} passa ad esaminare il record successivo.
@@ -26855,14 +27120,14 @@ Usa la funzione di libreria @code{getopt()}
(@pxref{Funzione getopt}),
le funzioni di libreria del database che descrive gli utenti
(@pxref{Funzioni Passwd}),
-Usa le funzioni di libreria che riguardano il database degli utenti
+le funzioni di libreria che riguardano il database degli utenti
(@pxref{Funzioni Passwd})
e le funzioni di libreria che riguardano il database dei gruppi
(@pxref{Funzioni Group}).
Il programma @`e abbastanza semplice. Tutto il lavoro @`e svolto nella regola
@code{BEGIN}.
-Inizia com dei commenti di spiegazioni, una lista di opzioni e infine
+Inizia con dei commenti di spiegazione, una lista di opzioni e infine
una funzione @code{sintassi()} function:
@cindex @code{id.awk} (programma)
@@ -26939,7 +27204,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 +27223,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 +27340,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 +27521,7 @@ ogni file dovrebbe essere lungo (al massimo) @var{N} byte.
Se si specifica la lettera @samp{k}, il numero @var{N} viene
moltiplicato per 1.024, ossia diviene il numero di kilobyte.
Se si specifica la lettera @samp{m}, il numero @var{N} viene
-moltiplicato per 1.048.576 (@math{1.024 @value{PER} 1.024})
+moltiplicato per 1.048.576 (@math{1.024 @value{VOLTE} 1.024})
ossia diviene il numero di megabyte.
(Quest'opzione @`e mutuamente esclusiva con l'opzione @option{-l}).
@@ -27285,7 +27550,9 @@ Ecco un'implementazione di @command{split} in @command{awk}. Viene utilizzata
la funzione @code{getopt()} presentata in @ref{Funzione getopt}.
Il programma inizia con un commento descrittivo e poi con la
-funzione @code{sintassi()} che ne descrive le opzioni:
+funzione @code{sintassi()} che ne descrive le opzioni. La variabile
+@code{comune} permettere di avere delle righe brevi nella funzione,
+in modo che sia stampata in maniera elegante nella pagina:
@cindex @code{split.awk} (programma)
@cindex programma @subentry @code{split.awk}
@@ -27306,10 +27573,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"
+ common = "[-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 +27671,7 @@ passare da @samp{abz} ad @samp{aca}.
@item
Si deve poter determinare se abbiamo utilizzato tutti i prefissi,
-in modo che, nel caso ci siano ulteriori dati (da suddividere) si
+in modo che, nel caso ci siano ulteriori dati (da suddividere), si
possa stampare un messaggio di errore e terminare il programma.
Il trucco @`e di gestire una tale situazione @emph{dopo} aver usato
l'ultimo suffisso disponibile, e non quando viene generato l'ultimo
@@ -27801,7 +28070,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 +28333,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 +28360,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 +28380,23 @@ standard input. Se ci sono pi@`u file, stampa anche il contatore totale di
tutti i file. Le opzioni e il loro significato sono i seguenti:
@table @code
-@item -l
-Conta solo le righe.
-
-@item -w
-Conta solo le parole.
-Una ``parola'' @`e una sequenza contigua di caratteri non bianchi, separata da
-spazi e/o TAB. Fortunatamente, questo @`e il modo normale in cui @command{awk}
-separa i campi nei suoi record in input.
-
@item -c
Conta solo i byte.
Un tempo, la lettera @samp{c} di questa opzione stava per ``caratteri.''
Ma, come spiegato pi@`u sopra, byte e carattere non sono pi@`u sinonimi
tra loro.
+@item -l
+Conta solo le righe.
+
@item -m
Conta solo caratteri.
+
+@item -w
+Conta solo le parole.
+Una ``parola'' @`e una sequenza contigua di caratteri non bianchi, separata da
+spazi e/o TAB. Fortunatamente, questo @`e il modo normale in cui @command{awk}
+separa i campi nei suoi record in input.
@end table
L'implementazione di @command{wc} in @command{awk} @`e particolarmente
@@ -28295,7 +28565,14 @@ END @{
@node Programmi vari
@section Un paniere di programmi @command{awk}
-Questa @value{SECTION} @`e un ``paniere'' che contiene vari programmi.
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+@`e un ``paniere'' che contiene vari programmi.
Si spera che siano interessanti e divertenti.
@menu
@@ -28518,7 +28795,14 @@ BEGIN @{
@c endfile
@end example
-La successiva @value{SECTION} di codice scompone l'ora specificata in ore e
+@ifnotinfo
+La successiva
+@end ifnotinfo
+@ifinfo
+Il successivo
+@end ifinfo
+@value{SECTION}
+di codice scompone l'ora specificata in ore e
minuti, la converte (se @`e il caso) al formato 24-ore, e poi calcola il
relativo numero di secondi dalla mezzanotte. Poi trasforma l'ora corrente in
un contatore dei secondi dalla
@@ -29138,7 +29422,7 @@ la riga), quando la regola @`e verificata [ossia se il record non
@cindex estrarre programma da file sorgente Texinfo
@cindex file @subentry Texinfo @subentry estrarre programma da
@ifnotinfo
-Sia questo capitolo che il precedente
+Sia questo @value{CHAPTER} che il precedente
(@ref{Funzioni di libreria})
presentano un numero elevato di programmi @command{awk}.
@end ifnotinfo
@@ -29258,6 +29542,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 +29650,7 @@ La riga @`e poi stampata nel file di output:
gsub("@@`o","ò",riga)
gsub("@@`u","ù",riga)
# riga contiene ancora caratteri @@?
- if (index(riga, "@@") == 0) {
+ if (index(riga, "@@") == 0) @{
print riga > file_corrente
continue
@}
@@ -29565,7 +29850,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 +30024,6 @@ Il programma @`e il seguente:
# Arnold Robbins, arnold@@skeeve.com, Public Domain
# July 1993
# December 2010, minor edits
-# Antonio Colombo, October 2020, test for Italian accented letters
@c endfile
@end ignore
@c file eg/prog/igawk.sh
@@ -30612,12 +30903,14 @@ tratta della capacit@`a di aggiungere dinamicamente nuove funzioni predefinite a
@menu
* Dati non decimali:: Consentire dati di input non decimali.
+* Valori di tipo booleano:: Valori di tipo @code{number|bool} type.
* Ordinamento di vettori:: Modi per controllare la visita di un vettore
e il suo ordinamento.
* I/O bidirezionale:: Comunicazione bidirezionale con un altro
processo.
* Reti TCP/IP:: Usare @command{gawk} per programmazione di rete.
* Profilare:: Profilare i propri programmi @command{awk}.
+* Filosofia delle estensioni:: Cosa dovrebbe essere incluso e cosa no.
* Sommario funzionalit@`a avanzate:: Sommario delle funzionalit@`a avanzate.
@end menu
@@ -30681,6 +30974,55 @@ porta a risultati meno inattesi.
Quest'opzione potrebbe sparire dalle versioni future di @command{gawk}.
@end quotation
+@node Valori di tipo booleano
+@section Valori di tipo booleano
+
+I valori scalari in @command{awk} sono numeri o stringhe di caratteri.
+@command{gawk} supporta anche valori di tipo @dfn{regexp}
+(@pxref{Costanti @dfn{regexp} forti}).
+
+Come descritto in @ref{Valori di verit@`a}, ai valori booleani in
+@command{awk} non viene assegnato un tipo loro proprio:
+un valore @`e ``true'' [vero] se @`e diverso da zero e dalla stringa nulla
+e ``false'' [falso] in tutti gli altri casi.
+
+Se se devono scambiare dati con linguaggi che possiedono un tipo di
+variabile booleana vera e propria, usando un formato standard come
+JSON o XML, la mancanza di un vero tipo di variabile booleana
+in @command{awk} pu@`o essere un problema.
+(Vedere, p.es., l'estensione @code{json} fornita da
+@uref{https://sourceforge.net/projects/gawkextlib, il progetto @code{gawkextlib}}.)
+
+@`E facile importare dati di tipo booleano in @command{awk}, ma una volta
+importati l'informazione che si trattava di dati di tipo booleano viene
+persa. Esportare dati di questo tipo @`e ancora pi@`u difficile;
+non c'@`e modo per indicare che un valore @`e veramente booleano.
+
+Per risolvere questo problema, @command{gawk} mette a disposizione una
+funzione di nome @code{mkbool()}.
+La funzione ha un argomento, che pu@`o essere una qualsiasi espressione
+@command{awk} e restituisce un valore di tipo booleano.
+
+I valori cos@`{@dotless{i}} restituiti sono normali valori numerici di @command{awk},
+che possono assumere i valori uno o zero, a seconda del valore di
+verit@`a dell'espressione originale fornita nella chiamata a
+@code{mkbool()}.
+
+La funzione @code{typeof()} (@pxref{Funzioni per i tipi}) restituisce
+la stringa @code{"number|bool"} per queste variabili.
+
+Tuttavia i valori di tipo booleano @emph{sono} numeri, per @command{gawk}
+tranne che per il fatto che il codice delle estensioni a @command{gawk}
+li pu@`o trattare, volendo, come valori di tipo booleano.
+
+Anche se sarebbe stato possibile aggiungere due nuove variabili
+predefinite di tipo booleano, chiamandole @code{TRUE} [vero] e
+@code{FALSE} [falso], il farlo avrebbe certamente generato errori
+in molti programmi @command{awk} esistenti.
+Invece, l'introduzione di una funzione ``generatrice'' che crea valori
+di tipo booleano, fornisce flessibilit@`a, senza generare troppi
+errori nel codice esistente.
+
@node Ordinamento di vettori
@section Controllare la visita di un vettore e il suo ordinamento
@@ -31828,7 +32170,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 +32265,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 +32275,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 +32290,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,9 +32414,14 @@ 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}
@@ -33045,7 +33452,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
@@ -33579,7 +33993,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 +34430,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 +35052,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 +35493,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 +35557,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 +35592,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 +35780,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 +35910,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 +35942,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 +35964,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 +36091,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 +36959,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 +36997,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 +37047,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 +37691,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 +37705,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 +37721,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 +38033,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 +38084,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 +38120,11 @@ Si aspetta che @code{stringa} sia un valore di tipo @samp{char *} che punta a
dati ottenuti in precedenza tramite una chiamata a
@code{gawk_malloc()}, @code{gawk_calloc()} o @code{gawk_realloc()}.
+@item static inline awk_value_t *
+@itemx make_bool(awk_bool_t boolval, awk_value_t *risultato);
+Questa funzione crea un valore booleano nella variabile @code{awk_value_t}
+puntata da @code{risultato}.
+
@end table
@node API e gestione valori MPFR e GMP
@@ -37506,7 +38175,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 +38699,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 +39003,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 +39014,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 +39027,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 +39040,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 +39049,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 +39058,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 +39066,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 +39093,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 +39104,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 +39117,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 +39135,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 +39169,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 +39205,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 +39254,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 +39268,7 @@ della variabile
@item awk_bool_t sym_lookup_ns(const char *nome,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ const char *name_space,
-@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t wanted,
+@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_valtype_t desiderato,
@itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_value_t *risultato);
Simile a @code{sym_lookup()}, ma il parametro @code{name_space} consente di
specificare a quale spazio-di-nomi appartiene @code{nome}.
@@ -38614,7 +39315,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 +39402,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 +39443,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 +39684,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 +41337,18 @@ $ @kbd{AWKLIBPATH=$PWD gawk -f testff.awk}
@section Le estensioni di esempio incluse nella distribuzione @command{gawk}
@cindex estensioni @subentry distribuite con @command{gawk}
-Questa @value{SECTION} fornisce una breve panoramica degli esempi di
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SECTION}
+fornisce una breve panoramica degli esempi di
estensione inclusi nella distribuzione di @command{gawk}. Alcune di esse
sono destinate per l'uso in produzione (p.es., le estensioni
-@code{filefuncs}, @code{readdir}, e
-@code{inplace}). Altre sono state scritte principalmente per mostrare come
+@code{filefuncs}, @code{readdir}, e @code{inplace}).
+Altre sono state scritte principalmente per mostrare come
si usa l'estensione API.
@menu
@@ -41809,7 +42532,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 +43286,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
@@ -43057,7 +43788,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 +43836,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 +43989,37 @@ L'indice analitico di questo manuale @`e stato completamente rimaneggiato.
@item
@`E stato aggiunto il supporto per MSYS2.
+
+@item
+@code{asort()} ed @code{asorti()} sono stati modificati
+per consentire come primo argomento @code{FUNCTAB} e @code{SYMTAB},
+quando venga specificato un vettore di destinazione come secondo parametro
+(@pxref{Funzioni per stringhe}).
+
+@item
+Le opzioni @option{-I}/@option{--trace} sono state aggiunte per
+stampare una traccia dei @dfn{byte code} mentre vengono eseguiti
+(@pxref{Opzioni}).
+
+@item
+@code{$0} e i campi sono ora azzerati prima di eseguire una
+regola @code{BEGINFILE} rule (@pxref{BEGINFILE/ENDFILE}).
+
+@item
+Parecchi fra i programmi di esempio sono stati aggiornati per
+riflettere i loro equivalenti POSIX pi@`u recenti.
+
+@item
+Gli avvisi ``no effect'' da lint, emessi se si specifica
+l'opzione @option{--lint}, sono stati modificati
+e ora sono pi@`u ragionevoli.
+(@pxref{Opzioni}).
+
+@item
+La gestione dei valori Infinity [Infinito] e NaN [Non un Numero]
+@`e stata migliorata.
+@xref{Definizioni matematiche} e vedere anche
+@ref{Problemi virgola mobile POSIX}.
@end itemize
@c XXX ADD MORE STUFF HERE
@@ -43434,7 +44196,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 +44576,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.
@@ -43974,7 +44750,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
@@ -44383,14 +45159,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
@@ -44430,7 +45213,14 @@ al file @file{configure.ac} e/o a @file{custom.h}.
@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 +45235,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.
@@ -44686,7 +45491,14 @@ 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}
+@ifnotinfo
+Questa
+@end ifnotinfo
+@ifinfo
+Questo
+@end ifinfo
+@value{SUBSECTION}
+descrive come compilare e installare @command{gawk}
sotto VMS. Il termine classico ``VMS'' @`e usato qui anche per designare
OpenVMS.
@@ -45312,7 +46124,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
@@ -45411,6 +46230,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 +46287,17 @@ il progetto
mette a disposizione questa implementazione. Si possono vedere i singoli file in
@uref{https://github.com/joyent/illumos-joyent/blob/master/usr/src/cmd/awk_xpg4}.
+@cindex @command{frawk}
+@cindex sorgente @subentry codice @subentry @command{frawk}
+@cindex codice sorgente @subentry @command{frawk}
+@item @command{frawk}
+Questo @`e un linguaggio per scrivere programmi corti.
+``In prima approssimazione, @`e un'implementazione del linguaggio AWK;
+molti comuni programmi @command{awk} producono un output equivalente
+quando passati a @command{frawk}.'' Comunque, ha anche numerose e
+importanti funzionalit@`a ulteriori. Il codice sorgente @`e disponibile
+sul sito @uref{https://github.com/ezrosent/frawk}.
+
@cindex @command{goawk}
@cindex Go @subentry implementazione di @command{awk}
@cindex sorgente @subentry @command{goawk}
@@ -45490,7 +46324,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 +46344,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 +46388,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,7 +46419,14 @@ 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
@@ -46319,7 +47168,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 +48147,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
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..b59c81cf 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-02-20.11}
%
-% 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
@@ -248,7 +248,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,10 +588,9 @@
\fi
}
-% @end foo executes the definition of \Efoo.
-% But first, it executes a specialized version of \checkenv
-%
-\parseargdef\end{%
+
+% @end foo calls \checkenv and executes the definition of \Efoo.
+\parseargdef\end{
\if 1\csname iscond.#1\endcsname
\else
% The general wording of \badenverr may not be ideal.
@@ -2689,8 +2688,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 +2695,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 +2865,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 +2908,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 +3062,7 @@ end
\urefcatcodes
%
\global\def\urefcode{\begingroup
- \setupmarkupstyle{code}%
+ \setcodequotes
\urefcatcodes
\let&\urefcodeamp
\let.\urefcodedot
@@ -3241,8 +3183,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 +3201,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 +3331,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.
@@ -7163,7 +7109,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 +7335,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 +7381,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 +7541,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 +7582,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
\tabexpand
- \setupmarkupstyle{verbatim}%
+ \setcodequotes
% Respect line breaks,
% print special symbols as themselves, and
% make each space count.
@@ -8055,7 +8001,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 +8110,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 +8174,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 +8345,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 +8357,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 +8950,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 +9044,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 +9079,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 +9169,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 +9197,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 +9306,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 +9530,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
@@ -11622,7 +11583,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 +11642,7 @@ directory should work if nowhere else does.}
@let|=@normalverticalbar
@let~=@normaltilde
@let\=@ttbackslash
- @markupsetuplqdefault
- @markupsetuprqdefault
+ @setregularquotes
@unsepspaces
}
}
@@ -11775,8 +11735,7 @@ directory should work if nowhere else does.}
@c Do this last of all since we use ` in the previous @catcode assignments.
@catcode`@'=@active
@catcode`@`=@active
-@markupsetuplqdefault
-@markupsetuprqdefault
+@setregularquotes
@c Local variables:
@c eval: (add-hook 'before-save-hook 'time-stamp)
diff --git a/doc/wordlist b/doc/wordlist
index 4acb7656..2aa56fcb 100644
--- a/doc/wordlist
+++ b/doc/wordlist
@@ -324,6 +324,7 @@ NR
NT
NUMCUR
NaN
+NaNs
Nachum
Neacsu
Neacsu's