gawk-diffs
[Top][All Lists]
Advanced

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

[SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4307-g84b8134


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4307-g84b8134
Date: Wed, 28 Apr 2021 15:04:25 -0400 (EDT)

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

The branch, feature/bool has been updated
       via  84b8134d494058582bd65fc02b7630ece90ace63 (commit)
       via  d73e542791ccb18380cd836b8ea4a4a4b3535538 (commit)
      from  3a530fc2d0a257536d67ffa854bc8c3ecf96acb1 (commit)

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

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

commit 84b8134d494058582bd65fc02b7630ece90ace63
Merge: d73e542 3a530fc
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Apr 28 22:04:08 2021 +0300

    Merge branch 'feature/bool' of ssh://git.sv.gnu.org/srv/git/gawk into 
feature/bool


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

commit d73e542791ccb18380cd836b8ea4a4a4b3535538
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Apr 28 22:03:40 2021 +0300

    Make booleans just special numbers.

diff --git a/ChangeLog b/ChangeLog
index 65cc51a..9548651 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2021-04-28         Arnold D. Robbins     <arnold@skeeve.com>
+
+       Make bools plain numbers that have bool flag instead of
+       being weird string values.
+
+       * array.c (do_sort_up_value_type): Remove special ordering
+       for booleans.
+       * awk.h (warn_bool): Remove declaration.
+       * builtin.c (warn_bool): Remove function and all calls.
+       * gawkapi.c (node_to_awk_value): Update switches to look for
+       NUMBER|BOOL.
+       * node.c (make_bool_node): Revise string values and flag bits.
+
 2021-04-16         Arnold D. Robbins     <arnold@skeeve.com>
 
        * main (arg_assign): For -v '@/...' make sure that there are
diff --git a/array.c b/array.c
index c6bfa44..58ca2c5 100644
--- a/array.c
+++ b/array.c
@@ -1209,24 +1209,12 @@ do_sort_up_value_type(const void *p1, const void *p2)
        (void) fixtype(n1);
        (void) fixtype(n2);
 
-       /* 3a. Bools first */
-       if ((n1->flags & BOOL) != 0 && (n2->flags & BOOL) != 0) {
-               return cmp_numbers(n1, n2);
-       }
-
-       /* 3b. Bools before everything else */
-       if ((n1->flags & BOOL) != 0 && (n2->flags & BOOL) == 0) {
-               return -1;
-       } else if ((n1->flags & BOOL) == 0 && (n2->flags & BOOL) != 0) {
-               return 1;
-       }
-
-       /* 3c. Numbers next */
+       /* 3a. Numbers first */
        if ((n1->flags & NUMBER) != 0 && (n2->flags & NUMBER) != 0) {
                return cmp_numbers(n1, n2);
        }
 
-       /* 3d. All numbers are less than all strings. This is aribitrary. */
+       /* 3b. All numbers are less than all strings. This is aribitrary. */
        if ((n1->flags & NUMBER) != 0 && (n2->flags & STRING) != 0) {
                return -1;
        } else if ((n1->flags & STRING) != 0 && (n2->flags & NUMBER) != 0) {
diff --git a/awk.h b/awk.h
index f4fa4d4..c0f44d5 100644
--- a/awk.h
+++ b/awk.h
@@ -1455,7 +1455,6 @@ extern bool is_identchar(int c);
 extern NODE *make_regnode(NODETYPE type, NODE *exp);
 extern bool validate_qualified_name(char *token);
 /* builtin.c */
-extern void warn_bool(const char *func, int argnum, NODE *n);
 extern double double_to_int(double d);
 extern NODE *do_exp(int nargs);
 extern NODE *do_fflush(int nargs);
diff --git a/builtin.c b/builtin.c
index 1158fad..d56d783 100644
--- a/builtin.c
+++ b/builtin.c
@@ -381,8 +381,6 @@ do_index(int nargs)
 
        s1 = force_string(s1);
        s2 = force_string(s2);
-       warn_bool("index", 1, s1);
-       warn_bool("index", 2, s2);
 
        p1 = s1->stptr;
        p2 = s2->stptr;
@@ -554,7 +552,6 @@ do_length(int nargs)
        if (do_lint && (fixtype(tmp)->flags & STRING) == 0)
                lintwarn(_("%s: received non-string argument"), "length");
        tmp = force_string(tmp);
-       warn_bool("length", 1, tmp);
 
        if (gawk_mb_cur_max > 1) {
                tmp = force_wstring(tmp);
@@ -1782,16 +1779,6 @@ do_sqrt(int nargs)
        return make_number((AWKNUM) sqrt(arg));
 }
 
-/* warn_bool --- warn that bool parameter is used as a string */
-
-void
-warn_bool(const char *func, int argnum, NODE *n)
-{
-       if (do_lint && (n->flags & BOOL) != 0)
-               lintwarn(_("%s: argument %d of type bool used as a string"),
-                       func, argnum);
-}
-
 /* do_substr --- do the substr function */
 
 NODE *
@@ -1815,7 +1802,6 @@ do_substr(int nargs)
        DEREF(t1);
 
        t1 = POP_STRING();
-       warn_bool("substr", 1, t1);
 
        if (nargs == 3) {
                if (! (d_length >= 1)) {
@@ -2421,7 +2407,6 @@ do_tolower(int nargs)
        NODE *t1, *t2;
 
        t1 = POP_SCALAR();
-       warn_bool("tolower", 1, t1);
        if (do_lint && (fixtype(t1)->flags & STRING) == 0)
                lintwarn(_("%s: received non-string argument"), "tolower");
        t1 = force_string(t1);
@@ -2453,7 +2438,6 @@ do_toupper(int nargs)
        NODE *t1, *t2;
 
        t1 = POP_SCALAR();
-       warn_bool("toupper", 1, t1);
        if (do_lint && (fixtype(t1)->flags & STRING) == 0)
                lintwarn(_("%s: received non-string argument"), "toupper");
        t1 = force_string(t1);
@@ -2678,7 +2662,6 @@ do_match(int nargs)
        tre = POP();
        rp = re_update(tre);
        t1 = POP_STRING();
-       warn_bool("mastch", 1, t1);
 
        rstart = research(rp, t1->stptr, 0, t1->stlen, RE_NEED_START);
        if (rstart >= 0) {      /* match succeded */
@@ -2899,7 +2882,6 @@ do_sub(int nargs, unsigned int flags)
                rp = re_update(tmp);
 
                target = POP_STRING();  /* original string */
-               warn_bool("gensub", 3, target);
 
                glob_flag = POP_SCALAR();       /* value of global flag */
                if (   (glob_flag->flags & STRING) != 0
@@ -4135,8 +4117,8 @@ do_typeof(int nargs)
                break;
        case Node_val:
                switch (fixtype(arg)->flags & 
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
-               case BOOL:
-                       res = "bool";
+               case NUMBER|BOOL:
+                       res = "number|bool";
                        break;
                case NUMBER:
                        res = "number";
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 6e7ad16..011a0bc 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,10 @@
+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
diff --git a/doc/awkcard.in b/doc/awkcard.in
index cf2cf76..0229e18 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -1924,9 +1924,8 @@ See the manual for details.\*(CB
 \*(CD\*(FCbool(\*(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
-and a string value of \*(FC"TRUE"\fP. False values have a numeric value of zero
-and a string value of \*(FC"FALSE"\fP.\*(CB
+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
diff --git a/doc/gawk.1 b/doc/gawk.1
index 86ddd7c..e71ceba 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -13,7 +13,7 @@
 .              if \w'\(rq' .ds rq "\(rq
 .      \}
 .\}
-.TH GAWK 1 "Apr 6 2021" "Free Software Foundation" "Utility Commands"
+.TH GAWK 1 "Apr 28 2021" "Free Software Foundation" "Utility Commands"
 .SH NAME
 gawk \- pattern scanning and processing language
 .SH SYNOPSIS
@@ -3488,8 +3488,8 @@ they work and why they exist.
 Based on the boolean value of
 .I expression
 return either a true value or a false value.
-True values have numeric value one and string value \fB"TRUE"\fR.
-False values have numeric value zero and string value \fB"False"\fR.
+True values have numeric value one.
+False values have numeric value zero.
 .SH USER-DEFINED FUNCTIONS
 Functions in \*(AK are defined as follows:
 .PP
diff --git a/doc/gawk.info b/doc/gawk.info
index 853014f..b73b18e 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -12151,11 +12151,9 @@ available:
 '"@val_type_asc"'
      Order by element values in ascending order (rather than by
      indices).  Ordering is by the type assigned to the element (*note
-     Typing and Comparison::).  All Boolean values come before all
-     numeric values (*note Boolean Typed Values::), and all numeric
-     values come before all string values, which in turn come before all
-     subarrays.  (Subarrays have not been described yet; *note Arrays of
-     Arrays::.)
+     Typing and Comparison::).  All numeric values come before all
+     string values, which in turn come before all subarrays.  (Subarrays
+     have not been described yet; *note Arrays of Arrays::.)
 
      If you choose to use this feature in traversing 'FUNCTAB' (*note
      Auto-set::), then the order is built-in functions first (*note
@@ -12854,10 +12852,9 @@ compatibility mode (*note Options::):
 
 'bool(EXPRESSION)'
      Return a Boolean-typed value based on the regular Boolean value of
-     EXPRESSION.  Boolean "true" values have numeric value one and
-     string value '"TRUE"'.  Boolean "false" values have numeric zero
-     and string value '"FALSE"'.  This is discussed in more detail in
-     *note Boolean Typed Values::.
+     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
@@ -14433,9 +14430,6 @@ contexts.
      '"array"'
           X is an array.
 
-     '"bool"'
-          X is a Boolean typed value (*note Boolean Typed Values::).
-
      '"regexp"'
           X is a strongly typed regexp (*note Strong Regexp
           Constants::).
@@ -14443,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.
 
@@ -20898,7 +20895,7 @@ their own:
 * Menu:
 
 * Nondecimal Data::             Allowing nondecimal input data.
-* Boolean Typed Values::        Values with 'bool' type.
+* 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.
@@ -20977,16 +20974,16 @@ there's no way to indicate that a value is really 
Boolean.
 takes one argument, which is any 'awk' expression, and it returns a
 value of Boolean type.
 
-   The returned values are different than normal 'awk' values.  When
-treated as numbers, they are either one or zero, depending upon the
-truth value of the original expression passed in the call to 'bool()'.
-When treated as strings, they are either '"TRUE"' or '"FALSE"', again
-depending upon the truth value of the expression passed in the call to
-'bool()'.  The value for "false" is thus unusual; it is zero
-numerically, but not empty when treated as a string.
+   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.
 
-   The 'typeof()' function (*note Type Functions::) returns '"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
@@ -33231,8 +33228,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
@@ -38426,377 +38423,377 @@ Node: Assigning Elements510508
 Node: Array Example510999
 Node: Scanning an Array512758
 Node: Controlling Scanning515780
-Ref: Controlling Scanning-Footnote-1522332
-Node: Numeric Array Subscripts522648
-Node: Uninitialized Subscripts524832
-Node: Delete526451
-Ref: Delete-Footnote-1529203
-Node: Multidimensional529260
-Node: Multiscanning532355
-Node: Arrays of Arrays533946
-Node: Arrays Summary538714
-Node: Functions540807
-Node: Built-in541845
-Node: Calling Built-in542998
-Node: Boolean Functions544994
-Node: Numeric Functions545604
-Ref: Numeric Functions-Footnote-1549631
-Ref: Numeric Functions-Footnote-2550279
-Ref: Numeric Functions-Footnote-3550327
-Node: String Functions550599
-Ref: String Functions-Footnote-1574740
-Ref: String Functions-Footnote-2574868
-Ref: String Functions-Footnote-3575116
-Node: Gory Details575203
-Ref: table-sub-escapes576994
-Ref: table-sub-proposed578513
-Ref: table-posix-sub579876
-Ref: table-gensub-escapes581417
-Ref: Gory Details-Footnote-1582240
-Node: I/O Functions582394
-Ref: table-system-return-values588848
-Ref: I/O Functions-Footnote-1590928
-Ref: I/O Functions-Footnote-2591076
-Node: Time Functions591196
-Ref: Time Functions-Footnote-1601867
-Ref: Time Functions-Footnote-2601935
-Ref: Time Functions-Footnote-3602093
-Ref: Time Functions-Footnote-4602204
-Ref: Time Functions-Footnote-5602316
-Ref: Time Functions-Footnote-6602543
-Node: Bitwise Functions602809
-Ref: table-bitwise-ops603403
-Ref: Bitwise Functions-Footnote-1609466
-Ref: Bitwise Functions-Footnote-2609639
-Node: Type Functions609830
-Node: I18N Functions612777
-Node: User-defined614428
-Node: Definition Syntax615240
-Ref: Definition Syntax-Footnote-1620934
-Node: Function Example621005
-Ref: Function Example-Footnote-1623927
-Node: Function Calling623949
-Node: Calling A Function624537
-Node: Variable Scope625495
-Node: Pass By Value/Reference628489
-Node: Function Caveats631133
-Ref: Function Caveats-Footnote-1633180
-Node: Return Statement633300
-Node: Dynamic Typing636279
-Node: Indirect Calls637209
-Ref: Indirect Calls-Footnote-1647464
-Node: Functions Summary647592
-Node: Library Functions650297
-Ref: Library Functions-Footnote-1653904
-Ref: Library Functions-Footnote-2654047
-Node: Library Names654218
-Ref: Library Names-Footnote-1657885
-Ref: Library Names-Footnote-2658108
-Node: General Functions658194
-Node: Strtonum Function659297
-Node: Assert Function662319
-Node: Round Function665645
-Node: Cliff Random Function667185
-Node: Ordinal Functions668201
-Ref: Ordinal Functions-Footnote-1671264
-Ref: Ordinal Functions-Footnote-2671516
-Node: Join Function671726
-Ref: Join Function-Footnote-1673496
-Node: Getlocaltime Function673696
-Node: Readfile Function677438
-Node: Shell Quoting679415
-Node: Data File Management680816
-Node: Filetrans Function681448
-Node: Rewind Function685544
-Node: File Checking687453
-Ref: File Checking-Footnote-1688787
-Node: Empty Files688988
-Node: Ignoring Assigns690967
-Node: Getopt Function692517
-Ref: Getopt Function-Footnote-1707728
-Node: Passwd Functions707928
-Ref: Passwd Functions-Footnote-1716767
-Node: Group Functions716855
-Ref: Group Functions-Footnote-1724753
-Node: Walking Arrays724960
-Node: Library Functions Summary727968
-Node: Library Exercises729374
-Node: Sample Programs729839
-Node: Running Examples730609
-Node: Clones731337
-Node: Cut Program732561
-Node: Egrep Program742701
-Node: Id Program751702
-Node: Split Program761649
-Ref: Split Program-Footnote-1771539
-Node: Tee Program771712
-Node: Uniq Program774502
-Node: Wc Program782090
-Node: Bytes vs. Characters782477
-Node: Using extensions784025
-Node: wc program784779
-Node: Miscellaneous Programs789644
-Node: Dupword Program790857
-Node: Alarm Program792887
-Node: Translate Program797742
-Ref: Translate Program-Footnote-1802307
-Node: Labels Program802577
-Ref: Labels Program-Footnote-1805928
-Node: Word Sorting806012
-Node: History Sorting810084
-Node: Extract Program812309
-Node: Simple Sed820363
-Node: Igawk Program823437
-Ref: Igawk Program-Footnote-1837768
-Ref: Igawk Program-Footnote-2837970
-Ref: Igawk Program-Footnote-3838092
-Node: Anagram Program838207
-Node: Signature Program841269
-Node: Programs Summary842516
-Node: Programs Exercises843730
-Ref: Programs Exercises-Footnote-1847860
-Node: Advanced Features847946
-Node: Nondecimal Data850070
-Node: Boolean Typed Values851668
-Node: Array Sorting853676
-Node: Controlling Array Traversal854381
-Ref: Controlling Array Traversal-Footnote-1862749
-Node: Array Sorting Functions862867
-Ref: Array Sorting Functions-Footnote-1867958
-Node: Two-way I/O868154
-Ref: Two-way I/O-Footnote-1875875
-Ref: Two-way I/O-Footnote-2876062
-Node: TCP/IP Networking876144
-Node: Profiling879262
-Node: Extension Philosophy888571
-Node: Advanced Features Summary890050
-Node: Internationalization892065
-Node: I18N and L10N893545
-Node: Explaining gettext894232
-Ref: Explaining gettext-Footnote-1900124
-Ref: Explaining gettext-Footnote-2900309
-Node: Programmer i18n900474
-Ref: Programmer i18n-Footnote-1905423
-Node: Translator i18n905472
-Node: String Extraction906266
-Ref: String Extraction-Footnote-1907398
-Node: Printf Ordering907484
-Ref: Printf Ordering-Footnote-1910270
-Node: I18N Portability910334
-Ref: I18N Portability-Footnote-1912790
-Node: I18N Example912853
-Ref: I18N Example-Footnote-1916128
-Ref: I18N Example-Footnote-2916201
-Node: Gawk I18N916310
-Node: I18N Summary916959
-Node: Debugger918300
-Node: Debugging919300
-Node: Debugging Concepts919741
-Node: Debugging Terms921550
-Node: Awk Debugging924125
-Ref: Awk Debugging-Footnote-1925070
-Node: Sample Debugging Session925202
-Node: Debugger Invocation925736
-Node: Finding The Bug927122
-Node: List of Debugger Commands933596
-Node: Breakpoint Control934929
-Node: Debugger Execution Control938623
-Node: Viewing And Changing Data941985
-Node: Execution Stack945526
-Node: Debugger Info947163
-Node: Miscellaneous Debugger Commands951234
-Node: Readline Support956296
-Node: Limitations957192
-Node: Debugging Summary959746
-Node: Namespaces961025
-Node: Global Namespace962136
-Node: Qualified Names963534
-Node: Default Namespace964533
-Node: Changing The Namespace965274
-Node: Naming Rules966888
-Node: Internal Name Management968736
-Node: Namespace Example969778
-Node: Namespace And Features972340
-Node: Namespace Summary973775
-Node: Arbitrary Precision Arithmetic975252
-Node: Computer Arithmetic976739
-Ref: table-numeric-ranges980505
-Ref: table-floating-point-ranges980998
-Ref: Computer Arithmetic-Footnote-1981656
-Node: Math Definitions981713
-Ref: table-ieee-formats984689
-Node: MPFR features985256
-Node: FP Math Caution986974
-Ref: FP Math Caution-Footnote-1988046
-Node: Inexactness of computations988415
-Node: Inexact representation989446
-Node: Comparing FP Values990806
-Node: Errors accumulate992047
-Node: Strange values993503
-Ref: Strange values-Footnote-1996091
-Node: Getting Accuracy996196
-Node: Try To Round998906
-Node: Setting precision999805
-Ref: table-predefined-precision-strings1000502
-Node: Setting the rounding mode1002332
-Ref: table-gawk-rounding-modes1002706
-Ref: Setting the rounding mode-Footnote-11006637
-Node: Arbitrary Precision Integers1006816
-Ref: Arbitrary Precision Integers-Footnote-11009991
-Node: Checking for MPFR1010140
-Node: POSIX Floating Point Problems1011614
-Ref: POSIX Floating Point Problems-Footnote-11015899
-Node: Floating point summary1015937
-Node: Dynamic Extensions1018127
-Node: Extension Intro1019680
-Node: Plugin License1020946
-Node: Extension Mechanism Outline1021743
-Ref: figure-load-extension1022182
-Ref: figure-register-new-function1023747
-Ref: figure-call-new-function1024839
-Node: Extension API Description1026901
-Node: Extension API Functions Introduction1028614
-Ref: table-api-std-headers1030450
-Node: General Data Types1034699
-Ref: General Data Types-Footnote-11043405
-Node: Memory Allocation Functions1043704
-Ref: Memory Allocation Functions-Footnote-11048205
-Node: Constructor Functions1048304
-Node: API Ownership of MPFR and GMP Values1051957
-Node: Registration Functions1053270
-Node: Extension Functions1053970
-Node: Exit Callback Functions1059292
-Node: Extension Version String1060542
-Node: Input Parsers1061205
-Node: Output Wrappers1073926
-Node: Two-way processors1078438
-Node: Printing Messages1080703
-Ref: Printing Messages-Footnote-11081874
-Node: Updating ERRNO1082027
-Node: Requesting Values1082766
-Ref: table-value-types-returned1083503
-Node: Accessing Parameters1084611
-Node: Symbol Table Access1085848
-Node: Symbol table by name1086360
-Ref: Symbol table by name-Footnote-11089384
-Node: Symbol table by cookie1089512
-Ref: Symbol table by cookie-Footnote-11093697
-Node: Cached values1093761
-Ref: Cached values-Footnote-11097297
-Node: Array Manipulation1097450
-Ref: Array Manipulation-Footnote-11098541
-Node: Array Data Types1098578
-Ref: Array Data Types-Footnote-11101236
-Node: Array Functions1101328
-Node: Flattening Arrays1105826
-Node: Creating Arrays1112802
-Node: Redirection API1117569
-Node: Extension API Variables1120402
-Node: Extension Versioning1121113
-Ref: gawk-api-version1121542
-Node: Extension GMP/MPFR Versioning1123273
-Node: Extension API Informational Variables1124901
-Node: Extension API Boilerplate1125974
-Node: Changes from API V11129948
-Node: Finding Extensions1131520
-Node: Extension Example1132079
-Node: Internal File Description1132877
-Node: Internal File Ops1136957
-Ref: Internal File Ops-Footnote-11148307
-Node: Using Internal File Ops1148447
-Ref: Using Internal File Ops-Footnote-11150830
-Node: Extension Samples1151104
-Node: Extension Sample File Functions1152633
-Node: Extension Sample Fnmatch1160282
-Node: Extension Sample Fork1161769
-Node: Extension Sample Inplace1162987
-Node: Extension Sample Ord1166613
-Node: Extension Sample Readdir1167449
-Ref: table-readdir-file-types1168338
-Node: Extension Sample Revout1169405
-Node: Extension Sample Rev2way1169994
-Node: Extension Sample Read write array1170734
-Node: Extension Sample Readfile1172676
-Node: Extension Sample Time1173771
-Node: Extension Sample API Tests1175523
-Node: gawkextlib1176015
-Node: Extension summary1178933
-Node: Extension Exercises1182635
-Node: Language History1183877
-Node: V7/SVR3.11185533
-Node: SVR41187685
-Node: POSIX1189119
-Node: BTL1190500
-Node: POSIX/GNU1191229
-Node: Feature History1197007
-Node: Common Extensions1213326
-Node: Ranges and Locales1214609
-Ref: Ranges and Locales-Footnote-11219225
-Ref: Ranges and Locales-Footnote-21219252
-Ref: Ranges and Locales-Footnote-31219487
-Node: Contributors1219710
-Node: History summary1225707
-Node: Installation1227087
-Node: Gawk Distribution1228031
-Node: Getting1228515
-Node: Extracting1229478
-Node: Distribution contents1231116
-Node: Unix Installation1237596
-Node: Quick Installation1238278
-Node: Shell Startup Files1240692
-Node: Additional Configuration Options1241781
-Node: Configuration Philosophy1244096
-Node: Non-Unix Installation1246465
-Node: PC Installation1246925
-Node: PC Binary Installation1247763
-Node: PC Compiling1248198
-Node: PC Using1249315
-Node: Cygwin1252868
-Node: MSYS1254092
-Node: VMS Installation1254694
-Node: VMS Compilation1255485
-Ref: VMS Compilation-Footnote-11256714
-Node: VMS Dynamic Extensions1256772
-Node: VMS Installation Details1258457
-Node: VMS Running1260710
-Node: VMS GNV1264989
-Node: VMS Old Gawk1265724
-Node: Bugs1266195
-Node: Bug address1266858
-Node: Usenet1269840
-Node: Maintainers1270844
-Node: Other Versions1272029
-Node: Installation summary1279894
-Node: Notes1281103
-Node: Compatibility Mode1281897
-Node: Additions1282679
-Node: Accessing The Source1283604
-Node: Adding Code1285041
-Node: New Ports1291260
-Node: Derived Files1295635
-Ref: Derived Files-Footnote-11301295
-Ref: Derived Files-Footnote-21301330
-Ref: Derived Files-Footnote-31301928
-Node: Future Extensions1302042
-Node: Implementation Limitations1302700
-Node: Extension Design1303910
-Node: Old Extension Problems1305054
-Ref: Old Extension Problems-Footnote-11306572
-Node: Extension New Mechanism Goals1306629
-Ref: Extension New Mechanism Goals-Footnote-11309993
-Node: Extension Other Design Decisions1310182
-Node: Extension Future Growth1312295
-Node: Notes summary1312901
-Node: Basic Concepts1314059
-Node: Basic High Level1314740
-Ref: figure-general-flow1315022
-Ref: figure-process-flow1315707
-Ref: Basic High Level-Footnote-11319008
-Node: Basic Data Typing1319193
-Node: Glossary1322521
-Node: Copying1354406
-Node: GNU Free Documentation License1391949
-Node: Index1417069
+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 Functions545450
+Ref: Numeric Functions-Footnote-1549477
+Ref: Numeric Functions-Footnote-2550125
+Ref: Numeric Functions-Footnote-3550173
+Node: String Functions550445
+Ref: String Functions-Footnote-1574586
+Ref: String Functions-Footnote-2574714
+Ref: String Functions-Footnote-3574962
+Node: Gory Details575049
+Ref: table-sub-escapes576840
+Ref: table-sub-proposed578359
+Ref: table-posix-sub579722
+Ref: table-gensub-escapes581263
+Ref: Gory Details-Footnote-1582086
+Node: I/O Functions582240
+Ref: table-system-return-values588694
+Ref: I/O Functions-Footnote-1590774
+Ref: I/O Functions-Footnote-2590922
+Node: Time Functions591042
+Ref: Time Functions-Footnote-1601713
+Ref: Time Functions-Footnote-2601781
+Ref: Time Functions-Footnote-3601939
+Ref: Time Functions-Footnote-4602050
+Ref: Time Functions-Footnote-5602162
+Ref: Time Functions-Footnote-6602389
+Node: Bitwise Functions602655
+Ref: table-bitwise-ops603249
+Ref: Bitwise Functions-Footnote-1609312
+Ref: Bitwise Functions-Footnote-2609485
+Node: Type Functions609676
+Node: I18N Functions612630
+Node: User-defined614281
+Node: Definition Syntax615093
+Ref: Definition Syntax-Footnote-1620787
+Node: Function Example620858
+Ref: Function Example-Footnote-1623780
+Node: Function Calling623802
+Node: Calling A Function624390
+Node: Variable Scope625348
+Node: Pass By Value/Reference628342
+Node: Function Caveats630986
+Ref: Function Caveats-Footnote-1633033
+Node: Return Statement633153
+Node: Dynamic Typing636132
+Node: Indirect Calls637062
+Ref: Indirect Calls-Footnote-1647317
+Node: Functions Summary647445
+Node: Library Functions650150
+Ref: Library Functions-Footnote-1653757
+Ref: Library Functions-Footnote-2653900
+Node: Library Names654071
+Ref: Library Names-Footnote-1657738
+Ref: Library Names-Footnote-2657961
+Node: General Functions658047
+Node: Strtonum Function659150
+Node: Assert Function662172
+Node: Round Function665498
+Node: Cliff Random Function667038
+Node: Ordinal Functions668054
+Ref: Ordinal Functions-Footnote-1671117
+Ref: Ordinal Functions-Footnote-2671369
+Node: Join Function671579
+Ref: Join Function-Footnote-1673349
+Node: Getlocaltime Function673549
+Node: Readfile Function677291
+Node: Shell Quoting679268
+Node: Data File Management680669
+Node: Filetrans Function681301
+Node: Rewind Function685397
+Node: File Checking687306
+Ref: File Checking-Footnote-1688640
+Node: Empty Files688841
+Node: Ignoring Assigns690820
+Node: Getopt Function692370
+Ref: Getopt Function-Footnote-1707581
+Node: Passwd Functions707781
+Ref: Passwd Functions-Footnote-1716620
+Node: Group Functions716708
+Ref: Group Functions-Footnote-1724606
+Node: Walking Arrays724813
+Node: Library Functions Summary727821
+Node: Library Exercises729227
+Node: Sample Programs729692
+Node: Running Examples730462
+Node: Clones731190
+Node: Cut Program732414
+Node: Egrep Program742554
+Node: Id Program751555
+Node: Split Program761502
+Ref: Split Program-Footnote-1771392
+Node: Tee Program771565
+Node: Uniq Program774355
+Node: Wc Program781943
+Node: Bytes vs. Characters782330
+Node: Using extensions783878
+Node: wc program784632
+Node: Miscellaneous Programs789497
+Node: Dupword Program790710
+Node: Alarm Program792740
+Node: Translate Program797595
+Ref: Translate Program-Footnote-1802160
+Node: Labels Program802430
+Ref: Labels Program-Footnote-1805781
+Node: Word Sorting805865
+Node: History Sorting809937
+Node: Extract Program812162
+Node: Simple Sed820216
+Node: Igawk Program823290
+Ref: Igawk Program-Footnote-1837621
+Ref: Igawk Program-Footnote-2837823
+Ref: Igawk Program-Footnote-3837945
+Node: Anagram Program838060
+Node: Signature Program841122
+Node: Programs Summary842369
+Node: Programs Exercises843583
+Ref: Programs Exercises-Footnote-1847713
+Node: Advanced Features847799
+Node: Nondecimal Data849930
+Node: Boolean Typed Values851528
+Node: Array Sorting853402
+Node: Controlling Array Traversal854107
+Ref: Controlling Array Traversal-Footnote-1862475
+Node: Array Sorting Functions862593
+Ref: Array Sorting Functions-Footnote-1867684
+Node: Two-way I/O867880
+Ref: Two-way I/O-Footnote-1875601
+Ref: Two-way I/O-Footnote-2875788
+Node: TCP/IP Networking875870
+Node: Profiling878988
+Node: Extension Philosophy888297
+Node: Advanced Features Summary889776
+Node: Internationalization891791
+Node: I18N and L10N893271
+Node: Explaining gettext893958
+Ref: Explaining gettext-Footnote-1899850
+Ref: Explaining gettext-Footnote-2900035
+Node: Programmer i18n900200
+Ref: Programmer i18n-Footnote-1905149
+Node: Translator i18n905198
+Node: String Extraction905992
+Ref: String Extraction-Footnote-1907124
+Node: Printf Ordering907210
+Ref: Printf Ordering-Footnote-1909996
+Node: I18N Portability910060
+Ref: I18N Portability-Footnote-1912516
+Node: I18N Example912579
+Ref: I18N Example-Footnote-1915854
+Ref: I18N Example-Footnote-2915927
+Node: Gawk I18N916036
+Node: I18N Summary916685
+Node: Debugger918026
+Node: Debugging919026
+Node: Debugging Concepts919467
+Node: Debugging Terms921276
+Node: Awk Debugging923851
+Ref: Awk Debugging-Footnote-1924796
+Node: Sample Debugging Session924928
+Node: Debugger Invocation925462
+Node: Finding The Bug926848
+Node: List of Debugger Commands933322
+Node: Breakpoint Control934655
+Node: Debugger Execution Control938349
+Node: Viewing And Changing Data941711
+Node: Execution Stack945252
+Node: Debugger Info946889
+Node: Miscellaneous Debugger Commands950960
+Node: Readline Support956022
+Node: Limitations956918
+Node: Debugging Summary959472
+Node: Namespaces960751
+Node: Global Namespace961862
+Node: Qualified Names963260
+Node: Default Namespace964259
+Node: Changing The Namespace965000
+Node: Naming Rules966614
+Node: Internal Name Management968462
+Node: Namespace Example969504
+Node: Namespace And Features972066
+Node: Namespace Summary973501
+Node: Arbitrary Precision Arithmetic974978
+Node: Computer Arithmetic976465
+Ref: table-numeric-ranges980231
+Ref: table-floating-point-ranges980724
+Ref: Computer Arithmetic-Footnote-1981382
+Node: Math Definitions981439
+Ref: table-ieee-formats984415
+Node: MPFR features984982
+Node: FP Math Caution986700
+Ref: FP Math Caution-Footnote-1987772
+Node: Inexactness of computations988141
+Node: Inexact representation989172
+Node: Comparing FP Values990532
+Node: Errors accumulate991773
+Node: Strange values993229
+Ref: Strange values-Footnote-1995817
+Node: Getting Accuracy995922
+Node: Try To Round998632
+Node: Setting precision999531
+Ref: table-predefined-precision-strings1000228
+Node: Setting the rounding mode1002058
+Ref: table-gawk-rounding-modes1002432
+Ref: Setting the rounding mode-Footnote-11006363
+Node: Arbitrary Precision Integers1006542
+Ref: Arbitrary Precision Integers-Footnote-11009717
+Node: Checking for MPFR1009866
+Node: POSIX Floating Point Problems1011340
+Ref: POSIX Floating Point Problems-Footnote-11015625
+Node: Floating point summary1015663
+Node: Dynamic Extensions1017853
+Node: Extension Intro1019406
+Node: Plugin License1020672
+Node: Extension Mechanism Outline1021469
+Ref: figure-load-extension1021908
+Ref: figure-register-new-function1023473
+Ref: figure-call-new-function1024565
+Node: Extension API Description1026627
+Node: Extension API Functions Introduction1028340
+Ref: table-api-std-headers1030176
+Node: General Data Types1034425
+Ref: General Data Types-Footnote-11043131
+Node: Memory Allocation Functions1043430
+Ref: Memory Allocation Functions-Footnote-11047931
+Node: Constructor Functions1048030
+Node: API Ownership of MPFR and GMP Values1051683
+Node: Registration Functions1052996
+Node: Extension Functions1053696
+Node: Exit Callback Functions1059018
+Node: Extension Version String1060268
+Node: Input Parsers1060931
+Node: Output Wrappers1073652
+Node: Two-way processors1078164
+Node: Printing Messages1080429
+Ref: Printing Messages-Footnote-11081600
+Node: Updating ERRNO1081753
+Node: Requesting Values1082492
+Ref: table-value-types-returned1083229
+Node: Accessing Parameters1084337
+Node: Symbol Table Access1085574
+Node: Symbol table by name1086086
+Ref: Symbol table by name-Footnote-11089110
+Node: Symbol table by cookie1089238
+Ref: Symbol table by cookie-Footnote-11093423
+Node: Cached values1093487
+Ref: Cached values-Footnote-11097023
+Node: Array Manipulation1097176
+Ref: Array Manipulation-Footnote-11098267
+Node: Array Data Types1098304
+Ref: Array Data Types-Footnote-11100962
+Node: Array Functions1101054
+Node: Flattening Arrays1105552
+Node: Creating Arrays1112528
+Node: Redirection API1117295
+Node: Extension API Variables1120128
+Node: Extension Versioning1120839
+Ref: gawk-api-version1121268
+Node: Extension GMP/MPFR Versioning1122999
+Node: Extension API Informational Variables1124627
+Node: Extension API Boilerplate1125700
+Node: Changes from API V11129674
+Node: Finding Extensions1131246
+Node: Extension Example1131805
+Node: Internal File Description1132603
+Node: Internal File Ops1136683
+Ref: Internal File Ops-Footnote-11148033
+Node: Using Internal File Ops1148173
+Ref: Using Internal File Ops-Footnote-11150556
+Node: Extension Samples1150830
+Node: Extension Sample File Functions1152359
+Node: Extension Sample Fnmatch1160008
+Node: Extension Sample Fork1161495
+Node: Extension Sample Inplace1162713
+Node: Extension Sample Ord1166339
+Node: Extension Sample Readdir1167175
+Ref: table-readdir-file-types1168064
+Node: Extension Sample Revout1169131
+Node: Extension Sample Rev2way1169720
+Node: Extension Sample Read write array1170460
+Node: Extension Sample Readfile1172402
+Node: Extension Sample Time1173497
+Node: Extension Sample API Tests1175249
+Node: gawkextlib1175741
+Node: Extension summary1178659
+Node: Extension Exercises1182361
+Node: Language History1183603
+Node: V7/SVR3.11185259
+Node: SVR41187411
+Node: POSIX1188845
+Node: BTL1190226
+Node: POSIX/GNU1190955
+Node: Feature History1196733
+Node: Common Extensions1213052
+Node: Ranges and Locales1214335
+Ref: Ranges and Locales-Footnote-11218951
+Ref: Ranges and Locales-Footnote-21218978
+Ref: Ranges and Locales-Footnote-31219213
+Node: Contributors1219436
+Node: History summary1225433
+Node: Installation1226813
+Node: Gawk Distribution1227757
+Node: Getting1228241
+Node: Extracting1229204
+Node: Distribution contents1230842
+Node: Unix Installation1237322
+Node: Quick Installation1238004
+Node: Shell Startup Files1240418
+Node: Additional Configuration Options1241507
+Node: Configuration Philosophy1243822
+Node: Non-Unix Installation1246191
+Node: PC Installation1246651
+Node: PC Binary Installation1247489
+Node: PC Compiling1247924
+Node: PC Using1249041
+Node: Cygwin1252594
+Node: MSYS1253818
+Node: VMS Installation1254420
+Node: VMS Compilation1255211
+Ref: VMS Compilation-Footnote-11256440
+Node: VMS Dynamic Extensions1256498
+Node: VMS Installation Details1258183
+Node: VMS Running1260436
+Node: VMS GNV1264715
+Node: VMS Old Gawk1265450
+Node: Bugs1265921
+Node: Bug address1266584
+Node: Usenet1269566
+Node: Maintainers1270570
+Node: Other Versions1271755
+Node: Installation summary1279620
+Node: Notes1280829
+Node: Compatibility Mode1281623
+Node: Additions1282405
+Node: Accessing The Source1283330
+Node: Adding Code1284767
+Node: New Ports1290986
+Node: Derived Files1295361
+Ref: Derived Files-Footnote-11301021
+Ref: Derived Files-Footnote-21301056
+Ref: Derived Files-Footnote-31301654
+Node: Future Extensions1301768
+Node: Implementation Limitations1302426
+Node: Extension Design1303636
+Node: Old Extension Problems1304780
+Ref: Old Extension Problems-Footnote-11306298
+Node: Extension New Mechanism Goals1306355
+Ref: Extension New Mechanism Goals-Footnote-11309719
+Node: Extension Other Design Decisions1309908
+Node: Extension Future Growth1312021
+Node: Notes summary1312627
+Node: Basic Concepts1313785
+Node: Basic High Level1314466
+Ref: figure-general-flow1314748
+Ref: figure-process-flow1315433
+Ref: Basic High Level-Footnote-11318734
+Node: Basic Data Typing1318919
+Node: Glossary1322247
+Node: Copying1354134
+Node: GNU Free Documentation License1391677
+Node: Index1416797
 
 End Tag Table
 
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 888973e..06c3d90 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -17515,8 +17515,7 @@ Any index with a non-numeric value will end up 
positioned as if it were zero.
 Order by element values in ascending order (rather than by indices).
 Ordering is by the type assigned to the element
 (@pxref{Typing and Comparison}).
-All Boolean values come before all numeric values (@pxref{Boolean Typed 
Values}),
-and all numeric values come before all string values,
+All numeric values come before all string values,
 which in turn come before all subarrays.
 (Subarrays have not been described yet;
 @pxref{Arrays of Arrays}.)
@@ -18394,9 +18393,9 @@ available in compatibility mode (@pxref{Options}):
 @item @code{bool(@var{expression})}
 @cindexgawkfunc{bool}
 Return a Boolean-typed value based on the regular Boolean value
-of @var{expression}.  Boolean ``true'' values have numeric value one
-and string value @code{"TRUE"}. Boolean ``false'' values have numeric
-zero and string value @code{"FALSE"}.  This is discussed in more
+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
 
@@ -20916,15 +20915,15 @@ Return one of the following strings, depending upon 
the type of @var{x}:
 @item "array"
 @var{x} is an array.
 
-@item "bool"
-@var{x} is a Boolean typed value (@pxref{Boolean Typed Values}).
-
 @item "regexp"
 @var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
 
 @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.
 
@@ -29412,7 +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{bool} type.
+* 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.
@@ -29504,16 +29503,18 @@ To solve this problem, @command{gawk} provides a 
function named @code{bool()}.
 It takes one argument, which is any @command{awk} expression, and it
 returns a value of Boolean type.
 
-The returned values are different than normal @command{awk} values. When
-treated as numbers, they are either one or zero, depending upon the truth
-value of the original expression passed in the call to @code{bool()}. When
-treated as strings, they are either @code{"TRUE"} or @code{"FALSE"},
-again depending upon the truth value of the expression passed in the
-call to @code{bool()}. The value for ``false'' is thus unusual; it is
-zero numerically, but not empty when treated as a string.
+@c HERE
+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{"bool"} for these values.
+@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
@@ -45304,8 +45305,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 b1eca3b..57a87eb 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -16656,8 +16656,7 @@ Any index with a non-numeric value will end up 
positioned as if it were zero.
 Order by element values in ascending order (rather than by indices).
 Ordering is by the type assigned to the element
 (@pxref{Typing and Comparison}).
-All Boolean values come before all numeric values (@pxref{Boolean Typed 
Values}),
-and all numeric values come before all string values,
+All numeric values come before all string values,
 which in turn come before all subarrays.
 (Subarrays have not been described yet;
 @pxref{Arrays of Arrays}.)
@@ -17535,9 +17534,9 @@ available in compatibility mode (@pxref{Options}):
 @item @code{bool(@var{expression})}
 @cindexgawkfunc{bool}
 Return a Boolean-typed value based on the regular Boolean value
-of @var{expression}.  Boolean ``true'' values have numeric value one
-and string value @code{"TRUE"}. Boolean ``false'' values have numeric
-zero and string value @code{"FALSE"}.  This is discussed in more
+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
 
@@ -19828,15 +19827,15 @@ Return one of the following strings, depending upon 
the type of @var{x}:
 @item "array"
 @var{x} is an array.
 
-@item "bool"
-@var{x} is a Boolean typed value (@pxref{Boolean Typed Values}).
-
 @item "regexp"
 @var{x} is a strongly typed regexp (@pxref{Strong Regexp Constants}).
 
 @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.
 
@@ -28294,7 +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{bool} type.
+* 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.
@@ -28386,16 +28385,18 @@ To solve this problem, @command{gawk} provides a 
function named @code{bool()}.
 It takes one argument, which is any @command{awk} expression, and it
 returns a value of Boolean type.
 
-The returned values are different than normal @command{awk} values. When
-treated as numbers, they are either one or zero, depending upon the truth
-value of the original expression passed in the call to @code{bool()}. When
-treated as strings, they are either @code{"TRUE"} or @code{"FALSE"},
-again depending upon the truth value of the expression passed in the
-call to @code{bool()}. The value for ``false'' is thus unusual; it is
-zero numerically, but not empty when treated as a string.
+@c HERE
+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{"bool"} for these values.
+@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
@@ -44147,8 +44148,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/field.c b/field.c
index 2bd5886..c21046b 100644
--- a/field.c
+++ b/field.c
@@ -1019,7 +1019,6 @@ do_split(int nargs)
        assoc_clear(arr);
 
        src = TOP_STRING();
-       warn_bool("split", 1, src);
        if (src->stlen == 0) {
                /*
                 * Skip the work if first arg is the null string.
@@ -1097,7 +1096,6 @@ do_patsplit(int nargs)
                        _("%s: cannot use %s as second argument"));
 
        src = TOP_STRING();
-       warn_bool("patsplit", 1, src);
 
        if ((sep->flags & REGEX) != 0)
                sep = sep->typed_re;
diff --git a/gawkapi.c b/gawkapi.c
index e8a9c31..cdae4d5 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -600,7 +600,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, 
awk_valtype_t wanted)
 
                case AWK_STRNUM:
                        switch (fixtype(node)->flags & 
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
-                       case BOOL:
+                       case NUMBER|BOOL:
                                val->val_type = AWK_BOOL;
                                break;
                        case STRING:
@@ -640,7 +640,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, 
awk_valtype_t wanted)
                        case STRING:
                                val->val_type = AWK_STRING;
                                break;
-                       case BOOL:
+                       case NUMBER|BOOL:
                                val->val_type = AWK_BOOL;
                                break;
                        case NUMBER:
@@ -668,7 +668,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, 
awk_valtype_t wanted)
 
                case AWK_SCALAR:
                        switch (fixtype(node)->flags & 
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
-                       case BOOL:
+                       case NUMBER|BOOL:
                                val->val_type = AWK_BOOL;
                                break;
                        case STRING:
@@ -699,7 +699,7 @@ node_to_awk_value(NODE *node, awk_value_t *val, 
awk_valtype_t wanted)
                case AWK_UNDEFINED:
                        /* return true and actual type for request of undefined 
*/
                        switch (fixtype(node)->flags & 
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
-                       case BOOL:
+                       case NUMBER|BOOL:
                                assign_bool(node, val);
                                ret = awk_true;
                                break;
diff --git a/node.c b/node.c
index dda90f0..cbf5c56 100644
--- a/node.c
+++ b/node.c
@@ -1092,13 +1092,12 @@ make_bool_node(bool value)
        const char *sval;
        AWKNUM nval;
 
-       sval = (value ? "TRUE" : "FALSE");
+       sval = (value ? "1" : "0");
        nval = (value ? 1.0 : 0.0);
 
        val = make_number(nval);
        val->stptr = estrdup(sval, strlen(sval));
        val->stlen = strlen(sval);
-       val->flags &= ~NUMBER;
        val->flags |= NUMCUR|STRCUR|BOOL;
        val->stfmt = STFMT_UNUSED;
 
diff --git a/test/ChangeLog b/test/ChangeLog
index b357485..6ae679e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2021-04-28         Arnold D. Robbins     <arnold@skeeve.com>
+
+       * asortbool.ok: Revise after code changes.
+       * rwarray.awk: Ditto.
+
 2021-04-14         Arnold D. Robbins     <arnold@skeeve.com>
 
        * noeffect.awk: Add more test cases. Thanks to Wolfgang Laun
diff --git a/test/asortbool.ok b/test/asortbool.ok
index de08a77..623e417 100644
--- a/test/asortbool.ok
+++ b/test/asortbool.ok
@@ -1,6 +1,6 @@
-1, bool: FALSE
-2, bool: TRUE
-3, number: -45
+1, number: -45
+2, number|bool: 0
+3, number|bool: 1
 4, number: 45
 5, string: foo
 6, array: 47
diff --git a/test/rwarray.awk b/test/rwarray.awk
index 831f17c..b868fa4 100644
--- a/test/rwarray.awk
+++ b/test/rwarray.awk
@@ -55,11 +55,11 @@ BEGIN {
                printf("dict[\"%s\"] should be strnum, is %s\n",
                        strnum_sub, typeof(dict[strnum_sub]));
 
-       if (typeof(dict[bool_sub]) != "bool")
-               printf("dict[\"%s\"] should be bool, is %s\n",
+       if (typeof(dict[bool_sub]) != "number|bool")
+               printf("dict[\"%s\"] should be number|bool, is %s\n",
                        bool_sub, typeof(dict[bool_sub]));
 
-       if ((dict[bool_sub] "") != "TRUE")
-               printf("dict[\"%s\"] should be TRUE, is %s\n",
+       if ((dict[bool_sub] "") != "1")
+               printf("dict[\"%s\"] should be 1, is %s\n",
                        bool_sub, dict[bool_sub]);
 }

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

Summary of changes:
 ChangeLog         |  13 +
 array.c           |  16 +-
 awk.h             |   1 -
 builtin.c         |  22 +-
 doc/ChangeLog     |   7 +
 doc/awkcard.in    |   5 +-
 doc/gawk.1        |   6 +-
 doc/gawk.info     | 787 +++++++++++++++++++++++++++---------------------------
 doc/gawk.texi     |  39 +--
 doc/gawktexi.in   |  39 +--
 field.c           |   2 -
 gawkapi.c         |   8 +-
 node.c            |   3 +-
 test/ChangeLog    |   5 +
 test/asortbool.ok |   6 +-
 test/rwarray.awk  |   8 +-
 16 files changed, 478 insertions(+), 489 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

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