Starting to use the Babel tool

I’d like to be able to use this, but the instructions at GitHub - iftechfoundation/babel-tool: Treaty of Babel analysis tool are all Greek to me. Is there an easy way? :slight_smile:

Building Babel

To build babel:

  1. compile all the source files in this directory
  2. link them together
  3. the end

For folks who find makefiles more useful than generalizations, there is a makefile provided for babel. The makefile is currently configured for Borland’s 32-bit C compiler. Comment out those lines and uncomment the block which follows for gcc.

To compile babel-get, first compile babel, then do the same thing in the babel-get directory.

To compile ifiction-aggregate, ifiction-xtract, babel-list, and simple-marry, first compile babel, then compile the relevant C file in the extras/ directory (These may rely on #include files from the babel directory, so, for example, to compile ifiction-aggregate, gcc -c -I.. ifiction-aggregate.c), then link the object file to the babel and ifiction libraries (babel.lib and ifiction.lib under Windows, babel.a and ifiction.a most everywhere else. eg. gcc -o ifiction-aggregate ifiction-aggregate.o ../babel.a ../ifiction.a)

Just typing make in the babel directory works on Mac or Linux. Someone else will have to say if it works on Windows.

This generates the babel command-line tool, which does a bunch of things like extracting IFIDs and iFiction files. I don’t know about the code in extras/; I don’t remember what any of those do, actually.

2 Likes

Thanks. I got this working on Debian. Here are some notes for any other amateurs trying this at home.

Initially when I typed make I got -bash: make: command not found but apt-get install make solved that.

Next make gave me:

cc -g -Wall -c babel.c
make: cc: No such file or directory
make: *** [Makefile:58: babel.o] Error 127

But this solved it:

sudo apt update
sudo apt install build-essential

sudo make seemed to work all right.

Some notes and warnings
$ sudo make
cc -g -Wall -c babel.c
cc -g -Wall -c babel_story_functions.c
cc -g -Wall -c babel_ifiction_functions.c
cc -g -Wall -c babel_multi_functions.c
ar -r babel_functions.a babel_story_functions.o babel_ifiction_functions.o babel_multi_functions.o
ar: creating babel_functions.a
cc -g -Wall -c ifiction.c
ifiction.c: In function ‘ifiction_validate_tag’:
ifiction.c:189:85: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 200 and 465 [-Wformat-overflow=]
  189 |                     sprintf(ebuf,"Error: (line %d) Found more than one <%s> within <%s>",xtg->beginl,xtg->tag,
      |                                                                                     ^~
ifiction.c:189:21: note: ‘sprintf’ output between 49 and 569 bytes into a destination of size 512
  189 |                     sprintf(ebuf,"Error: (line %d) Found more than one <%s> within <%s>",xtg->beginl,xtg->tag,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  190 |                         parent->tag);
      |                         ~~~~~~~~~~~~
ifiction.c:177:87: warning: ‘%s’ directive writing up to 255 bytes into a region of size between 195 and 460 [-Wformat-overflow=]
  177 |                 sprintf(ebuf, "Error: (line %d) Tag <%s> is not permitted within tag <%s>",
      |                                                                                       ^~
ifiction.c:177:17: note: ‘sprintf’ output between 54 and 574 bytes into a destination of size 512
  177 |                 sprintf(ebuf, "Error: (line %d) Tag <%s> is not permitted within tag <%s>",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  178 |                     xtg->beginl,xtg->tag,parent->tag);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ifiction.c: In function ‘ifiction_parse’:
ifiction.c:466:61: warning: ‘%s’ directive writing up to 2399 bytes into a region of size between 480 and 490 [-Wformat-overflow=]
  466 |                     sprintf(ebuffer,"Error: (line %d) saw </%s> without <%s>",getln(xml), buffer,buffer);
      |                                                             ^~                            ~~~~~~
ifiction.c:466:21: note: ‘sprintf’ output between 35 and 4843 bytes into a destination of size 512
  466 |                     sprintf(ebuffer,"Error: (line %d) saw </%s> without <%s>",getln(xml), buffer,buffer);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -g -Wall -c register_ifiction.c
ar -r ifiction.a ifiction.o register_ifiction.o
ar: creating ifiction.a
cc -g -Wall -c babel_handler.c
babel_handler.c: In function ‘deeper_babel_init’:
babel_handler.c:137:27: warning: ‘ed ’ directive writing 3 bytes into a region of size between 1 and 512 [-Wformat-overflow=]
  137 |         sprintf(buffer,"%sed %s",buffert,buffer2);
      |                           ^~~
babel_handler.c:137:9: note: ‘sprintf’ output between 4 and 1026 bytes into a destination of size 512
  137 |         sprintf(buffer,"%sed %s",buffert,buffer2);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc -g -Wall -c register.c modules.h
cc -g -Wall -c misc.c
cc -g -Wall -c md5.c
cc -g -Wall -c zcode.c
cc -g -Wall -c magscrolls.c
cc -g -Wall -c blorb.c
cc -g -Wall -c glulx.c
cc -g -Wall -c hugo.c
cc -g -Wall -c agt.c
cc -g -Wall -c level9.c
cc -g -Wall -c html.c
cc -g -Wall -c executable.c
cc -g -Wall -c advsys.c
cc -g -Wall -c tads.c
cc -g -Wall -c tads2.c
cc -g -Wall -c tads3.c
cc -g -Wall -c adrift.c
cc -g -Wall -c alan.c
ar -r babel.a babel_handler.o register.o misc.o md5.o zcode.o magscrolls.o blorb.o glulx.o hugo.o agt.o level9.o html.o executable.o advsys.o tads.o tads2.o tads3.o adrift.o alan.o
ar: creating babel.a
cc -g -Wall -o babel babel.o babel_functions.a ifiction.a babel.a

Initially typing babel gave me babel: command not found but ./babel works fine.

$ ./babel -ifid gamefiles/STORY.DAT
IFID: ZCODE-4-220107-DE48

:partying_face: