diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-22 17:40:01 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-12-22 17:40:01 +0200 |
commit | 1f05c34b1b0d8b0a0c561ce38570d4ed8774f54a (patch) | |
tree | 468a82fdbb9b2903d74250ec1a87e9cb4a7c916f /doc | |
parent | af6f677758c6b873fb3130b34705e2a705270a75 (diff) | |
download | egawk-1f05c34b1b0d8b0a0c561ce38570d4ed8774f54a.tar.gz egawk-1f05c34b1b0d8b0a0c561ce38570d4ed8774f54a.tar.bz2 egawk-1f05c34b1b0d8b0a0c561ce38570d4ed8774f54a.zip |
Finish merging by updating generated docs.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/gawk.info | 344 | ||||
-rw-r--r-- | doc/gawk.texi | 95 |
2 files changed, 254 insertions, 185 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index 67b52f5e..696c8c3e 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -23628,7 +23628,8 @@ use them. ' AWK_ARRAY,' ' AWK_SCALAR, /* opaque access to a variable */' ' AWK_VALUE_COOKIE, /* for updating a previously created value */' -' AWK_REGEX' +' AWK_REGEX,' +' AWK_STRNUM' '} awk_valtype_t;' This 'enum' indicates the type of a value. It is used in the following 'struct'. @@ -23648,6 +23649,7 @@ use them. type. '#define str_value u.s' +'#define strnum_value str_value' '#define regex_value str_value' '#define num_value u.d' '#define array_cookie u.a' @@ -23667,15 +23669,21 @@ use them. This is also discussed in a general fashion in the text following this list, and in more detail in *note Cached values::. - Scalar values in 'awk' are numbers, strings, or typed regexps. The -'awk_value_t' struct represents values. The 'val_type' member indicates -what is in the 'union'. + Scalar values in 'awk' are numbers, strings, strnums, or typed +regexps. The 'awk_value_t' struct represents values. The 'val_type' +member indicates what is in the 'union'. Representing numbers is easy--the API uses a C 'double'. Strings require more work. Because 'gawk' allows embedded NUL bytes in string values, a string must be represented as a pair containing a data pointer and length. This is the 'awk_string_t' type. + A strnum (numeric string) value is represented as a string and +consists of user input data that appears to be numeric. When an +extension attempts to create a strnum value, a string flagged as user +input is created. Subsequent parsing will determine whether it looks +like a number and should be treated as a strnum or a regular string. + Typed regexp values (*note Strong Regexp Constants::) are not of much use to extension functions. Extension functions can tell that they've received them, and create them for scalar values. Otherwise, they can @@ -23842,9 +23850,29 @@ code would use them: variable pointed to by 'result'. 'static inline awk_value_t *' -'make_regex(const char *string, size_t length, awk_value_t *result);' +'make_const_user_input(const char *string, size_t length, awk_value_t *result);' + This function is identical to 'make_const_string', but the string + is flagged as user input that should be treated as a strnum value + if the contents of the string are numeric. + +'static inline awk_value_t *' +'make_malloced_user_input(const char *string, size_t length, awk_value_t *result);' + This function is identical to 'make_malloced_string', but the + string is flagged as user input that should be treated as a strnum + value if the contents of the string are numeric. + +'static inline awk_value_t *' +'make_const_regex(const char *string, size_t length, awk_value_t *result);' + This function creates a strongly typed regexp value by allocating a + copy of the string. 'string' is the regular expression of length + 'len'. + +'static inline awk_value_t *' +'make_malloced_regex(const char *string, size_t length, awk_value_t *result);' This function creates a strongly typed regexp value. 'string' is - the regular expression of length 'len'. + the regular expression of length 'len'. It expects 'string' to be + a 'char *' value pointing to data previously obtained from + 'gawk_malloc()', 'gawk_calloc()', or 'gawk_realloc()'. File: gawk.info, Node: Registration Functions, Next: Printing Messages, Prev: Constructor Functions, Up: Extension API Description @@ -24593,9 +24621,9 @@ was discussed earlier, in *note General Data Types::. 'awk_bool_t sym_update_scalar(awk_scalar_t cookie, awk_value_t *value);' Update the value associated with a scalar cookie. Return false if - the new value is not of type 'AWK_STRING', 'AWK_REGEX', or - 'AWK_NUMBER'. Here too, the predefined variables may not be - updated. + the new value is not of type 'AWK_STRING', 'AWK_STRNUM', + 'AWK_REGEX', or 'AWK_NUMBER'. Here too, the predefined variables + may not be updated. It is not obvious at first glance how to work with scalar cookies or what their raison d'e^tre really is. In theory, the 'sym_lookup()' and @@ -24710,9 +24738,9 @@ follows: 'awk_bool_t create_value(awk_value_t *value, awk_value_cookie_t *result);' Create a cached string or numeric value from 'value' for efficient later assignment. Only values of type 'AWK_NUMBER', 'AWK_REGEX', - and 'AWK_STRING' are allowed. Any other type is rejected. - 'AWK_UNDEFINED' could be allowed, but doing so would result in - inferior performance. + 'AWK_STRNUM', and 'AWK_STRING' are allowed. Any other type is + rejected. 'AWK_UNDEFINED' could be allowed, but doing so would + result in inferior performance. 'awk_bool_t release_value(awk_value_cookie_t vc);' Release the memory associated with a value cookie obtained from @@ -24939,12 +24967,20 @@ The following functions relate to individual array elements: array, but after calling this function, it has no elements. This is equivalent to using the 'delete' statement (*note Delete::). +'awk_bool_t flatten_array_typed(awk_array_t a_cookie, awk_flat_array_t **data, awk_valtype_t index_type, awk_valtype_t value_type);' + For the array represented by 'a_cookie', create an + 'awk_flat_array_t' structure and fill it in with indices and values + of the requested types. Set the pointer whose address is passed as + 'data' to point to this structure. Return true upon success, or + false otherwise. *Note Flattening Arrays::, for a discussion of + how to flatten an array and work with it. + 'awk_bool_t flatten_array(awk_array_t a_cookie, awk_flat_array_t **data);' For the array represented by 'a_cookie', create an - 'awk_flat_array_t' structure and fill it in. Set the pointer whose - address is passed as 'data' to point to this structure. Return - true upon success, or false otherwise. *Note Flattening Arrays::, - for a discussion of how to flatten an array and work with it. + 'awk_flat_array_t' structure and fill it in with 'AWK_STRING' + indices and 'AWK_UNDEFINED' values. This is superseded by + 'flatten_array_typed' and retained only for legacy binary + compatibility. 'awk_bool_t release_flattened_array(awk_array_t a_cookie,' ' awk_flat_array_t *data);' @@ -25046,7 +25082,7 @@ count of elements in the array and print it: double-check that the count in the 'awk_flat_array_t' is the same as the count just retrieved: - if (! flatten_array(value2.array_cookie, & flat_array)) { + if (! flatten_array_typed(value2.array_cookie, & flat_array, AWK_STRING, AWK_UNDEFINED)) { printf("dump_array_and_delete: could not flatten array\n"); goto out; } @@ -35820,142 +35856,142 @@ Ref: figure-call-new-function948497 Node: Extension API Description950559 Node: Extension API Functions Introduction952201 Node: General Data Types957512 -Ref: General Data Types-Footnote-1963823 -Node: Memory Allocation Functions964122 -Ref: Memory Allocation Functions-Footnote-1966967 -Node: Constructor Functions967066 -Node: Registration Functions969028 -Node: Extension Functions969713 -Node: Exit Callback Functions974911 -Node: Extension Version String976161 -Node: Input Parsers976824 -Node: Output Wrappers986706 -Node: Two-way processors991218 -Node: Printing Messages993483 -Ref: Printing Messages-Footnote-1994654 -Node: Updating ERRNO994807 -Node: Requesting Values995546 -Ref: table-value-types-returned996283 -Node: Accessing Parameters997166 -Node: Symbol Table Access998401 -Node: Symbol table by name998913 -Node: Symbol table by cookie1000702 -Ref: Symbol table by cookie-Footnote-11004873 -Node: Cached values1004937 -Ref: Cached values-Footnote-11008458 -Node: Array Manipulation1008549 -Ref: Array Manipulation-Footnote-11009640 -Node: Array Data Types1009677 -Ref: Array Data Types-Footnote-11012335 -Node: Array Functions1012427 -Node: Flattening Arrays1016285 -Node: Creating Arrays1023193 -Node: Redirection API1027962 -Node: Extension API Variables1030793 -Node: Extension Versioning1031426 -Ref: gawk-api-version1031863 -Node: Extension API Informational Variables1033591 -Node: Extension API Boilerplate1034655 -Node: Changes from API V11038517 -Node: Finding Extensions1039177 -Node: Extension Example1039736 -Node: Internal File Description1040534 -Node: Internal File Ops1044614 -Ref: Internal File Ops-Footnote-11056014 -Node: Using Internal File Ops1056154 -Ref: Using Internal File Ops-Footnote-11058537 -Node: Extension Samples1058811 -Node: Extension Sample File Functions1060340 -Node: Extension Sample Fnmatch1067989 -Node: Extension Sample Fork1069476 -Node: Extension Sample Inplace1070694 -Node: Extension Sample Ord1073904 -Node: Extension Sample Readdir1074740 -Ref: table-readdir-file-types1075629 -Node: Extension Sample Revout1076434 -Node: Extension Sample Rev2way1077023 -Node: Extension Sample Read write array1077763 -Node: Extension Sample Readfile1079705 -Node: Extension Sample Time1080800 -Node: Extension Sample API Tests1082148 -Node: gawkextlib1082640 -Node: Extension summary1085087 -Node: Extension Exercises1088789 -Node: Language History1090287 -Node: V7/SVR3.11091943 -Node: SVR41094095 -Node: POSIX1095529 -Node: BTL1096908 -Node: POSIX/GNU1097637 -Node: Feature History1103499 -Node: Common Extensions1117869 -Node: Ranges and Locales1119152 -Ref: Ranges and Locales-Footnote-11123768 -Ref: Ranges and Locales-Footnote-21123795 -Ref: Ranges and Locales-Footnote-31124030 -Node: Contributors1124251 -Node: History summary1129811 -Node: Installation1131191 -Node: Gawk Distribution1132135 -Node: Getting1132619 -Node: Extracting1133580 -Node: Distribution contents1135218 -Node: Unix Installation1141303 -Node: Quick Installation1141985 -Node: Shell Startup Files1144399 -Node: Additional Configuration Options1145477 -Node: Configuration Philosophy1147282 -Node: Non-Unix Installation1149651 -Node: PC Installation1150111 -Node: PC Binary Installation1150949 -Node: PC Compiling1151384 -Node: PC Using1152501 -Node: Cygwin1155546 -Node: MSYS1156316 -Node: VMS Installation1156817 -Node: VMS Compilation1157608 -Ref: VMS Compilation-Footnote-11158837 -Node: VMS Dynamic Extensions1158895 -Node: VMS Installation Details1160580 -Node: VMS Running1162833 -Node: VMS GNV1167112 -Node: VMS Old Gawk1167847 -Node: Bugs1168318 -Node: Bug address1168981 -Node: Usenet1171378 -Node: Maintainers1172153 -Node: Other Versions1173529 -Node: Installation summary1180113 -Node: Notes1181148 -Node: Compatibility Mode1182013 -Node: Additions1182795 -Node: Accessing The Source1183720 -Node: Adding Code1185155 -Node: New Ports1191374 -Node: Derived Files1195862 -Ref: Derived Files-Footnote-11201347 -Ref: Derived Files-Footnote-21201382 -Ref: Derived Files-Footnote-31201980 -Node: Future Extensions1202094 -Node: Implementation Limitations1202752 -Node: Extension Design1203935 -Node: Old Extension Problems1205089 -Ref: Old Extension Problems-Footnote-11206607 -Node: Extension New Mechanism Goals1206664 -Ref: Extension New Mechanism Goals-Footnote-11210028 -Node: Extension Other Design Decisions1210217 -Node: Extension Future Growth1212330 -Node: Old Extension Mechanism1213166 -Node: Notes summary1214929 -Node: Basic Concepts1216111 -Node: Basic High Level1216792 -Ref: figure-general-flow1217074 -Ref: figure-process-flow1217759 -Ref: Basic High Level-Footnote-11221060 -Node: Basic Data Typing1221245 -Node: Glossary1224573 -Node: Copying1256520 -Node: GNU Free Documentation License1294059 -Node: Index1319177 +Ref: General Data Types-Footnote-1964227 +Node: Memory Allocation Functions964526 +Ref: Memory Allocation Functions-Footnote-1967371 +Node: Constructor Functions967470 +Node: Registration Functions970465 +Node: Extension Functions971150 +Node: Exit Callback Functions976348 +Node: Extension Version String977598 +Node: Input Parsers978261 +Node: Output Wrappers988143 +Node: Two-way processors992655 +Node: Printing Messages994920 +Ref: Printing Messages-Footnote-1996091 +Node: Updating ERRNO996244 +Node: Requesting Values996983 +Ref: table-value-types-returned997720 +Node: Accessing Parameters998603 +Node: Symbol Table Access999838 +Node: Symbol table by name1000350 +Node: Symbol table by cookie1002139 +Ref: Symbol table by cookie-Footnote-11006324 +Node: Cached values1006388 +Ref: Cached values-Footnote-11009924 +Node: Array Manipulation1010015 +Ref: Array Manipulation-Footnote-11011106 +Node: Array Data Types1011143 +Ref: Array Data Types-Footnote-11013801 +Node: Array Functions1013893 +Node: Flattening Arrays1018207 +Node: Creating Arrays1025148 +Node: Redirection API1029917 +Node: Extension API Variables1032748 +Node: Extension Versioning1033381 +Ref: gawk-api-version1033818 +Node: Extension API Informational Variables1035546 +Node: Extension API Boilerplate1036610 +Node: Changes from API V11040472 +Node: Finding Extensions1041132 +Node: Extension Example1041691 +Node: Internal File Description1042489 +Node: Internal File Ops1046569 +Ref: Internal File Ops-Footnote-11057969 +Node: Using Internal File Ops1058109 +Ref: Using Internal File Ops-Footnote-11060492 +Node: Extension Samples1060766 +Node: Extension Sample File Functions1062295 +Node: Extension Sample Fnmatch1069944 +Node: Extension Sample Fork1071431 +Node: Extension Sample Inplace1072649 +Node: Extension Sample Ord1075859 +Node: Extension Sample Readdir1076695 +Ref: table-readdir-file-types1077584 +Node: Extension Sample Revout1078389 +Node: Extension Sample Rev2way1078978 +Node: Extension Sample Read write array1079718 +Node: Extension Sample Readfile1081660 +Node: Extension Sample Time1082755 +Node: Extension Sample API Tests1084103 +Node: gawkextlib1084595 +Node: Extension summary1087042 +Node: Extension Exercises1090744 +Node: Language History1092242 +Node: V7/SVR3.11093898 +Node: SVR41096050 +Node: POSIX1097484 +Node: BTL1098863 +Node: POSIX/GNU1099592 +Node: Feature History1105454 +Node: Common Extensions1119824 +Node: Ranges and Locales1121107 +Ref: Ranges and Locales-Footnote-11125723 +Ref: Ranges and Locales-Footnote-21125750 +Ref: Ranges and Locales-Footnote-31125985 +Node: Contributors1126206 +Node: History summary1131766 +Node: Installation1133146 +Node: Gawk Distribution1134090 +Node: Getting1134574 +Node: Extracting1135535 +Node: Distribution contents1137173 +Node: Unix Installation1143258 +Node: Quick Installation1143940 +Node: Shell Startup Files1146354 +Node: Additional Configuration Options1147432 +Node: Configuration Philosophy1149237 +Node: Non-Unix Installation1151606 +Node: PC Installation1152066 +Node: PC Binary Installation1152904 +Node: PC Compiling1153339 +Node: PC Using1154456 +Node: Cygwin1157501 +Node: MSYS1158271 +Node: VMS Installation1158772 +Node: VMS Compilation1159563 +Ref: VMS Compilation-Footnote-11160792 +Node: VMS Dynamic Extensions1160850 +Node: VMS Installation Details1162535 +Node: VMS Running1164788 +Node: VMS GNV1169067 +Node: VMS Old Gawk1169802 +Node: Bugs1170273 +Node: Bug address1170936 +Node: Usenet1173333 +Node: Maintainers1174108 +Node: Other Versions1175484 +Node: Installation summary1182068 +Node: Notes1183103 +Node: Compatibility Mode1183968 +Node: Additions1184750 +Node: Accessing The Source1185675 +Node: Adding Code1187110 +Node: New Ports1193329 +Node: Derived Files1197817 +Ref: Derived Files-Footnote-11203302 +Ref: Derived Files-Footnote-21203337 +Ref: Derived Files-Footnote-31203935 +Node: Future Extensions1204049 +Node: Implementation Limitations1204707 +Node: Extension Design1205890 +Node: Old Extension Problems1207044 +Ref: Old Extension Problems-Footnote-11208562 +Node: Extension New Mechanism Goals1208619 +Ref: Extension New Mechanism Goals-Footnote-11211983 +Node: Extension Other Design Decisions1212172 +Node: Extension Future Growth1214285 +Node: Old Extension Mechanism1215121 +Node: Notes summary1216884 +Node: Basic Concepts1218066 +Node: Basic High Level1218747 +Ref: figure-general-flow1219029 +Ref: figure-process-flow1219714 +Ref: Basic High Level-Footnote-11223015 +Node: Basic Data Typing1223200 +Node: Glossary1226528 +Node: Copying1258475 +Node: GNU Free Documentation License1296014 +Node: Index1321132 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 35db3479..414fa14d 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -32560,7 +32560,8 @@ multibyte encoding. @itemx @ @ @ @ AWK_ARRAY, @itemx @ @ @ @ AWK_SCALAR,@ @ @ @ @ @ @ @ @ /* opaque access to a variable */ @itemx @ @ @ @ AWK_VALUE_COOKIE,@ @ @ /* for updating a previously created value */ -@itemx @ @ @ @ AWK_REGEX +@itemx @ @ @ @ AWK_REGEX, +@itemx @ @ @ @ AWK_STRNUM @itemx @} awk_valtype_t; This @code{enum} indicates the type of a value. It is used in the following @code{struct}. @@ -32580,6 +32581,7 @@ The @code{val_type} member indicates what kind of value the @code{union} holds, and each member is of the appropriate type. @item #define str_value@ @ @ @ @ @ u.s +@itemx #define strnum_value@ @ @ @ str_value @itemx #define regex_value@ @ @ @ str_value @itemx #define num_value@ @ @ @ @ @ u.d @itemx #define array_cookie@ @ @ u.a @@ -32601,7 +32603,7 @@ and in more detail in @ref{Cached values}. @end table -Scalar values in @command{awk} are numbers, strings, or typed regexps. The +Scalar values in @command{awk} are numbers, strings, strnums, or typed regexps. The @code{awk_value_t} struct represents values. The @code{val_type} member indicates what is in the @code{union}. @@ -32610,6 +32612,12 @@ require more work. Because @command{gawk} allows embedded @sc{nul} bytes in string values, a string must be represented as a pair containing a data pointer and length. This is the @code{awk_string_t} type. +A strnum (numeric string) value is represented as a string and consists +of user input data that appears to be numeric. +When an extension attempts to create a strnum value, a string flagged +as user input is created. Subsequent parsing will determine whether it +looks like a number and should be treated as a strnum or a regular string. + Typed regexp values (@pxref{Strong Regexp Constants}) are not of much use to extension functions. Extension functions can tell that they've received them, and create them for scalar values. Otherwise, @@ -32784,9 +32792,29 @@ This function simply creates a numeric value in the @code{awk_value_t} variable pointed to by @code{result}. @item static inline awk_value_t * -@itemx make_regex(const char *string, size_t length, awk_value_t *result); +@itemx make_const_user_input(const char *string, size_t length, awk_value_t *result); +This function is identical to @code{make_const_string}, but the string is +flagged as user input that should be treated as a strnum value if the contents +of the string are numeric. + +@item static inline awk_value_t * +@itemx make_malloced_user_input(const char *string, size_t length, awk_value_t *result); +This function is identical to @code{make_malloced_string}, but the string is +flagged as user input that should be treated as a strnum value if the contents +of the string are numeric. + +@item static inline awk_value_t * +@itemx make_const_regex(const char *string, size_t length, awk_value_t *result); +This function creates a strongly typed regexp value by allocating a copy of the string. +@code{string} is the regular expression of length @code{len}. + +@item static inline awk_value_t * +@itemx make_malloced_regex(const char *string, size_t length, awk_value_t *result); This function creates a strongly typed regexp value. @code{string} is 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()}. + @end table @node Registration Functions @@ -33570,29 +33598,28 @@ value type, as appropriate. This behavior is summarized in @end ifnotplaintext @ifplaintext @example - +-------------------------------------------------------------+ - | Type of Actual Value: | - +------------+------------+-----------+-----------+-----------+ - | String | Number | Regex | Array | Undefined | -+-----------+-----------+------------+------------+-----------+-----------+-----------+ -| | String | String | String | String | false | false | -| +-----------+------------+------------+-----------+-----------+-----------+ -| | Number | Number if | Number | false | false | false | -| | | can be | | | | | -| | | converted, | | | | | -| | | else false | | | | | -| +-----------+------------+------------+-----------+-----------+-----------+ -| | Regex | false | false | Regex | false | false | -| +-----------+------------+------------+-----------+-----------+-----------+ -| Type | Array | false | false | false | Array | false | -| Requested +-----------+------------+------------+-----------+-----------+-----------+ -| | Scalar | Scalar | Scalar | Scalar | false | false | -| +-----------+------------+------------+-----------+-----------+-----------+ -| | Undefined | String | Number | Regex | Array | Undefined | -| +-----------+------------+------------+-----------+-----------+-----------+ -| | Value | false | false | false | false | false | -| | Cookie | | | | | | -+-----------+-----------+------------+------------+-----------+-----------+-----------+ + +-------------------------------------------------------+ + | Type of Actual Value: | + +--------+--------+--------+--------+-------+-----------+ + | String | Strnum | Number | Regex | Array | Undefined | ++-----------+-----------+--------+--------+--------+--------+-------+-----------+ +| | String | String | String | String | String | false | false | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| | Strnum | false | Strnum | Strnum | false | false | false | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| | Number | Number | Number | Number | false | false | false | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| | Regex | false | false | false | Regex | false | false | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| Type | Array | false | false | false | false | Array | false | +| Requested +-----------+--------+--------+--------+--------+-------+-----------+ +| | Scalar | Scalar | Scalar | Scalar | Scalar | false | false | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| | Undefined | String | Strnum | Number | Regex | Array | Undefined | +| +-----------+--------+--------+--------+--------+-------+-----------+ +| | Value | false | false | false | false | false | false | +| | Cookie | | | | | | | ++-----------+-----------+--------+--------+--------+--------+-------+-----------+ @end example @end ifplaintext @end float @@ -33692,7 +33719,7 @@ Return false if the value cannot be retrieved. @item awk_bool_t sym_update_scalar(awk_scalar_t cookie, awk_value_t *value); Update the value associated with a scalar cookie. Return false if -the new value is not of type @code{AWK_STRING}, @code{AWK_REGEX}, or @code{AWK_NUMBER}. +the new value is not of type @code{AWK_STRING}, @code{AWK_STRNUM}, @code{AWK_REGEX}, or @code{AWK_NUMBER}. Here too, the predefined variables may not be updated. @end table @@ -33813,7 +33840,7 @@ is what the routines in this @value{SECTION} let you do. The functions are as f @table @code @item awk_bool_t create_value(awk_value_t *value, awk_value_cookie_t *result); Create a cached string or numeric value from @code{value} for -efficient later assignment. Only values of type @code{AWK_NUMBER}, @code{AWK_REGEX}, +efficient later assignment. Only values of type @code{AWK_NUMBER}, @code{AWK_REGEX}, @code{AWK_STRNUM}, and @code{AWK_STRING} are allowed. Any other type is rejected. @code{AWK_UNDEFINED} could be allowed, but doing so would result in inferior performance. @@ -34039,9 +34066,9 @@ The array remains an array, but after calling this function, it has no elements. This is equivalent to using the @code{delete} statement (@pxref{Delete}). -@item awk_bool_t flatten_array(awk_array_t a_cookie, awk_flat_array_t **data); +@item awk_bool_t flatten_array_typed(awk_array_t a_cookie, awk_flat_array_t **data, awk_valtype_t index_type, awk_valtype_t value_type); For the array represented by @code{a_cookie}, create an @code{awk_flat_array_t} -structure and fill it in. Set the pointer whose address is passed as @code{data} +structure and fill it in with indices and values of the requested types. Set the pointer whose address is passed as @code{data} to point to this structure. Return true upon success, or false otherwise. @ifset FOR_PRINT @@ -34053,6 +34080,12 @@ See the next @value{SECTION} for a discussion of how to flatten an array and work with it. +@item awk_bool_t flatten_array(awk_array_t a_cookie, awk_flat_array_t **data); +For the array represented by @code{a_cookie}, create an @code{awk_flat_array_t} +structure and fill it in with @code{AWK_STRING} indices and +@code{AWK_UNDEFINED} values. This is superseded by @code{flatten_array_typed} +and retained only for legacy binary compatibility. + @item awk_bool_t release_flattened_array(awk_array_t a_cookie, @itemx @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ awk_flat_array_t *data); When done with a flattened array, release the storage using this function. @@ -34165,7 +34198,7 @@ to double-check that the count in the @code{awk_flat_array_t} is the same as the count just retrieved: @example - if (! flatten_array(value2.array_cookie, & flat_array)) @{ + if (! flatten_array_typed(value2.array_cookie, & flat_array, AWK_STRING, AWK_UNDEFINED)) @{ printf("dump_array_and_delete: could not flatten array\n"); goto out; @} |