From 453690061035661435407594f2c3d8304671bf7b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 10 Jan 2025 19:16:46 -0300 Subject: Replace src/config.h with ; incorporate changes from other projects --- .gitignore | 2 +- Makefile | 27 +++++++++--------- deps.mk | 2 +- src/config.h.in | 6 ---- src/hash.c | 2 +- src/meta.h.in | 3 ++ src/pindaiba.en.msg | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/pindaiba.h | 1 + src/pindaibabs.en.msg | 76 --------------------------------------------------- src/pindaibabs.h | 1 - src/testing.c | 14 +++------- 11 files changed, 101 insertions(+), 109 deletions(-) delete mode 100644 src/config.h.in create mode 100644 src/meta.h.in create mode 100644 src/pindaiba.en.msg create mode 120000 src/pindaiba.h delete mode 100644 src/pindaibabs.en.msg delete mode 120000 src/pindaibabs.h diff --git a/.gitignore b/.gitignore index 783c195..d46649e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ /*.a /*.bin -/src/config.h +/src/meta.h /src/*.o /src/*.cat /tests/*.o diff --git a/Makefile b/Makefile index 60fee9d..f89520b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ .POSIX: DATE = 1970-01-01 VERSION = 0.1.0 -NAME = pindaibabs -NAME_UC = PindaĆ­ba bootstrap +NAME = pindaiba +NAME_UC = $(NAME) LANGUAGES = en ## Installation prefix. Defaults to "/usr". PREFIX = /usr @@ -16,7 +16,7 @@ MANDIR = $(SHAREDIR)/man EXEC = ./ ## Where to store the installation. Empty by default. DESTDIR = -LDLIBS = -lpthread -lendiannessbs -lsiphashbs +LDLIBS = -lendianness -lsiphash @@ -51,6 +51,12 @@ tests.o = $(tests.c:.c=.o) tests.a = $(tests.c:.c=.a) tests.bin = $(tests.c:.c=.bin) +objects = \ + $(sources.o) \ + $(tests.o) \ + src/main.o \ + tests/slurp.o \ + archives = \ lib$(NAME).a \ $(tests.a) \ @@ -59,22 +65,19 @@ archives = \ sources = \ $(sources.c) \ $(sources.h) \ - src/config.h.in \ - src/config.h \ + src/meta.h.in \ + src/meta.h \ src/main.c \ src/$(NAME).h \ $(catalogs.msg) \ derived-assets = \ + $(objects) \ $(archives) \ - src/config.h \ + src/meta.h \ $(catalogs.cat) \ - $(sources.o) \ - $(tests.o) \ $(tests.bin) \ - tests/slurp.o \ - src/main.o \ $(NAME).bin \ side-assets = \ @@ -91,10 +94,8 @@ all: $(derived-assets) lib$(NAME).a: $(sources.o) $(NAME).a: $(sources.o) src/main.o -src/config.h: Makefile deps.mk -$(sources.o) $(tests.o) src/main.o: Makefile deps.mk src/config.h +src/meta.h $(objects): Makefile deps.mk src/main.o: src/$(NAME).h -tests/slurp.o: src/config.h $(archives): diff --git a/deps.mk b/deps.mk index 159626b..92b6011 100644 --- a/deps.mk +++ b/deps.mk @@ -1,4 +1,4 @@ -catalogs.en.msg = src/pindaibabs.en.msg +catalogs.en.msg = src/pindaiba.en.msg catalogs.msg = $(catalogs.en.msg) diff --git a/src/config.h.in b/src/config.h.in deleted file mode 100644 index ab2256e..0000000 --- a/src/config.h.in +++ /dev/null @@ -1,6 +0,0 @@ -#define _XOPEN_SOURCE 700 -#define _POSIX_C_SOURCE 200809L -#define VERSION "@VERSION@" -#define DATE "@DATE@" -#define NAME "@NAME@" -#define LOCALEDIR "@LOCALEDIR@" diff --git a/src/hash.c b/src/hash.c index 67b3656..03fc8df 100644 --- a/src/hash.c +++ b/src/hash.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include "hash.h" #include "logerr.h" diff --git a/src/meta.h.in b/src/meta.h.in new file mode 100644 index 0000000..9bd8c08 --- /dev/null +++ b/src/meta.h.in @@ -0,0 +1,3 @@ +#define VERSION "@VERSION@" +#define DATE "@DATE@" +#define NAME "@NAME@" diff --git a/src/pindaiba.en.msg b/src/pindaiba.en.msg new file mode 100644 index 0000000..72c5daa --- /dev/null +++ b/src/pindaiba.en.msg @@ -0,0 +1,76 @@ +0 Usage:\n + +1 pindaibabs -p FILE [-o DIRECTORY]\n + +2 pindaibabs -l FILE [-o DIRECTORY]\n + +3 pindaibabs [-hV]\n + +4 \n + +5 \n + +6 Options:\n + +7 -p FILE parser file to be processed\n + +8 -l FILE lexer file to be processed\n + +9 -o DIRECTORY output where to place the\n + +10 generated files (default .)\n + +11 -h, --help show this help message\n + +12 -V, --version print the version number\n + +13 \n + +14 \n + +15 Run the pindaibabs(1) parser program.\n + +16 \n + +17 Here is the explanation for what it does, and the synopsis\n + +18 of its usage.\n + +19 \n + +20 See "man pindaibabs" for usage information and\n + +21 "man pindaibabs.tutorial" for a beginner introduction.\n + +22 \n + +23 \n + +24 Examples:\n + +25 \n + +26 Do a one-line parser:\n + +27 \n + +28 $ pindaibabs run md.grammar < README.md\n + +29 \n + +30 \n + +31 Compile the grammer:\n + +32 \n + +33 $ pindaibabs build csv.grammar > dunno.alsodunno\n + +34 pindaibabs 0.1.0 1970-01-01\n + +35 Already at max capacity (%ld): %s\n + +36 idx (%ld) is beyond bounds (%ld)\n + +37 pop on an empty vector\n + diff --git a/src/pindaiba.h b/src/pindaiba.h new file mode 120000 index 0000000..a564cc1 --- /dev/null +++ b/src/pindaiba.h @@ -0,0 +1 @@ +lib.h \ No newline at end of file diff --git a/src/pindaibabs.en.msg b/src/pindaibabs.en.msg deleted file mode 100644 index 72c5daa..0000000 --- a/src/pindaibabs.en.msg +++ /dev/null @@ -1,76 +0,0 @@ -0 Usage:\n - -1 pindaibabs -p FILE [-o DIRECTORY]\n - -2 pindaibabs -l FILE [-o DIRECTORY]\n - -3 pindaibabs [-hV]\n - -4 \n - -5 \n - -6 Options:\n - -7 -p FILE parser file to be processed\n - -8 -l FILE lexer file to be processed\n - -9 -o DIRECTORY output where to place the\n - -10 generated files (default .)\n - -11 -h, --help show this help message\n - -12 -V, --version print the version number\n - -13 \n - -14 \n - -15 Run the pindaibabs(1) parser program.\n - -16 \n - -17 Here is the explanation for what it does, and the synopsis\n - -18 of its usage.\n - -19 \n - -20 See "man pindaibabs" for usage information and\n - -21 "man pindaibabs.tutorial" for a beginner introduction.\n - -22 \n - -23 \n - -24 Examples:\n - -25 \n - -26 Do a one-line parser:\n - -27 \n - -28 $ pindaibabs run md.grammar < README.md\n - -29 \n - -30 \n - -31 Compile the grammer:\n - -32 \n - -33 $ pindaibabs build csv.grammar > dunno.alsodunno\n - -34 pindaibabs 0.1.0 1970-01-01\n - -35 Already at max capacity (%ld): %s\n - -36 idx (%ld) is beyond bounds (%ld)\n - -37 pop on an empty vector\n - diff --git a/src/pindaibabs.h b/src/pindaibabs.h deleted file mode 120000 index a564cc1..0000000 --- a/src/pindaibabs.h +++ /dev/null @@ -1 +0,0 @@ -lib.h \ No newline at end of file diff --git a/src/testing.c b/src/testing.c index 917ad45..f3239e0 100644 --- a/src/testing.c +++ b/src/testing.c @@ -11,8 +11,8 @@ #define COLOUR_GREEN "\033[0;32m" #define COLOUR_YELLOW "\033[0;33m" -static const char *const -ENVVAR_NAME = "NO_COLOUR"; +static const char +ENVVAR_NAME[] = "NO_COLOUR"; static bool @@ -24,8 +24,6 @@ show_colour(void) { void test_start(const char *const name) { (void)fprintf(stderr, "%s:\n", name); - - return; } void @@ -33,7 +31,7 @@ testing(const char *const message) { if (show_colour()) { (void)fprintf( stderr, - COLOUR_YELLOW "testing" COLOUR_RESET ": %s...", + COLOUR_YELLOW "testing" COLOUR_RESET ": %s... ", message ); } else { @@ -43,17 +41,13 @@ testing(const char *const message) { message ); } - - return; } void test_ok(void) { if (show_colour()) { - (void)fprintf(stderr, " " COLOUR_GREEN "OK" COLOUR_RESET ".\n"); + (void)fprintf(stderr, COLOUR_GREEN "OK" COLOUR_RESET ".\n"); } else { (void)fprintf(stderr, " OK.\n"); } - - return; } -- cgit v1.2.3