[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4265-g1fc3d1c
From: |
Arnold Robbins |
Subject: |
[SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4265-g1fc3d1c |
Date: |
Mon, 22 Mar 2021 10:33:56 -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 1fc3d1cbc5c31ecd7b232e8845530ce6a6760986 (commit)
from efc5713d00a0019eb33c8a61c8a5514da7fa303e (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=1fc3d1cbc5c31ecd7b232e8845530ce6a6760986
commit 1fc3d1cbc5c31ecd7b232e8845530ce6a6760986
Author: Arnold D. Robbins <arnold@skeeve.com>
Date: Mon Mar 22 16:33:36 2021 +0200
Progress on extension support for boolean types.
diff --git a/ChangeLog b/ChangeLog
index 5f0bef1..3682123 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * gawkapi.h (make_bool): New inline function.
+ Update table of request/return types.
+ * gawkapi.c (awk_value_to_node): Add support for AWK_BOOL.
+ (node_to_awk_value): Start on same. Not yet complete.
+
2021-03-21 Arnold D. Robbins <arnold@skeeve.com>
* str_array.c (fnv1a_hash_string): New function.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 3dd82e0..748f24f 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+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"
diff --git a/doc/gawk.info b/doc/gawk.info
index 445d06d..1337e0e 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -25483,7 +25483,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'.
@@ -25496,6 +25497,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
@@ -25511,6 +25513,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.
@@ -25821,6 +25824,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
@@ -26546,16 +26554,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
@@ -38532,145 +38541,145 @@ Node: Extension API Description1022630
Node: Extension API Functions Introduction1024343
Ref: table-api-std-headers1026179
Node: General Data Types1030428
-Ref: General Data Types-Footnote-11039058
-Node: Memory Allocation Functions1039357
-Ref: Memory Allocation Functions-Footnote-11043858
-Node: Constructor Functions1043957
-Node: API Ownership of MPFR and GMP Values1047423
-Node: Registration Functions1048736
-Node: Extension Functions1049436
-Node: Exit Callback Functions1054758
-Node: Extension Version String1056008
-Node: Input Parsers1056671
-Node: Output Wrappers1069392
-Node: Two-way processors1073904
-Node: Printing Messages1076169
-Ref: Printing Messages-Footnote-11077340
-Node: Updating ERRNO1077493
-Node: Requesting Values1078232
-Ref: table-value-types-returned1078969
-Node: Accessing Parameters1079905
-Node: Symbol Table Access1081142
-Node: Symbol table by name1081654
-Ref: Symbol table by name-Footnote-11084678
-Node: Symbol table by cookie1084806
-Ref: Symbol table by cookie-Footnote-11088991
-Node: Cached values1089055
-Ref: Cached values-Footnote-11092591
-Node: Array Manipulation1092744
-Ref: Array Manipulation-Footnote-11093835
-Node: Array Data Types1093872
-Ref: Array Data Types-Footnote-11096530
-Node: Array Functions1096622
-Node: Flattening Arrays1101120
-Node: Creating Arrays1108096
-Node: Redirection API1112863
-Node: Extension API Variables1115696
-Node: Extension Versioning1116407
-Ref: gawk-api-version1116836
-Node: Extension GMP/MPFR Versioning1118567
-Node: Extension API Informational Variables1120195
-Node: Extension API Boilerplate1121268
-Node: Changes from API V11125242
-Node: Finding Extensions1126814
-Node: Extension Example1127373
-Node: Internal File Description1128171
-Node: Internal File Ops1132251
-Ref: Internal File Ops-Footnote-11143601
-Node: Using Internal File Ops1143741
-Ref: Using Internal File Ops-Footnote-11146124
-Node: Extension Samples1146398
-Node: Extension Sample File Functions1147927
-Node: Extension Sample Fnmatch1155576
-Node: Extension Sample Fork1157063
-Node: Extension Sample Inplace1158281
-Node: Extension Sample Ord1161907
-Node: Extension Sample Readdir1162743
-Ref: table-readdir-file-types1163632
-Node: Extension Sample Revout1164699
-Node: Extension Sample Rev2way1165288
-Node: Extension Sample Read write array1166028
-Node: Extension Sample Readfile1167970
-Node: Extension Sample Time1169065
-Node: Extension Sample API Tests1170817
-Node: gawkextlib1171309
-Node: Extension summary1174227
-Node: Extension Exercises1177929
-Node: Language History1179171
-Node: V7/SVR3.11180827
-Node: SVR41182979
-Node: POSIX1184413
-Node: BTL1185794
-Node: POSIX/GNU1186523
-Node: Feature History1192301
-Node: Common Extensions1208620
-Node: Ranges and Locales1209903
-Ref: Ranges and Locales-Footnote-11214519
-Ref: Ranges and Locales-Footnote-21214546
-Ref: Ranges and Locales-Footnote-31214781
-Node: Contributors1215004
-Node: History summary1221001
-Node: Installation1222381
-Node: Gawk Distribution1223325
-Node: Getting1223809
-Node: Extracting1224772
-Node: Distribution contents1226410
-Node: Unix Installation1232890
-Node: Quick Installation1233572
-Node: Shell Startup Files1235986
-Node: Additional Configuration Options1237075
-Node: Configuration Philosophy1239390
-Node: Non-Unix Installation1241759
-Node: PC Installation1242219
-Node: PC Binary Installation1243057
-Node: PC Compiling1243492
-Node: PC Using1244609
-Node: Cygwin1248162
-Node: MSYS1249386
-Node: VMS Installation1249988
-Node: VMS Compilation1250779
-Ref: VMS Compilation-Footnote-11252008
-Node: VMS Dynamic Extensions1252066
-Node: VMS Installation Details1253751
-Node: VMS Running1256004
-Node: VMS GNV1260283
-Node: VMS Old Gawk1261018
-Node: Bugs1261489
-Node: Bug address1262152
-Node: Usenet1265134
-Node: Maintainers1266138
-Node: Other Versions1267323
-Node: Installation summary1275188
-Node: Notes1276397
-Node: Compatibility Mode1277191
-Node: Additions1277973
-Node: Accessing The Source1278898
-Node: Adding Code1280335
-Node: New Ports1286554
-Node: Derived Files1290929
-Ref: Derived Files-Footnote-11296589
-Ref: Derived Files-Footnote-21296624
-Ref: Derived Files-Footnote-31297222
-Node: Future Extensions1297336
-Node: Implementation Limitations1297994
-Node: Extension Design1299204
-Node: Old Extension Problems1300348
-Ref: Old Extension Problems-Footnote-11301866
-Node: Extension New Mechanism Goals1301923
-Ref: Extension New Mechanism Goals-Footnote-11305287
-Node: Extension Other Design Decisions1305476
-Node: Extension Future Growth1307589
-Node: Notes summary1308195
-Node: Basic Concepts1309353
-Node: Basic High Level1310034
-Ref: figure-general-flow1310316
-Ref: figure-process-flow1311001
-Ref: Basic High Level-Footnote-11314302
-Node: Basic Data Typing1314487
-Node: Glossary1317815
-Node: Copying1349700
-Node: GNU Free Documentation License1387243
-Node: Index1412363
+Ref: General Data Types-Footnote-11039134
+Node: Memory Allocation Functions1039433
+Ref: Memory Allocation Functions-Footnote-11043934
+Node: Constructor Functions1044033
+Node: API Ownership of MPFR and GMP Values1047686
+Node: Registration Functions1048999
+Node: Extension Functions1049699
+Node: Exit Callback Functions1055021
+Node: Extension Version String1056271
+Node: Input Parsers1056934
+Node: Output Wrappers1069655
+Node: Two-way processors1074167
+Node: Printing Messages1076432
+Ref: Printing Messages-Footnote-11077603
+Node: Updating ERRNO1077756
+Node: Requesting Values1078495
+Ref: table-value-types-returned1079232
+Node: Accessing Parameters1080340
+Node: Symbol Table Access1081577
+Node: Symbol table by name1082089
+Ref: Symbol table by name-Footnote-11085113
+Node: Symbol table by cookie1085241
+Ref: Symbol table by cookie-Footnote-11089426
+Node: Cached values1089490
+Ref: Cached values-Footnote-11093026
+Node: Array Manipulation1093179
+Ref: Array Manipulation-Footnote-11094270
+Node: Array Data Types1094307
+Ref: Array Data Types-Footnote-11096965
+Node: Array Functions1097057
+Node: Flattening Arrays1101555
+Node: Creating Arrays1108531
+Node: Redirection API1113298
+Node: Extension API Variables1116131
+Node: Extension Versioning1116842
+Ref: gawk-api-version1117271
+Node: Extension GMP/MPFR Versioning1119002
+Node: Extension API Informational Variables1120630
+Node: Extension API Boilerplate1121703
+Node: Changes from API V11125677
+Node: Finding Extensions1127249
+Node: Extension Example1127808
+Node: Internal File Description1128606
+Node: Internal File Ops1132686
+Ref: Internal File Ops-Footnote-11144036
+Node: Using Internal File Ops1144176
+Ref: Using Internal File Ops-Footnote-11146559
+Node: Extension Samples1146833
+Node: Extension Sample File Functions1148362
+Node: Extension Sample Fnmatch1156011
+Node: Extension Sample Fork1157498
+Node: Extension Sample Inplace1158716
+Node: Extension Sample Ord1162342
+Node: Extension Sample Readdir1163178
+Ref: table-readdir-file-types1164067
+Node: Extension Sample Revout1165134
+Node: Extension Sample Rev2way1165723
+Node: Extension Sample Read write array1166463
+Node: Extension Sample Readfile1168405
+Node: Extension Sample Time1169500
+Node: Extension Sample API Tests1171252
+Node: gawkextlib1171744
+Node: Extension summary1174662
+Node: Extension Exercises1178364
+Node: Language History1179606
+Node: V7/SVR3.11181262
+Node: SVR41183414
+Node: POSIX1184848
+Node: BTL1186229
+Node: POSIX/GNU1186958
+Node: Feature History1192736
+Node: Common Extensions1209055
+Node: Ranges and Locales1210338
+Ref: Ranges and Locales-Footnote-11214954
+Ref: Ranges and Locales-Footnote-21214981
+Ref: Ranges and Locales-Footnote-31215216
+Node: Contributors1215439
+Node: History summary1221436
+Node: Installation1222816
+Node: Gawk Distribution1223760
+Node: Getting1224244
+Node: Extracting1225207
+Node: Distribution contents1226845
+Node: Unix Installation1233325
+Node: Quick Installation1234007
+Node: Shell Startup Files1236421
+Node: Additional Configuration Options1237510
+Node: Configuration Philosophy1239825
+Node: Non-Unix Installation1242194
+Node: PC Installation1242654
+Node: PC Binary Installation1243492
+Node: PC Compiling1243927
+Node: PC Using1245044
+Node: Cygwin1248597
+Node: MSYS1249821
+Node: VMS Installation1250423
+Node: VMS Compilation1251214
+Ref: VMS Compilation-Footnote-11252443
+Node: VMS Dynamic Extensions1252501
+Node: VMS Installation Details1254186
+Node: VMS Running1256439
+Node: VMS GNV1260718
+Node: VMS Old Gawk1261453
+Node: Bugs1261924
+Node: Bug address1262587
+Node: Usenet1265569
+Node: Maintainers1266573
+Node: Other Versions1267758
+Node: Installation summary1275623
+Node: Notes1276832
+Node: Compatibility Mode1277626
+Node: Additions1278408
+Node: Accessing The Source1279333
+Node: Adding Code1280770
+Node: New Ports1286989
+Node: Derived Files1291364
+Ref: Derived Files-Footnote-11297024
+Ref: Derived Files-Footnote-21297059
+Ref: Derived Files-Footnote-31297657
+Node: Future Extensions1297771
+Node: Implementation Limitations1298429
+Node: Extension Design1299639
+Node: Old Extension Problems1300783
+Ref: Old Extension Problems-Footnote-11302301
+Node: Extension New Mechanism Goals1302358
+Ref: Extension New Mechanism Goals-Footnote-11305722
+Node: Extension Other Design Decisions1305911
+Node: Extension Future Growth1308024
+Node: Notes summary1308630
+Node: Basic Concepts1309788
+Node: Basic High Level1310469
+Ref: figure-general-flow1310751
+Ref: figure-process-flow1311436
+Ref: Basic High Level-Footnote-11314737
+Node: Basic Data Typing1314922
+Node: Glossary1318250
+Node: Copying1350135
+Node: GNU Free Documentation License1387678
+Node: Index1412798
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index b472316..7e0a7a9 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -35488,7 +35488,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}.
@@ -35501,6 +35502,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.''
@@ -35516,6 +35518,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.
@@ -35843,6 +35846,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
@@ -36643,7 +36651,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>
@@ -36653,6 +36662,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>
@@ -36665,6 +36675,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>
@@ -36677,6 +36688,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>
@@ -36685,6 +36697,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>
@@ -36693,6 +36706,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>
@@ -36700,11 +36714,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>
@@ -36715,6 +36741,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>
@@ -36725,6 +36752,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>
@@ -36737,6 +36765,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>
@@ -36753,43 +36782,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
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 2c2d729..228ea0d 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -34385,7 +34385,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}.
@@ -34398,6 +34399,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.''
@@ -34413,6 +34415,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.
@@ -34740,6 +34743,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
@@ -35540,7 +35548,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>
@@ -35550,6 +35559,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>
@@ -35562,6 +35572,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>
@@ -35574,6 +35585,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>
@@ -35582,6 +35594,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>
@@ -35590,6 +35603,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>
@@ -35597,11 +35611,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>
@@ -35612,6 +35638,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>
@@ -35622,6 +35649,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>
@@ -35634,6 +35662,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>
@@ -35650,43 +35679,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
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 1a01889..053adcd 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -1,3 +1,7 @@
+2021-03-22 Arnold D. Robbins <arnold@skeeve.com>
+
+ * testext.c (valrep2str): Add support for AWK_BOOL.
+
2020-07-26 Arnold D. Robbins <arnold@skeeve.com>
* intdiv.c (do_intdiv): Change quotient and remainder to
diff --git a/extension/testext.c b/extension/testext.c
index b911ec9..3acfb19 100644
--- a/extension/testext.c
+++ b/extension/testext.c
@@ -88,6 +88,13 @@ valrep2str(const awk_value_t *value)
size,
value->str_value.str);
break;
+ case AWK_BOOL:
+ if (value->str_value.len + 8 < size)
+ size = value->str_value.len;
+ sprintf(buf, "<bool>: %.*s",
+ size,
+ value->str_value.str);
+ break;
case AWK_NUMBER:
sprintf(buf, "%g", value->num_value);
break;
diff --git a/gawkapi.c b/gawkapi.c
index a60549d..929c36b 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -160,6 +160,9 @@ awk_value_to_node(const awk_value_t *retval)
case AWK_UNDEFINED:
ext_ret_val = dupnode(Nnull_string);
break;
+ case AWK_BOOL:
+ ext_ret_val = make_bool_node(retval->bool_value != awk_false);
+ break;
case AWK_NUMBER:
switch (retval->num_type) {
case AWK_NUMBER_TYPE_DOUBLE:
@@ -567,9 +570,20 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
case Node_val:
/* a scalar value */
switch (wanted) {
+ case AWK_BOOL:
+ if ((node->flags & BOOL) != 0) {
+ val->val_type = AWK_BOOL;
+ val->bool_value = (get_number_si(node) ?
awk_true : awk_false);
+ ret = awk_true;
+ } else {
+ ret = awk_false;
+ }
+ break;
case AWK_NUMBER:
- if (node->flags & REGEX)
+ if ((node->flags & REGEX) != 0)
val->val_type = AWK_REGEX;
+ else if ((node->flags & BOOL) != 0)
+ val->val_type = AWK_BOOL;
else {
(void) force_number(node);
assign_number(node, val);
@@ -578,7 +592,10 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
break;
case AWK_STRNUM:
- switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case STRING:
val->val_type = AWK_STRING;
break;
@@ -612,10 +629,13 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
break;
case AWK_REGEX:
- switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
case STRING:
val->val_type = AWK_STRING;
break;
+ case BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case NUMBER:
val->val_type = AWK_NUMBER;
break;
@@ -640,7 +660,10 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
break;
case AWK_SCALAR:
- switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case BOOL:
+ val->val_type = AWK_BOOL;
+ break;
case STRING:
val->val_type = AWK_STRING;
break;
@@ -668,7 +691,12 @@ node_to_awk_value(NODE *node, awk_value_t *val,
awk_valtype_t wanted)
case AWK_UNDEFINED:
/* return true and actual type for request of undefined
*/
- switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX)) {
+ switch (fixtype(node)->flags &
(STRING|NUMBER|USER_INPUT|REGEX|BOOL)) {
+ case BOOL:
+ val->val_type = AWK_BOOL;
+ val->bool_value = (get_number_si(node) ?
awk_true : awk_false);
+ ret = awk_true;
+ break;
case STRING:
assign_string(node, val, AWK_STRING);
ret = awk_true;
diff --git a/gawkapi.h b/gawkapi.h
index 3fd02df..6923360 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -568,8 +568,8 @@ typedef struct gawk_api {
Table entry is type returned:
-
+-------------------------------------------------------+
- | Type of Actual Value:
|
+
+----------------------------------------------------------------+
+ | Type of Actual Value:
|
+--------+--------+--------+--------+--------+-------+-----------+
| String | Strnum | Number | Regex | Bool |
Array | Undefined |
+-----------+-----------+--------+--------+--------+--------+--------+-------+-----------+
@@ -581,10 +581,10 @@ typedef struct gawk_api {
|
+-----------+--------+--------+--------+--------+--------+-------+-----------+
| | Regex | false | false | false | Regex | false |
false | false |
|
+-----------+--------+--------+--------+--------+--------+-------+-----------+
- | | Bool | false | false | false | false | Bool |
false | false |
- |
+-----------+--------+--------+--------+--------+--------+-------+-----------+
- | Type | Array | false | false | false | false | false |
Array | 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 |
@@ -1074,6 +1074,16 @@ make_number_mpfr(void *mpfr_ptr, awk_value_t *result)
return result;
}
+/* make_bool --- make a bool value in result */
+
+static inline awk_value_t *
+make_bool(awk_bool_t boolval, awk_value_t *result)
+{
+ result->val_type = AWK_BOOL;
+ result->bool_value = boolval;
+ return result;
+}
+
/*
* Each extension must define a function with this prototype:
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 7 ++
doc/ChangeLog | 4 +
doc/gawk.info | 309 +++++++++++++++++++++++++++-------------------------
doc/gawk.texi | 100 +++++++++++------
doc/gawktexi.in | 100 +++++++++++------
extension/ChangeLog | 4 +
extension/testext.c | 7 ++
gawkapi.c | 38 ++++++-
gawkapi.h | 20 +++-
9 files changed, 361 insertions(+), 228 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] gawk branch, feature/bool, updated. gawk-4.1.0-4265-g1fc3d1c,
Arnold Robbins <=