diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-09-25 02:38:54 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-09-25 02:38:54 +0200 |
commit | 7ca3f68ac2aa6ee7cee632f8cd72cc3ef6c4faa9 (patch) | |
tree | 27d511f75fe832e6e77854fe3c85403e313b2baa /gen_inl.c | |
parent | 541477736dc9d0c7fc358413a5910e6d513c29eb (diff) | |
download | kit-7ca3f68ac2aa6ee7cee632f8cd72cc3ef6c4faa9.zip |
fix impl include order bug
Diffstat (limited to 'gen_inl.c')
-rw-r--r-- | gen_inl.c | 33 |
1 files changed, 24 insertions, 9 deletions
@@ -101,12 +101,15 @@ int write_file(FILE *out, char *source) { return 1; } - fprintf(out, "/*%s*\n", repeat(67, '*')); - fprintf(out, " *%s*\n", repeat(67, ' ')); - fprintf(out, " * File: %s%s*\n", source, - repeat(55 - strlen(source), ' ')); - fprintf(out, " *%s*\n", repeat(67, ' ')); - fprintf(out, " *%s*/\n", repeat(67, '*')); + fprintf(out, "// " + "=====================================================" + "===========\n"); + fprintf(out, "//\n"); + fprintf(out, "// File: %s\n", source); + fprintf(out, "//\n"); + fprintf(out, "// " + "=====================================================" + "===========\n"); char line[200]; char buf[400]; @@ -147,7 +150,8 @@ int main(int argc, char **argv) { fprintf(out, "// kit.inl.h\n"); fprintf(out, "// https://guattari.tech/kit.git\n"); fprintf(out, "//\n"); - fprintf(out, "// Single header-only cross-platform utility library for C.\n"); + fprintf(out, "// Single header-only cross-platform utility " + "library for C.\n"); fprintf(out, "//\n"); fprintf(out, "// " "=====================================================" @@ -207,7 +211,19 @@ int main(int argc, char **argv) { return 1; } - fprintf(out, "#ifdef KIT_IMPLEMENTATION\n"); + fprintf(out, "#endif\n"); + fprintf(out, "// " + "=====================================================" + "===========\n"); + fprintf(out, "//\n"); + fprintf(out, "// IMPLEMENTATION\n"); + fprintf(out, "//\n"); + fprintf(out, "// " + "=====================================================" + "===========\n"); + fprintf(out, "#if defined(KIT_IMPLEMENTATION) && " + "!defined(KIT_INL_H_IMPL)\n"); + fprintf(out, "#define KIT_INL_H_IMPL\n"); for (int i = 0; i < sizeof IMPL / sizeof *IMPL; i++) if (write_file(out, IMPL[i]) != 0) { @@ -216,7 +232,6 @@ int main(int argc, char **argv) { } fprintf(out, "#endif\n"); - fprintf(out, "#endif\n"); fclose(out); return 0; |