-diff -P'aurx.*' nitfol-0.5/automap.c nitfol-chimara/automap.c
---- nitfol-0.5/automap.c 1999-10-20 02:09:46.000000000 +0200
-+++ nitfol-chimara/automap.c 2009-09-10 21:39:06.000000000 +0200
-@@ -1066,6 +1066,8 @@
-
- #else
-
-+char *roomsymbol = NULL;
-+
- BOOL automap_unexplore(void)
- {
- return FALSE;
-diff -P'aurx.*' nitfol-0.5/automap.h nitfol-chimara/automap.h
---- nitfol-0.5/automap.h 1999-10-25 02:55:13.000000000 +0200
-+++ nitfol-chimara/automap.h 2009-09-10 21:39:11.000000000 +0200
-@@ -26,6 +26,7 @@
- BOOL automap_unexplore (void);
-
- #else
-+extern char * roomsymbol;
- BOOL automap_unexplore (void);
-
- #endif
-Only in nitfol-0.5: copying.c
-Only in nitfol-0.5: dbg_help.h
-Only in nitfol-0.5: dbg_help.texi
-Only in nitfol-0.5: gi_blorb.h
-Only in nitfol-0.5: glk.h
-Only in nitfol-0.5: glkstart.h
-Only in nitfol-0.5: inform.c
-Only in nitfol-0.5: inform.hhh
-diff -P'aurx.*' nitfol-0.5/inform.y nitfol-chimara/inform.y
---- nitfol-0.5/inform.y 1999-10-25 02:37:17.000000000 +0200
-+++ nitfol-chimara/inform.y 2009-09-10 21:38:56.000000000 +0200
-@@ -304,7 +304,7 @@
- /* :: Show the current source language. */
- | LANGUAGE { infix_print_string("The current source language is \"inform\".\n"); }
- /* :: Get information on the current source file. */
-- | INFOSOURCE { infix_print_string("Current source file is "); infix_print_string(cur_file->filename); infix_print_string("\nContains "); infix_print_number(cur_file->num_lines); infix_print_string(" lines.\nSource language is inform.\n"); }
-+ | INFOSOURCE { infix_print_string("Current source file is "); infix_print_string(cur_file?cur_file->filename:"unknown"); infix_print_string("\nContains "); infix_print_number(cur_file?cur_file->num_lines:0); infix_print_string(" lines.\nSource language is inform.\n"); }
- /* :: List source files. */
- | INFOSOURCES { infix_print_string("Source files for which symbols have been read in:\n\n"); infix_list_files(); infix_print_char('\n'); }
- /* :: Show licensing information. */
-@@ -346,9 +346,9 @@
- */
- ;
-
--linespec: NUM { if($1.t == Z_ROUTINE) $$ = infix_get_routine_PC($1.v); else { infix_location l; infix_decode_fileloc(&l, cur_file->filename, $1.v); $$ = l.thisPC; } }
-- | '+' NUM { infix_location l; infix_decode_fileloc(&l, cur_file->filename, cur_line + $2.v); $$ = l.thisPC; }
-- | '-' NUM { infix_location l; infix_decode_fileloc(&l, cur_file->filename, cur_line - $2.v); $$ = l.thisPC; }
-+linespec: NUM { if($1.t == Z_ROUTINE) $$ = infix_get_routine_PC($1.v); else { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", $1.v); $$ = l.thisPC; } }
-+ | '+' NUM { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line + $2.v); $$ = l.thisPC; }
-+ | '-' NUM { infix_location l; infix_decode_fileloc(&l, cur_file?cur_file->filename:"", cur_line - $2.v); $$ = l.thisPC; }
- | DFILE ':' NUM { if($3.t == Z_ROUTINE) $$ = UNPACKR($3.v); else { infix_location l; infix_decode_fileloc(&l, $1->filename, $3.v); $$ = l.thisPC; } }
- | '*' NUM { $$ = $2.v; }
- ;
-@@ -388,6 +388,7 @@
- /* Expressions with conditions */
- condexp:
- exp CONDITION { cond_list newcond; newcond.val = $1.v; newcond.condfunc = $2.condfunc; newcond.opposite = $2.opposite; LEaddm(condlist, newcond, n_rmmalloc); } orlist { if($4) ignoreeffects--; $$.v = $4; $$.t = Z_BOOLEAN; LEremovem(condlist, n_rmfreeone); }
-+;
-
- /* Expressions without commas */
- exp: NUM
-diff -P'aurx.*' nitfol-0.5/init.c nitfol-chimara/init.c
---- nitfol-0.5/init.c 1999-10-24 17:38:06.000000000 +0200
-+++ nitfol-chimara/init.c 2009-09-10 21:38:52.000000000 +0200
-@@ -250,7 +250,10 @@
- z_synonymtable = MSBdecodeZ(header + HD_ABBREV);
-
- switch(zversion) {
-- case 1: case 2: case 3:
-+ case 1: case 2:
-+ game_size = filesize;
-+ break;
-+ case 3:
- game_size = ((offset) MSBdecodeZ(header + HD_LENGTH)) * 2;
- break;
- case 4: case 5:
-@@ -329,13 +332,15 @@
- n_show_fatal(E_SYSTEM, "unexpected number of bytes read", bytes_read);
-
- z_checksum = 0;
-- for(i = 0x40; i < game_size; i++)
-- z_checksum += HIBYTE(i);
-- z_checksum = ARITHMASK(z_checksum);
--
-- if(z_checksum != LOWORD(HD_CHECKSUM)) {
-- n_show_error(E_CORRUPT, "Checksum does not match", z_checksum);
-- check_ascii_mode();
-+ if (zversion >= 3) {
-+ for(i = 0x40; i < game_size; i++)
-+ z_checksum += HIBYTE(i);
-+ z_checksum = ARITHMASK(z_checksum);
-+
-+ if(LOWORD(HD_CHECKSUM) != 0 && z_checksum != LOWORD(HD_CHECKSUM)) {
-+ n_show_error(E_CORRUPT, "Checksum does not match", z_checksum);
-+ check_ascii_mode();
-+ }
- }
-
-
-diff -P'aurx.*' nitfol-0.5/io.c nitfol-chimara/io.c
---- nitfol-0.5/io.c 1999-10-22 04:53:34.000000000 +0200
-+++ nitfol-chimara/io.c 2009-09-10 21:41:59.000000000 +0200
-@@ -103,9 +103,9 @@
- stylehint_Proportional, 0);
- glk_stylehint_set(wintype_TextBuffer, style_BlockQuote,
- stylehint_Justification, stylehint_just_Centered);
--#ifdef stylehint_Reverse
-+#ifdef stylehint_ReverseColor
- glk_stylehint_set(wintype_TextBuffer, style_BlockQuote,
-- stylehint_Reverse, 1);
-+ stylehint_ReverseColor, 1);
- #endif
-
- /* User1 will be used for bold italics */
-@@ -410,7 +410,7 @@
-
- upper_win->win = glk_window_open(game_windows[0].win,
- winmethod_Above | winmethod_Fixed,
-- upper_height,
-+ 1, /* XXX huh? upper_height, */
- wintype_TextGrid, 1);
-
- if(upper_win->win == 0) {
-diff -P'aurx.*' nitfol-0.5/main.c nitfol-chimara/main.c
---- nitfol-0.5/main.c 1999-10-18 01:14:39.000000000 +0200
-+++ nitfol-chimara/main.c 2009-09-10 21:42:28.000000000 +0200
-@@ -90,17 +90,33 @@
- if(!current_zfile) {
- winid_t tempwin;
- tempwin = glk_window_open(0, 0, 100, wintype_TextBuffer, 0);
-- while(!current_zfile) {
-- strid_t z = n_file_prompt(fileusage_Data | fileusage_BinaryMode,
-- filemode_Read);
-- if(!z) {
-- w_glk_put_string_stream(glk_window_get_stream(tempwin),
-- "File not found.");
-- continue;
-- }
-- set_zfile(z);
-- }
-- glk_window_close(tempwin, NULL);
-+ glk_set_window(tempwin);
-+ glk_set_style(style_Preformatted);
-+ glk_put_string(
-+"Usage: nitfol [OPTIONS] gamefile\n"
-+" -i, -ignore Ignore Z-machine strictness errors\n"
-+" -f, -fullname For running under Emacs or DDD\n"
-+" -x, -command Read commands from this file\n"
-+" -P, -pirate Aye, matey\n"
-+" -spell Perform spelling correction\n"
-+" -expand Expand one letter abbreviations\n"
-+" -s, -symbols Specify symbol file for game\n"
-+" -t, -tandy Censors some Infocom games\n"
-+" -T, -transcript Write transcript to this file\n"
-+" -d, -debug Enter debugger immediatly\n"
-+" -prompt Specify debugging prompt\n"
-+" -autoundo Ensure '@save_undo' is called every turn\n"
-+" -S, -stacklimit Exit when the stack is this deep\n"
-+" -a, -alias Specify an alias\n"
-+" -ralias Specify an recursive alias\n"
-+" -unalias Remove an alias\n"
-+" -r, -random Set random seed\n"
-+" -mapsym Specify mapping glyphs\n"
-+" -mapsize Specify map size\n"
-+" -maploc Specify map location\n"
-+" -terpnum Specify interpreter number\n"
-+" -terpver Specify interpreter version\n");
-+ glk_exit();
- }
- z_init(current_zfile);
- if(savefile) {
-Only in nitfol-0.5: Make.dummy
-Only in nitfol-0.5: Makefile
-diff -P'aurx.*' nitfol-0.5/Makefile.am nitfol-chimara/Makefile.am
---- nitfol-0.5/Makefile.am 1970-01-01 01:00:00.000000000 +0100
-+++ nitfol-chimara/Makefile.am 2009-09-10 00:04:11.000000000 +0200
-@@ -0,0 +1,58 @@
-+PLUGIN_LIBTOOL_FLAGS=-module -avoid-version -export-symbols-regex "^glk"
-+
-+GRAPHICS = no_graph.c no_graph.h
-+# GRAPHICS = graphics.c graphics.h
-+BLORB = blorb.c
-+# BLORB = no_blorb.c
-+SOUND = no_snd.c no_snd.h
-+# SOUND = sound.c sound.h
-+
-+dist_noinst_SCRIPTS = copying.awk opt2glkc.pl y2help.pl
-+
-+pkglib_LTLIBRARIES = nitfol.la
-+nitfol_la_SOURCES = automap.c automap.h binary.h copying.h debug.c debug.h \
-+ decode.c decode.h errmesg.c errmesg.h globals.c globals.h hash.c hash.h \
-+ iff.c iff.h infix.c infix.h inform.y inform.h init.c init.h io.c \
-+ linkevil.h main.c main.h nio.h nitfol.h no_blorb.h objects.c objects.h \
-+ op_call.c op_call.h op_jmp.c op_jmp.h oplist.c oplist.h op_math.c \
-+ op_math.h op_save.c op_save.h op_table.c op_table.h op_v6.c op_v6.h \
-+ portfunc.c portfunc.h quetzal.c quetzal.h solve.c solve.h stack.c stack.h \
-+ struct.c struct.h tokenise.c tokenise.h undo.c undo.h z_io.c z_io.h \
-+ zscii.c zscii.h \
-+ $(GRAPHICS) \
-+ $(BLORB) \
-+ $(SOUND)
-+nodist_nitfol_la_SOURCES = copying.c dbg_help.h startunix.c
-+nitfol_la_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/libchimara \
-+ -DSMART_TOKENISER -DUSE_INLINE
-+nitfol_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
-+
-+info_TEXINFOS = nitfol.texi
-+nitfol_TEXINFOS = dbg_help.texi options.texi
-+# man_MANS = nitfol.6
-+
-+BUILT_SOURCES = copying.c dbg_help.h startunix.c
-+CLEANFILES = $(BUILT_SOURCES) dbg_help.texi nitfol.6 options.texi
-+
-+dbg_help.h: inform.y y2help.pl
-+ $(PERL) $(srcdir)/y2help.pl $(srcdir)/inform.y
-+
-+dbg_help.texi: inform.y y2help.pl
-+ $(PERL) $(srcdir)/y2help.pl $(srcdir)/inform.y
-+
-+copying.c: COPYING copying.awk
-+ $(AWK) --file $(srcdir)/copying.awk <$(srcdir)/COPYING >copying.c
-+
-+# nitfol.6: nitfol.opt opt2glkc.pl
-+# $(PERL) $(srcdir)/opt2glkc.pl -man $(srcdir)/nitfol.opt
-+
-+options.texi: nitfol.opt opt2glkc.pl
-+ $(PERL) $(srcdir)/opt2glkc.pl -info $(srcdir)/nitfol.opt
-+
-+startunix.c: nitfol.opt opt2glkc.pl
-+ $(PERL) $(srcdir)/opt2glkc.pl -unix $(srcdir)/nitfol.opt
-+
-+EXTRA_DIST = nitfol.opt crashme.inf test.inf
-+
-+nitfoldocdir = $(datadir)/doc/$(PACKAGE)/nitfol
-+dist_nitfoldoc_DATA = ChangeLog COPYING INSTALL README
-Only in nitfol-0.5: nitfol
-Only in nitfol-0.5: nitfol.6
-diff -P'aurx.*' nitfol-0.5/nitfol.h nitfol-chimara/nitfol.h
---- nitfol-0.5/nitfol.h 1999-10-24 16:56:06.000000000 +0200
-+++ nitfol-chimara/nitfol.h 2009-09-10 21:56:44.000000000 +0200
-@@ -30,11 +30,12 @@
- #define NITFOL_MINOR 5
-
- /* Change these next few typedefs depending on your compiler */
--typedef unsigned char zbyte;
-+#include <stdint.h>
-+typedef uint8_t zbyte;
-
- #ifdef FAST_SHORT
--typedef unsigned short zword;
--typedef unsigned long offset;
-+typedef uint16_t zword;
-+typedef uint32_t offset;
-
- #ifdef TWOS16SHORT
- #define FAST_TWOS16SHORT
-@@ -43,11 +44,11 @@
- #else
-
- #ifdef FAST_SIGNED
--typedef int zword;
--typedef long offset;
-+typedef int32_t zword;
-+typedef int32_t offset;
- #else
--typedef unsigned int zword; /* Needs to be >= real zword */
--typedef unsigned long offset;
-+typedef uint32_t zword; /* Needs to be >= real zword */
-+typedef uint32_t offset;
- #endif
-
- #endif
-Only in nitfol-0.5: nitfol.html
-Only in nitfol-0.5: nitfol.info
-diff -P'aurx.*' nitfol-0.5/nitfol.opt nitfol-chimara/nitfol.opt
---- nitfol-0.5/nitfol.opt 1999-10-24 16:56:06.000000000 +0200
-+++ nitfol-chimara/nitfol.opt 2009-09-10 21:56:44.000000000 +0200
-@@ -3,7 +3,7 @@
- # You can alter the 'default' part to change the game's default options.
-
- # Longest name Long short description type default code
-- "Ignore errors" ignore i "Ignore Z-machine strictness errors" flag 1 { ignore_errors = flag; }
-+ "Ignore errors" ignore i "Ignore Z-machine strictness errors" flag 1 { ignore_errors = flag; }
- Normally nitfol checks for illegal and undefined Z-machine behaviour and alerts the user. If you're playing someone else's buggy game, this can be annoying and you should use this option.
-
- "Inferior debugger" fullname f "For running under Emacs or DDD" flag 0 { fullname = flag; }
-Only in nitfol-0.5: options.texi
-Only in nitfol-0.5: rg_qsort.h
-Only in nitfol-0.5: startdos.c
-Only in nitfol-0.5: startmac.c
-Only in nitfol-0.5: startunix.c
-Only in nitfol-0.5: startwin.c
-diff -P'aurx.*' nitfol-0.5/z_io.c nitfol-chimara/z_io.c
---- nitfol-0.5/z_io.c 1999-10-24 19:20:50.000000000 +0200
-+++ nitfol-chimara/z_io.c 2009-04-05 19:17:51.000000000 +0200
-@@ -900,13 +900,14 @@
-
- length = n_read(text + 1, maxlen, operand[1], 0,
- operand[2], operand[3], &term);
-- if(!read_abort)
-+ if(!read_abort) {
- LOBYTEwrite(text + 1 + length, 0); /* zero terminator */
-
-- if(allow_saveundo) {
-- if(!has_done_save_undo && auto_save_undo)
-- saveundo(FALSE);
-- has_done_save_undo = FALSE;
-+ if(allow_saveundo) {
-+ if(!has_done_save_undo && auto_save_undo)
-+ saveundo(FALSE);
-+ has_done_save_undo = FALSE;
-+ }
- }
- }
-
-@@ -928,12 +929,12 @@
- if(!read_abort) {
- LOBYTEwrite(text + 1, length);
- mop_store_result(term);
-- }
--
-- if(allow_saveundo) {
-- if(!has_done_save_undo && auto_save_undo)
-- saveundo(FALSE);
-- has_done_save_undo = FALSE;
-+
-+ if(allow_saveundo) {
-+ if(!has_done_save_undo && auto_save_undo)
-+ saveundo(FALSE);
-+ has_done_save_undo = FALSE;
-+ }
- }
- }
-
-@@ -1094,5 +1095,38 @@
-
- void op_print_unicode(void)
- {
-- output_char(operand[0]);
-+ if(!allow_output)
-+ return;
-+ if(operand[0] >= 256 || (operand[0] > 127 && operand[0] < 160)) {
-+ output_char('?');
-+ return;
-+ }
-+ if(output_stream & STREAM3) {
-+ if(operand[0] >= 160) {
-+ const unsigned char default_unicode_zscii_translation[] = {
-+ 0x00, 0xde, 0x00, 0xdb, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+ 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0xdf,
-+ 0xba, 0xaf, 0xc4, 0xd0, 0x9e, 0xca, 0xd4, 0xd6,
-+ 0xbb, 0xb0, 0xc5, 0xa7, 0xbc, 0xb1, 0xc6, 0xa8,
-+ 0xda, 0xd1, 0xbd, 0xb2, 0xc7, 0xd2, 0x9f, 0x00,
-+ 0xcc, 0xbe, 0xb3, 0xc8, 0xa0, 0xb4, 0xd9, 0xa1,
-+ 0xb5, 0xa9, 0xbf, 0xcd, 0x9b, 0xc9, 0xd3, 0xd5,
-+ 0xb6, 0xaa, 0xc0, 0xa4, 0xb7, 0xab, 0xc1, 0xa5,
-+ 0xd8, 0xce, 0xb8, 0xac, 0xc2, 0xcf, 0x9c, 0x00,
-+ 0xcb, 0xb9, 0xad, 0xc3, 0x9d, 0xae, 0xd7, 0xa6
-+ };
-+ unsigned char c = default_unicode_zscii_translation[operand[0] - 160];
-+ output_char(c == 0 ? '?' : c);
-+ } else if(operand[0] == 10) {
-+ output_char(13);
-+ } else {
-+ output_char(operand[0]);
-+ }
-+ } else {
-+ if(output_stream & STREAM1) {
-+ z_put_char(current_window, operand[0]);
-+ }
-+ }
- }
-diff -P'aurx.*' nitfol-0.5/zscii.c nitfol-chimara/zscii.c
---- nitfol-0.5/zscii.c 1999-10-18 01:14:45.000000000 +0200
-+++ nitfol-chimara/zscii.c 2009-04-05 19:17:51.000000000 +0200
-@@ -41,7 +41,7 @@
-
-
- /* Returns character for given alphabet, letter pair */
--static char alphabetsoup(unsigned spoon, unsigned char letter)
-+static unsigned char alphabetsoup(unsigned spoon, unsigned char letter)
- {
- const char *alphabet;
-