xref: /freebsd/lib/libbsdconf/bsdconf_formats.h (revision 3fe5961a0b708da599d42cbb6b5e4f030c28ea45)
1 /*
2  * Copyright (c) 2013-2026 Devin Teske <dteske@FreeBSD.org>
3  * Copyright (c) 2021-2026 Faraz Vahedi <kfv@FreeBSD.org>
4  *
5  * SPDX-License-Identifier: BSD-2-Clause
6  */
7 
8 #ifndef _BSDCONF_FORMATS_H_
9 #define _BSDCONF_FORMATS_H_
10 
11 #include "bsdconf.h"
12 
13 /*
14  * The built-in format descriptors, one translation unit per format.
15  * This header is deliberately not installed.
16  *
17  * Every format is a self-contained bsdconf_format_<keyword>.c defining a
18  * single descriptor; the registry in bsdconf_format.c does nothing but
19  * collect them into the table indexed by enum bsdconf_format. Adding a
20  * format to the library therefore touches no existing parsing or writing
21  * code: drop in the new file, declare its descriptor here, append one
22  * enum constant in bsdconf.h and one pointer to the registry table, and
23  * list the file in the Makefile.
24  *
25  * A candidate format whose syntax the existing processing/put flags cannot
26  * express (for example, brace-grouped statement blocks) is handled by
27  * teaching the shared engine (bsdconf.c and bsdconf_put.c) a new flag that
28  * the new descriptor is first to set, so the capability composes with
29  * every other format rather than living in a private parser.
30  */
31 extern const struct bsdconf_format_def bsdconf_format_generic_def;
32 extern const struct bsdconf_format_def bsdconf_format_loader_def;
33 extern const struct bsdconf_format_def bsdconf_format_make_def;
34 extern const struct bsdconf_format_def bsdconf_format_src_def;
35 extern const struct bsdconf_format_def bsdconf_format_sysctl_def;
36 
37 #endif /* !_BSDCONF_FORMATS_H_ */
38