.
.SS Type definitions
The header file defines two simple structure types.
-.PP
-.IP
-.nf
-.ft B
+.VS
struct kwval {
const char *kw;
const void *val;
};
-.fi
-.PP
+.VE
The
.B kwval
structure describes a keyword argument name/value pair.
makes the size of a
.B kwval
object independent of the actual argument type.)
-.PP
-.IP
-.nf
-.ft B
+.VS
struct kwtab {
const struct kwval *v;
size_t n;
};
-.fi
-.PP
+.VE
The
.B kwtab
structure describes a list of keyword arguments,
with no separation between them.
.PP
For example:
-.IP
-.nf
-.ft B
+.VS
#define example_KWSET(_) \e
.in +4m
_(int, x, 0) \e
_(const char *, y, NULL)
-.fi
-.ft P
-.PP
+.VE
Each
.I name
should be a distinct C identifier;
which can be achieved using this hook,
the following hacking answers whether
a function recognizes a particular keyword argument.
-.IP
-.nf
-.ft B
+.VS
#define KWARGS_TEST(k, val) KWARGS(K(k, val) K(kw.unknown, 0))
static jmp_buf kw_test_jmp;
/* now f is nonzero if `somefunc' accepts the `shiny' keyword
* (which we hope wants a double argument)
*/
-.ft P
-.fi
+.VE
.
.\"--------------------------------------------------------------------------
.SH BUGS