From 938e0bfac75302b5056223ffee919d650fdb56be Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Thu, 13 Nov 2025 21:05:27 +0100 Subject: Add _ macro to bin/main.c --- src/bin/main.c | 17 ++++++++++++++++- src/core/init.c | 8 ++++++-- src/core/nls.h | 5 +++-- src/include/aplwc.h | 1 + 4 files changed, 26 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/bin/main.c b/src/bin/main.c index 19281ea..5d5ea97 100644 --- a/src/bin/main.c +++ b/src/bin/main.c @@ -1,12 +1,27 @@ +#include +#include #include +#if ENABLE_NLS +#include +#define _(S) dgettext(PACKAGE, S) +#else +#define _(S) S +#endif + int main(int argc, char *argv[]) { APLWCFunctions fns; + APLWC *aplwc; + + aplwc_boot(); + + if(argc != 1) + puts(_("No command line arguments expected")); aplwc_init_fns(&fns); - APLWC *aplwc = aplwc_init(&fns, NULL); + aplwc = aplwc_init(&fns, NULL); aplwc_exit(aplwc); return 0; } diff --git a/src/core/init.c b/src/core/init.c index 04a7135..3fd07a1 100644 --- a/src/core/init.c +++ b/src/core/init.c @@ -33,6 +33,12 @@ default_fatal(void *aux, char *msg) exit(EXIT_FAILURE); } +void +aplwc_boot(void) +{ + init_nls(); +} + void aplwc_init_fns(APLWCFunctions *fns) { @@ -45,8 +51,6 @@ aplwc_init_fns(APLWCFunctions *fns) APLWC * aplwc_init(APLWCFunctions *fns, void *aux) { - init_nls(); - size_t size = sizeof(APLWC) + (APLWC_ALIGNMENT - 1) + WS_START_SIZE + (WS_ALIGNMENT - 1); intptr_t base = (intptr_t)fns->alloc(aux, size); intptr_t aligned; diff --git a/src/core/nls.h b/src/core/nls.h index dfa640d..3709d6d 100644 --- a/src/core/nls.h +++ b/src/core/nls.h @@ -1,11 +1,12 @@ #ifndef NLS_H #define NLS_H +#include + #if ENABLE_NLS -#include #include -#define _(S) gettext(S) +#define _(S) dgettext(PACKAGE, S) #define init_nls() \ do{ \ bindtextdomain(PACKAGE, LOCALEDIR); \ diff --git a/src/include/aplwc.h b/src/include/aplwc.h index 6724127..61ccc36 100644 --- a/src/include/aplwc.h +++ b/src/include/aplwc.h @@ -14,6 +14,7 @@ struct APLWCFunctions void (*fatal)(void *, char *); }; +void aplwc_boot(void); void aplwc_init_fns(APLWCFunctions *); APLWC *aplwc_init(APLWCFunctions *, void *aux); void aplwc_exit(APLWC *); -- cgit v1.2.3