]> git.draconx.ca Git - rrace.git/commitdiff
Combine motifgui.dat / motifstr.str into one file.
authorNick Bowler <nbowler@draconx.ca>
Sat, 18 Jun 2022 01:39:50 +0000 (21:39 -0400)
committerNick Bowler <nbowler@draconx.ca>
Sat, 18 Jun 2022 01:39:50 +0000 (21:39 -0400)
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
common
src/motif_ui.c
src/motifgui.dat
src/motifstr.str [deleted file]

index 821701d39acc2b501b0dbaeee1a6382694f1a2db..e5efa40c5410206321cd92a62f10e0050ea26165 100644 (file)
@@ -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 4d796dabafdee54a7b726013416730efaafa905e..8cda0a6cc9cc31edf0fe94c470038f12c8dcc905 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 4d796dabafdee54a7b726013416730efaafa905e
+Subproject commit 8cda0a6cc9cc31edf0fe94c470038f12c8dcc905
index 05721e09a95b1515dcf79feb25b7f54320f43c04..7eafc643744db24bce10aeaf05bf0b3a5c01350c 100644 (file)
@@ -22,7 +22,6 @@
 #include <Xm/XmAll.h>
 
 #include "motif.h"
-#include "motifstr.h"
 #include "motifgui.h"
 #include "xcounter.h"
 #include "version.h"
index 159a8152bca0ffa1a01a3584e6eaad03f22d3bc1..b22900759e99b2db74976542aece1f02a9b602d2 100644 (file)
@@ -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 (file)
index 27ac167..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-&gameMenuLabel  G|Game
-&gameNewLabel     N|New
-&gameExitLabel    x|Exit
-&helpMenuLabel  H|Help
-&helpAboutLabel   A|About RRace