From 320851f215662265a2ab323c2bc7424e1b6acd33 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 17 Jun 2022 21:39:50 -0400 Subject: [PATCH] Combine motifgui.dat / motifstr.str into one file. Pull in updated gen-tree.awk with support for comments, and use a special comment syntax to allow simple strtab definitions in a single file. This allows keeping the menu label definitions together with the menu tree, and reduces the number of generated headers to worry about. --- Makefile.am | 31 ++++++++++++++++--------------- common | 2 +- src/motif_ui.c | 1 - src/motifgui.dat | 6 ++++++ src/motifstr.str | 5 ----- 5 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 src/motifstr.str diff --git a/Makefile.am b/Makefile.am index 821701d..e5efa40 100644 --- a/Makefile.am +++ b/Makefile.am @@ -55,7 +55,7 @@ $(libmotifmain_a_OBJECTS): src/motifopt.h EXTRA_LIBRARIES += libmotifui.a libmotifui_a_SOURCES = src/motif_ui.c $(libmotifui_a_OBJECTS): $(gnulib_headers) -$(libmotifui_a_OBJECTS): src/motifgui.h src/motifstr.h +$(libmotifui_a_OBJECTS): src/motifgui.h EXTRA_LIBRARIES += libglohelp.a libglohelp_a_SOURCES = common/src/help.c common/src/help.h @@ -71,21 +71,22 @@ $(OPTFILES:.opt=.h): $(DX_BASEDIR)/scripts/gen-options.awk DISTCLEANFILES += $(OPTFILES:.opt=.h) EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-options.awk $(OPTFILES) -STRFILES = src/motifstr.str -.str.h: - $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-strtab.awk $< >$@.tmp - $(AM_V_at) mv -f $@.tmp $@ -$(STRFILES:.str=.h): $(DX_BASEDIR)/scripts/gen-strtab.awk -DISTCLEANFILES += $(STRFILES:.str=.h) -EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-strtab.awk $(STRFILES) - -GUIFILES = src/motifgui.dat +TREEFILES = src/motifgui.dat .dat.h: - $(AM_V_GEN) $(AWK) -f $(DX_BASEDIR)/scripts/gen-tree.awk $< >$@.tmp - $(AM_V_at) mv -f $@.tmp $@ -$(GUIFILES:.dat=.h): $(DX_BASEDIR)/scripts/gen-tree.awk -DISTCLEANFILES += $(GUIFILES:.dat=.h) -EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk $(GUIFILES) + $(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 $<; \ + } >$@-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): $(DX_BASEDIR)/scripts/gen-tree.awk +EXTRA_DIST += $(DX_BASEDIR)/scripts/gen-tree.awk +DISTCLEANFILES += $(TREEFILES:.dat=.h) +EXTRA_DIST += $(TREEFILES) check_PROGRAMS = t/boardmove t/boardbit t/ewmhicon t/rng-test EXTRA_DIST += t/xos256ss.c diff --git a/common b/common index 4d796da..8cda0a6 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 4d796dabafdee54a7b726013416730efaafa905e +Subproject commit 8cda0a6cc9cc31edf0fe94c470038f12c8dcc905 diff --git a/src/motif_ui.c b/src/motif_ui.c index 05721e0..7eafc64 100644 --- a/src/motif_ui.c +++ b/src/motif_ui.c @@ -22,7 +22,6 @@ #include #include "motif.h" -#include "motifstr.h" #include "motifgui.h" #include "xcounter.h" #include "version.h" diff --git a/src/motifgui.dat b/src/motifgui.dat index 159a815..b229007 100644 --- a/src/motifgui.dat +++ b/src/motifgui.dat @@ -12,6 +12,12 @@ ABOUTDIALOG aboutDialog, aboutDialog_OFFSET, widgetUnmanaged|widgetMessageDialog licenseBlurb, 0, widgetScrolledText +#&gameMenuLabel G|Game +#&gameNewLabel N|New +#&gameExitLabel x|Exit +#&helpMenuLabel H|Help +#&helpAboutLabel A|About RRace + MAINMENU gameMenu, gameMenu_OFFSET, widgetCascadeButton, gameMenuLabel gameNew, 0, widgetPushButton, gameNewLabel diff --git a/src/motifstr.str b/src/motifstr.str deleted file mode 100644 index 27ac167..0000000 --- a/src/motifstr.str +++ /dev/null @@ -1,5 +0,0 @@ -&gameMenuLabel G|Game -&gameNewLabel N|New -&gameExitLabel x|Exit -&helpMenuLabel H|Help -&helpAboutLabel A|About RRace -- 2.43.2