diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-03 12:50:36 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-10-03 12:50:36 -0600 |
commit | f401359d87f3375efdd39801652cc18574240049 (patch) | |
tree | 41b87fa415c356eb4e66fe545a89c254cf4c3cc3 | |
parent | 4d451f90eba193a4ca2848c4ac7acccda96ed008 (diff) |
lib9p: Rename the generated files
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | lib9p/.editorconfig | 2 | ||||
-rwxr-xr-x | lib9p/9p.gen (renamed from lib9p/types.gen) | 16 | ||||
-rw-r--r-- | lib9p/9p.generated.c (renamed from lib9p/types.c) | 2 | ||||
-rw-r--r-- | lib9p/include/lib9p/9p.generated.h (renamed from lib9p/include/lib9p/_types.h) | 9 | ||||
-rw-r--r-- | lib9p/include/lib9p/9p.h | 2 |
6 files changed, 16 insertions, 19 deletions
@@ -18,8 +18,8 @@ generate/files += lib9p/include/lib9p/linux-errno.h lib9p/include/lib9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt ./$^ >$@ -generate/files += lib9p/types.c lib9p/include/lib9p/_types.h -lib9p/types.c lib9p/include/lib9p/_types.h &: lib9p/types.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt +generate/files += lib9p/9p.generated.c lib9p/include/lib9p/9p.generated.h +lib9p/9p.generated.c lib9p/include/lib9p/9p.generated.h &: lib9p/9p.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt ./$^ generate/files += libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt diff --git a/lib9p/.editorconfig b/lib9p/.editorconfig index 5c79099..ee1a38f 100644 --- a/lib9p/.editorconfig +++ b/lib9p/.editorconfig @@ -1,3 +1,3 @@ -[{types.gen,linux-errno.h.gen}] +[{9p.gen,linux-errno.h.gen}] indent_style = space indent_size = 4 diff --git a/lib9p/types.gen b/lib9p/9p.gen index 8b1b878..f974dd1 100755 --- a/lib9p/types.gen +++ b/lib9p/9p.gen @@ -1,6 +1,6 @@ #!/usr/bin/env python -# lib9p/types.gen - Generate C marshalers/unmarshalers for .txt files -# defining 9P protocol variants. +# lib9p/9p.gen - Generate C marshalers/unmarshalers for .txt files +# defining 9P protocol variants. # # Copyright (C) 2024 Luke T. Shumaker <lukeshu@lukeshu.com> # SPDX-Licence-Identifier: AGPL-3.0-or-later @@ -363,11 +363,11 @@ def just_bitfields(typs: list[Bitfield | Struct]) -> Sequence[Bitfield]: def gen_h(idprefix: str, versions: set[str], typs: list[Bitfield | Struct]) -> str: - guard = "_LIB9P__TYPES_H_" ret = f"""/* Generated by `{' '.join(sys.argv)}`. DO NOT EDIT! */ -#ifndef {guard} -#define {guard} +#ifndef _LIB9P_9P_H_ +# error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead +#endif #include <stdint.h> /* for uint{{n}}_t types */ """ @@ -470,8 +470,6 @@ enum {idprefix}version {{ ret += "\n" ret += "};\n" - ret += "\n" - ret += f"#endif /* {guard} */\n" return ret @@ -907,7 +905,7 @@ if __name__ == "__main__": parser.parse_file(txtname) versions, typs = parser.all() outdir = os.path.normpath(os.path.join(sys.argv[0], "..")) - with open(os.path.join(outdir, "include/lib9p/_types.h"), "w") as fh: + with open(os.path.join(outdir, "include/lib9p/9p.generated.h"), "w") as fh: fh.write(gen_h("lib9p_", versions, typs)) - with open(os.path.join(outdir, "types.c"), "w") as fh: + with open(os.path.join(outdir, "9p.generated.c"), "w") as fh: fh.write(gen_c("lib9p_", versions, typs)) diff --git a/lib9p/types.c b/lib9p/9p.generated.c index 0343a48..387af79 100644 --- a/lib9p/types.c +++ b/lib9p/9p.generated.c @@ -1,4 +1,4 @@ -/* Generated by `./lib9p/types.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt`. DO NOT EDIT! */ +/* Generated by `./lib9p/9p.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt`. DO NOT EDIT! */ #include <assert.h> #include <stdbool.h> diff --git a/lib9p/include/lib9p/_types.h b/lib9p/include/lib9p/9p.generated.h index 576d481..c6aaee9 100644 --- a/lib9p/include/lib9p/_types.h +++ b/lib9p/include/lib9p/9p.generated.h @@ -1,7 +1,8 @@ -/* Generated by `./lib9p/types.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt`. DO NOT EDIT! */ +/* Generated by `./lib9p/9p.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt`. DO NOT EDIT! */ -#ifndef _LIB9P__TYPES_H_ -#define _LIB9P__TYPES_H_ +#ifndef _LIB9P_9P_H_ +# error Do not include <lib9p/9p.generated.h> directly; include <lib9p/9p.h> instead +#endif #include <stdint.h> /* for uint{n}_t types */ @@ -309,5 +310,3 @@ struct lib9p_msg_Tswrite { struct lib9p_msg_Rswrite { uint32_t count; }; - -#endif /* _LIB9P__TYPES_H_ */ diff --git a/lib9p/include/lib9p/9p.h b/lib9p/include/lib9p/9p.h index 2712998..8e57a86 100644 --- a/lib9p/include/lib9p/9p.h +++ b/lib9p/include/lib9p/9p.h @@ -10,8 +10,8 @@ #include <stdbool.h> #include <sys/types.h> /* for ssize_t */ +#include <lib9p/9p.generated.h> #include <lib9p/linux-errno.h> -#include <lib9p/_types.h> #define LIB9P_NOTAG ((uint16_t)~0U) #define LIB9P_NOFID ((uint32_t)~0U) |