forked from Telodendria/Telodendria
Add docs recipe for generating documentation from the headers.
Note that since all the headers are not documented yet, this will fail because an undocumented function is a fatal error in hdoc.
This commit is contained in:
parent
9880aac674
commit
9292f1d9da
4 changed files with 55 additions and 3 deletions
|
@ -370,6 +370,8 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
|
|||
strcmp(word, "elif") == 0 ||
|
||||
strcmp(word, "error") == 0)
|
||||
{
|
||||
int pC;
|
||||
|
||||
Free(word);
|
||||
expr->data.text[i] = ' ';
|
||||
i++;
|
||||
|
@ -394,8 +396,7 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
|
|||
return;
|
||||
}
|
||||
|
||||
/* TODO: Handle backslash escapes */
|
||||
if (c == '\n')
|
||||
if (c == '\n' && pC != '\\')
|
||||
{
|
||||
expr->data.text[i] = '\0';
|
||||
expr->state.lineNo++;
|
||||
|
@ -406,6 +407,8 @@ HeaderParse(Stream * stream, HeaderExpr * expr)
|
|||
expr->data.text[i] = c;
|
||||
i++;
|
||||
}
|
||||
|
||||
pC = c;
|
||||
}
|
||||
}
|
||||
else if (strcmp(word, "else") == 0 ||
|
||||
|
|
|
@ -24,6 +24,35 @@
|
|||
#ifndef TELODENDRIA_INT_H
|
||||
#define TELODENDRIA_INT_H
|
||||
|
||||
/***
|
||||
* @Nm Int
|
||||
* @Nd Fixed-width integer types.
|
||||
* @Dd April 27 2023
|
||||
*
|
||||
* This header provides cross-platform, fixed-width integer types.
|
||||
* Specifically, it uses preprocessor magic to define the following
|
||||
* types:
|
||||
* .Bl -bullet -offset indent
|
||||
* .It
|
||||
* Int8 and UInt8
|
||||
* .It
|
||||
* Int16 and UInt16
|
||||
* .It
|
||||
* Int32 and UInt32
|
||||
* .El
|
||||
* .Pp
|
||||
* Note that there is no 64-bit integer type, because the ANSI C
|
||||
* standard makes no guarantee that such a type will exist, even
|
||||
* though it does on most platforms.
|
||||
* .Pp
|
||||
* The reason Telodendria provides its own header for this is
|
||||
* because ANSI C does not define fixed-width types, and while it
|
||||
* should be safe to rely on C99 fixed-width types in most cases,
|
||||
* there may be cases where even that is not possible.
|
||||
*
|
||||
* @ignore-typedefs
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#define BIT64_MAX 18446744073709551615
|
||||
|
|
17
tools/bin/td
17
tools/bin/td
|
@ -108,6 +108,22 @@ setsubst() {
|
|||
rm "$SED"
|
||||
}
|
||||
|
||||
recipe_docs() {
|
||||
mkdir -p build/man/man3
|
||||
|
||||
for header in $(find src -name '*.h'); do
|
||||
basename=$(basename "$header")
|
||||
man=$(echo "build/man/man3/$basename" | sed -e 's/\.h$/\.3/')
|
||||
|
||||
if [ $(mod_time "$header") -ge $(mod_time "$man") ]; then
|
||||
echo "DOC $basename"
|
||||
if ! hdoc -D Os=Telodendria -i "$header" -o "$man"; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Build the source code, and generate the 'build/telodendria'
|
||||
# binary.
|
||||
recipe_build() {
|
||||
|
@ -292,7 +308,6 @@ recipe_release() {
|
|||
# really picky about how patches look, but this is how we like them
|
||||
# best. Makes them easy to read.
|
||||
recipe_patch() {
|
||||
|
||||
# If the user has not set their MXID, try to deduce one from
|
||||
# their system.
|
||||
if [ -z "$MXID" ]; then
|
||||
|
|
|
@ -242,6 +242,11 @@ main(int argc, char **argv)
|
|||
}
|
||||
break;
|
||||
case HP_TYPEDEF:
|
||||
if (HashMapGet(registers, "ignore-typedefs"))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!isDocumented)
|
||||
{
|
||||
StreamPrintf(StreamStderr(),
|
||||
|
|
Loading…
Reference in a new issue