Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C62122

ZRegion slightly imperfect
Submitted by: Roger Firth     Appeared in: Compiler 6.21 or before     Fixed in: Compiler 6.30
Problem

The library routine ZRegion() is invoked by metaclass() and is occasionally useful in its own right for debugging purposes. The imperfection is that ZRegion() returns 3 -- "it's a string" -- even for values which lie above the region where this game's strings are stored. Unfortunately, small negative numbers are just such values. For example, ZRegion(-1) returns 3, when it could more usefully return 0.

Solution

Add an additional test against $001A-->0 to the Z__Region code defined in veneer.c.

  [ Z__Region addr;
      if (addr == 0 || Unsigned__Compare(addr, $001A-->0) >= 0)   rfalse;
      if (addr>=1 && addr<=(#largest_object-255))                 return 1;
      if (Unsigned__Compare(addr, #strings_offset) >= 0)          return 3;
      if (Unsigned__Compare(addr, #code_offset) >= 0)             return 2;
      rfalse;
  ];


Last updated 2 May 2008. The librarian in charge of this page is Roger Firth. Please email any comments, suggestions or corrections to roger@firthworks.com.