diff options
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 6abc337f..02b7623b 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -28818,11 +28818,13 @@ and to nothing when compiling @command{gawk} itself. This makes certain fields in the API data structures unwritable from extension code, while allowing @command{gawk} to use them as it needs to. -@item typedef int awk_bool_t; -A simple boolean type. At the moment, the API does not define special -``true'' and ``false'' values, although perhaps it should. +@item typedef enum awk_bool @{ +@item @ @ @ @ awk_false = 0, +@item @ @ @ @ awk_true +@item @} awk_bool_t; +A simple boolean type. -@item typedef struct @{ +@item typedef struct awk_string @{ @itemx @ @ @ @ char *str;@ @ @ @ @ @ /* data */ @itemx @ @ @ @ size_t len;@ @ @ @ @ /* length thereof, in chars */ @itemx @} awk_string_t; @@ -28845,7 +28847,7 @@ multibyte encoding. This @code{enum} indicates the type of a value. It is used in the following @code{struct}. -@item typedef struct @{ +@item typedef struct awk_value @{ @itemx @ @ @ @ awk_valtype_t val_type; @itemx @ @ @ @ union @{ @itemx @ @ @ @ @ @ @ @ awk_string_t@ @ @ @ @ @ @ s; @@ -29091,7 +29093,7 @@ registering parts of your extension with @command{gawk}. Extension functions are described by the following record: @example -typedef struct @{ +typedef struct awk_ext_func @{ @ @ @ @ const char *name; @ @ @ @ awk_value_t *(*function)(int num_actual_args, awk_value_t *result); @ @ @ @ size_t num_expected_args; @@ -29220,11 +29222,11 @@ Your extension should package these functions inside an @code{awk_input_parser_t}, which looks like this: @example -typedef struct input_parser @{ +typedef struct awk_input_parser @{ const char *name; /* name of parser */ awk_bool_t (*can_take_file)(const awk_input_buf_t *iobuf); awk_bool_t (*take_control_of)(awk_input_buf_t *iobuf); - awk_const struct input_parser *awk_const next; /* for use by gawk */ + awk_const struct awk_input_parser *awk_const next; /* for use by gawk */ @} awk_input_parser_t; @end example @@ -29413,11 +29415,11 @@ with the @samp{>} or @samp{>>} operators (@pxref{Redirection}). The output wrapper is very similar to the input parser structure: @example -typedef struct output_wrapper @{ +typedef struct awk_output_wrapper @{ const char *name; /* name of the wrapper */ awk_bool_t (*can_take_file)(const awk_output_buf_t *outbuf); awk_bool_t (*take_control_of)(awk_output_buf_t *outbuf); - awk_const struct output_wrapper *awk_const next; /* for use by gawk */ + awk_const struct awk_output_wrapper *awk_const next; /* for use by gawk */ @} awk_output_wrapper_t; @end example @@ -29447,7 +29449,7 @@ This is for use by @command{gawk}. The @code{awk_output_buf_t} structure looks like this: @example -typedef struct @{ +typedef struct awk_output_buf @{ const char *name; /* name of output file */ const char *mode; /* mode argument to fopen */ FILE *fp; /* stdio file pointer */ @@ -29526,13 +29528,13 @@ as described earlier. A two-way processor is represented by the following structure: @example -typedef struct two_way_processor @{ +typedef struct awk_two_way_processor @{ const char *name; /* name of the two-way processor */ awk_bool_t (*can_take_two_way)(const char *name); awk_bool_t (*take_control_of)(const char *name, awk_input_buf_t *inbuf, awk_output_buf_t *outbuf); - awk_const struct two_way_processor *awk_const next; /* for use by gawk */ + awk_const struct awk_two_way_processor *awk_const next; /* for use by gawk */ @} awk_two_way_processor_t; @end example @@ -30432,7 +30434,7 @@ static awk_bool_t init_testarray(void) @{ create_new_array(); - return 1; + return awk_true; @} static awk_bool_t (*init_func)(void) = init_testarray; @@ -30650,8 +30652,8 @@ If you need to do some initialization work, you should define a function that does it (creates variables, opens files, etc.) and then define the @code{init_func} pointer to point to your function. -The function should return zero (false) upon failure, non-zero -(success) if everything goes well. +The function should return @code{awk_false} upon failure, or @code{awk_true} +if everything goes well. If you don't need to do any initialization, define the pointer and initialize it to @code{NULL}. @@ -30678,7 +30680,7 @@ continues on. @item If the @code{init_func} pointer is not @code{NULL}, call the -function it points to. If it returns non-zero, print a +function it points to. If it returns @code{awk_false}, print a warning message. @item |