-# Copyright © 2022 Nick Bowler
+# Copyright © 2022-2023 Nick Bowler
#
# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
# This is free software: you are free to do what the fuck you want to.
.dat.h:
$(AM_V_GEN) :; { \
$(AWK) -f $(DX_BASEDIR)/scripts/gen-tree.awk $< && \
- printf '%s\n' \
- 'sub(/^#&/, "\\&") == 0 { next }' \
- '{ has_strtab=1 } END { if (!has_strtab) { exit(0); } print "" }' \
- | $(AWK) -f - -f $(DX_BASEDIR)/scripts/gen-strtab.awk $<; \
+ $(AWK) -f $(srcdir)/src/mkstrtab.awk \
+ -f $(DX_BASEDIR)/scripts/gen-strtab.awk $<; \
} >$@-t
$(AM_V_at) mv -f $@-t $@
-$(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-strtab.awk
-EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-strtab.awk
+$(TREEFILES:.dat=.h): src/mkstrtab.awk $(DX_BASEDIR)/scripts/gen-strtab.awk
+EXTRA_DIST += src/mkstrtab.awk $(DX_BASEDIR)/scripts/gen-strtab.awk
$(TREEFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-tree.awk
EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk
DISTCLEANFILES += $(TREEFILES:.dat=.h)
-Subproject commit 8cda0a6cc9cc31edf0fe94c470038f12c8dcc905
+Subproject commit 203a69fab1ff61e958dfb88599fd5d7f24648abf
--- /dev/null
+#!/bin/awk -f
+#
+# Copyright © 2023 Nick Bowler
+#
+# Helper script used by the RRace makefile to combine gen-tree.awk and
+# gen-strtab.awk inputs into a single source file and build rule.
+#
+# Usage: awk -f mkstrtab.awk -f gen-strtab.awk input.dat
+#
+# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
+# This is free software: you are free to do what the fuck you want to.
+# There is NO WARRANTY, to the extent permitted by law.
+
+{
+ if (sub(/^#&/, "\\&")) {
+ # Lines beginning with #& are taken verbatim (with the # removed)
+ explicit[$1] = 1;
+ } else if (sub(/,$/, "", $1) && !("&"$1 in explicit)) {
+ # Put tree node ids into the strtab, unless explicitly defined earlier.
+ $0 = "&&" $1 " " $1;
+ } else {
+ next;
+ }
+}
/*
* X11 GUI for slide puzzle game
- * Copyright © 2022 Nick Bowler
+ * Copyright © 2022-2023 Nick Bowler
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "xcounter.h"
#include "version.h"
+#define tree_strtab strtab
+
/* XXX generate this list? */
enum {
widgetMainWindow,
construct_widgets(mainwin, shell, 0);
- menubar = XtNameToWidget(shell, "*menuBar");
+ menubar = XtNameToWidget(shell, &strtab[glob_menuBar]);
construct_menu(mainmenu, menubar, 0);
- help = XtNameToWidget(menubar, "helpMenu");
+ help = XtNameToWidget(menubar, tree_strtab+helpMenu);
XtVaSetValues(menubar, XmNmenuHelpWidget, help, (char *)NULL);
- configure_mainwin(state, XtNameToWidget(shell, "*game"));
+ configure_mainwin(state, XtNameToWidget(shell, &strtab[glob_game]));
XtAddCallback(state->game, XmNresizeCallback, resize, state);
XtAddCallback(state->game, XmNexposeCallback, expose, state);
construct_widgets(dialog, shell, 0);
- w = XtNameToWidget(shell, "*aboutDialog");
+ w = XtNameToWidget(shell, &strtab[glob_aboutDialog]);
XtUnmanageChild(XmMessageBoxGetChild(w, XmDIALOG_CANCEL_BUTTON));
XtAddCallback(w, XmNunmapCallback, dialog_close, NULL);
(char *)NULL);
free(msg);
- l = XtNameToWidget(w, "*licenseBlurb");
+ l = XtNameToWidget(w, &strtab[glob_licenseBlurb]);
XmTextSetString(l,
"This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
+@nostrtab
+
MAINWIN
main, main_OFFSET, widgetMainWindow
menuBar, 0, widgetMenuBar
gameExit, 0, widgetPushButton, gameExitLabel
helpMenu, helpMenu_OFFSET, widgetCascadeButton, helpMenuLabel
helpAbout, 0, widgetPushButton, helpAboutLabel
+
+#&&glob_licenseBlurb *licenseBlurb
+#&&glob_aboutDialog *aboutDialog
+#&&glob_menuBar *menuBar
+#&&glob_game *game