aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawktexi.in
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r--doc/gawktexi.in69
1 files changed, 43 insertions, 26 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index ca571514..f7f232a9 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -31573,7 +31573,8 @@ multibyte encoding.
@itemx @ @ @ @ AWK_STRING,
@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_REGEX
@itemx @} awk_valtype_t;
This @code{enum} indicates the type of a value.
It is used in the following @code{struct}.
@@ -31593,6 +31594,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 regex_value@ @ @ @ str_value
@itemx #define num_value@ @ @ @ @ @ u.d
@itemx #define array_cookie@ @ @ u.a
@itemx #define scalar_cookie@ @ u.scl
@@ -31613,7 +31615,7 @@ and in more detail in @ref{Cached values}.
@end table
-Scalar values in @command{awk} are either numbers or strings. The
+Scalar values in @command{awk} are numbers, strings, or typed regexps. The
@code{awk_value_t} struct represents values. The @code{val_type} member
indicates what is in the @code{union}.
@@ -31622,6 +31624,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.
+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,
+they can examine the text of the regexp through @code{regex_value.str}
+and @code{regex_value.len}.
+
Identifiers (i.e., the names of global variables) can be associated
with either scalar values or with arrays. In addition, @command{gawk}
provides true arrays of arrays, where any given array element can
@@ -31788,6 +31796,11 @@ It returns @code{result}.
@itemx make_number(double num, awk_value_t *result);
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);
+This function creates a strongly typed regexp value.
+@code{string} is the regular expression of length @code{len}.
@end table
@node Registration Functions
@@ -32472,6 +32485,7 @@ value type, as appropriate. This behavior is summarized in
@float Table,table-value-types-returned
@caption{API value types returned}
+@c FIXME: This needs doing.
@docbook
<informaltable>
<tgroup cols="6">
@@ -32547,6 +32561,7 @@ value type, as appropriate. This behavior is summarized in
</informaltable>
@end docbook
+@c FIXME: This needs doing.
@ifnotplaintext
@ifnotdocbook
@multitable @columnfractions .50 .50
@@ -32569,27 +32584,29 @@ value type, as appropriate. This behavior is summarized in
@end ifnotplaintext
@ifplaintext
@example
- +-------------------------------------------------+
- | Type of Actual Value: |
- +------------+------------+-----------+-----------+
- | String | Number | Array | Undefined |
-+-----------+-----------+------------+------------+-----------+-----------+
-| | String | String | String | False | False |
-| |-----------+------------+------------+-----------+-----------+
-| | Number | Number if | Number | False | False |
-| | | can be | | | |
-| | | converted, | | | |
-| | | else false | | | |
-| |-----------+------------+------------+-----------+-----------+
-| Type | Array | False | False | Array | False |
-| Requested |-----------+------------+------------+-----------+-----------+
-| | Scalar | Scalar | Scalar | False | False |
-| |-----------+------------+------------+-----------+-----------+
-| | Undefined | String | Number | Array | Undefined |
-| |-----------+------------+------------+-----------+-----------+
-| | Value | False | False | False | False |
-| | cookie | | | | |
-+-----------+-----------+------------+------------+-----------+-----------+
+ +-------------------------------------------------------------+
+ | 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 | | | | | |
++-----------+-----------+------------+------------+-----------+-----------+-----------+
@end example
@end ifplaintext
@end float
@@ -32689,7 +32706,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} or @code{AWK_NUMBER}.
+the new value is not of type @code{AWK_STRING}, @code{AWK_REGEX}, or @code{AWK_NUMBER}.
Here too, the predefined variables may not be updated.
@end table
@@ -32810,7 +32827,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}
+efficient later assignment. Only values of type @code{AWK_NUMBER}, @code{AWK_REGEX},
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.
@@ -33554,7 +33571,7 @@ debugging:
@float Table,gawk-api-version
@caption{gawk API version constants}
@multitable {@b{API Version}} {@code{gawk_api_major_version}} {@code{GAWK_API_MAJOR_VERSION}}
-@headitem API Version @tab C preprocessor define @tab enum constant
+@headitem API Version @tab C Preprocessor Define @tab enum constant
@item Major @tab @code{gawk_api_major_version} @tab @code{GAWK_API_MAJOR_VERSION}
@item Minor @tab @code{gawk_api_minor_version} @tab @code{GAWK_API_MINOR_VERSION}
@end multitable