]> git.draconx.ca Git - cdecl99.git/blobdiff - doc/libcdecl.3
libcdecl: Add _Bool fallback to public header.
[cdecl99.git] / doc / libcdecl.3
index 022795acb173e5342cb2ed0d2ebbc9ca79e9e09e..4a882a0b1e474213c7526737b2d7bc1cee0f8772 100644 (file)
@@ -1,4 +1,4 @@
-.Dd November 18, 2023
+.Dd December 3, 2023
 .Dt LIBCDECL \&3 "Cdecl99 Developer's Manual"
 .Os cdecl99
 .Sh NAME
@@ -17,7 +17,7 @@
 .Fd const struct cdecl_error *cdecl_get_error(void);
 .Pp
 .Fd int cdecl_spec_kind(struct cdecl_declspec *spec);
-.Fd bool cdecl_is_abstract(struct cdecl_declarator *declarator);
+.Fd int cdecl_is_abstract(struct cdecl_declarator *declarator);
 .Sh DESCRIPTION
 .Nm
 provides support for parsing C declarations and translating them to something
@@ -230,7 +230,7 @@ union member points to the C string containing the identifier.
 Since a null declarator may be deeply nested in the declarator chain, the
 function
 .Pp
-.Fd bool cdecl_is_abstract(struct cdecl_declarator *declarator);
+.Fd int cdecl_is_abstract(struct cdecl_declarator *declarator);
 .Pp
 can be used to determine whether or not a given declarator declares an
 identifier.
@@ -267,15 +267,17 @@ is positive, then this is an array declarator with the specified length.
 Otherwise, this is an incomplete array declarator.
 .Ss Function Declarators
 .Bd -literal -offset indent
+typedef _Bool cdecl_bool; /* depends on configuration */
 struct cdecl_function {
        struct cdecl *parameters;
-       _Bool variadic;
+       cdecl_bool variadic;
 };
 .Ed
 .Pp
 If
 .Va parameters
-is null, then this is a non-prototype function declarator.
+is null, then this is a non-prototype function declarator with an empty
+identifier list.
 Otherwise,
 .Va parameters
 points to the first element of a singly-linked list of declarations
@@ -284,15 +286,27 @@ Note that, unlike toplevel declarations, each function parameter has exactly
 one full declarator (abstract or otherwise).
 If
 .Va variadic
-is true, then the function is variadic.
+is non-zero, then the function is variadic.
+.Pp
+Please note that if the compiler used to build the library does not support
+.Vt _Bool ,
+then
+.Vt cdecl_bool
+will be defined as
+.Vt signed char
+instead.
+In most cases these will have a compatible binary representation, provided
+that applications do not set
+.Va variadic
+to any values besides 0 or 1.
 .Pp
-Note that old-style function declarations with non-empty identifier lists are
-not directly represented here: this is because they are syntactically identical
-to a prototype where every parameter is a typedef name.
-Since
+Old-style function declarations with non-empty identifier lists cannot be
+directly represented by this structure.
+Such declarations are syntactically identical to a prototype with every
+parameter consisting solely of a typedef name.
 .Nm
-isn't a C compiler, there is no way for its parser to tell these two kinds of
-declarations apart.
+cannot tell these apart when parsing and thus will return a parameter
+list, which can be rendered as expected.
 .Sh ERROR HANDLING
 Some functions in
 .Nm