Add compile-time option to disable Blorb for the Dumb interface.
authorDavid Griffith <dave@661.org>
Tue, 4 Sep 2018 05:19:48 +0000 (22:19 -0700)
committerDavid Griffith <dave@661.org>
Tue, 4 Sep 2018 05:19:48 +0000 (22:19 -0700)
Makefile
src/dumb/Makefile
src/dumb/dumb_blorb.c
src/dumb/dumb_blorb.h
src/dumb/dumb_init.c

index f6e83b437fad823a9ce5492fb48cee7c788e2400..99edeb2f58ea63c52389934881708dff7c40ba7a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,10 @@ CURSES ?= -lncurses
 #
 #NO_MEMMOVE = yes
 
+# Uncomment this if you want to disable the compilation of Blorb support.
+#
+#NO_BLORB = yes
+
 #########################################################################
 # This section is where Frotz is actually built.
 # Under normal circumstances, nothing in this section should be changed.
@@ -140,8 +144,10 @@ CURSES_DEFINES = $(CURSES_DIR)/ux_defines.h
 DUMB_DIR = $(SRCDIR)/dumb
 DUMB_LIB = $(DUMB_DIR)/frotz_dumb.a
 
+ifndef NO_BLORB
 BLORB_DIR = $(SRCDIR)/blorb
 BLORB_LIB = $(BLORB_DIR)/blorblib.a
+endif
 
 SDL_DIR = $(SRCDIR)/sdl
 SDL_LIB = $(SDL_DIR)/frotz_sdl.a
@@ -219,9 +225,13 @@ ifdef NO_STRRCHR
 endif
 ifdef NO_MEMMOVE
        @echo "#define NO_MEMMOVE" >> $@
+endif
+ifdef NO_BLORB
+       @echo "#define NO_BLORB" >> $@
 endif
        @echo "#endif /* COMMON_DEFINES_H */" >> $@
 
+
 curses_defines: $(CURSES_DEFINES)
 $(CURSES_DEFINES):
        @echo "** Generating $@"
index 164032647d5ffd09a3ddb7fa8207e742c2e68d33..d6165d5a1414b52496f2bbedac198a631eb1c43d 100644 (file)
@@ -12,12 +12,16 @@ ARFLAGS = rc
 .DELETE_ON_ERROR:
 
 $(TARGET): $(OBJECTS)
+ifndef NO_BLORB
        $(AR) $(ARFLAGS) $@ $?
        $(RANLIB) $@
        @echo "** Done with dumb interface."
+endif
 
 clean:
        rm -f $(TARGET) $(OBJECTS)
 
 %.o: %.c
+ifndef NO_BLORB
        $(CC) $(CFLAGS) -fPIC -fpic -o $@ -c $<
+endif
index 26efd270d99a278dc524339eef8d8aa254d3459b..ced0074655d5875dd6aec1f521484bc13f4e30da 100644 (file)
@@ -19,6 +19,7 @@
  * Or visit http://www.fsf.org/
  */
 
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -30,6 +31,9 @@
 #include "dumb_frotz.h"
 #include "dumb_blorb.h"
 
+/* Don't build any of this if we don't want Blorb support. */
+#ifndef NO_BLORB
+
 f_setup_t f_setup;
 
 FILE *blorb_fp;
@@ -174,3 +178,5 @@ static int isblorb(FILE *fp)
 
     return 1;
 }
+
+#endif /* NO_BLORB */
index ec84be05811ac99072581423a3e463733e23030e..e85a8c9450e2bbf238a4bea0259e7fa51513e5a4 100644 (file)
@@ -5,6 +5,8 @@
  *
  */
 
+#ifndef NO_BLORB
+
 #include "../blorb/blorb.h"
 #include "../blorb/blorblow.h"
 
@@ -41,3 +43,5 @@ extern bb_result_t    blorb_res;
 
 bb_err_t dumb_blorb_init(char *);
 void dumb_blorb_stop(void);
+
+#endif /* NO_BLORB */
index fb0429dae7a0b069de38fad5b4f08cdf413e473d..8854b3d45a8a945339ecdad9378d6974789206c9 100644 (file)
@@ -217,6 +217,7 @@ FILE *os_load_story(void)
 {
     FILE *fp;
 
+#ifndef NO_BLORB
     switch (dumb_blorb_init(f_setup.story_file)) {
        case bb_err_NoBlorb:
 //       printf("No blorb file found.\n\n");
@@ -237,6 +238,9 @@ FILE *os_load_story(void)
     /* Is this a Blorb file containing Zcode? */
     if (f_setup.exec_in_blorb)
         fseek(fp, blorb_res.data.startpos, SEEK_SET);
+#else
+    fp = fopen(f_setup.story_file, "rb");
+#endif /* NO_BLORB */
 
     return fp;
 }