Inform - Support - Patches

About Patches  

Compiler  
Library  

DM4 Errata  

Issue C63109     [previous patch]

Support for #num_locals system constant
Submitted by: Jesse McGrew     Appeared in: Compiler 6.31 or before     Fixed in: -
Problem

Defines a system constant "#num_locals", equal to the number of local variables in the current routine (the value is unspecified outside of a routine).

Solution

Apply the following patch:

diff -c inform631-orig/expressp.c inform631_source/expressp.c
*** inform631-orig/expressp.c	Sat Jan 28 06:20:07 2006
--- inform631_source/expressp.c	Sun Dec 31 17:21:08 2006
***************
*** 342,347 ****
--- 342,352 ----
                          token_text);
                          break;
                      }
+                     else if (token_value == num_locals_SC)
+                     {   current_token.type   = SMALL_NUMBER_TT;
+                         current_token.value  = no_locals;
+                         current_token.text   = token_text;
+                     }
                      else
                      {   current_token.type   = token_type;
                          current_token.value  = token_value;
diff -c inform631-orig/header.h inform631_source/header.h
*** inform631-orig/header.h	Fri Feb 10 02:21:06 2006
--- inform631_source/header.h	Sun Dec 31 17:08:11 2006
***************
*** 1468,1473 ****
--- 1468,1474 ----
  #define dictionary_table_SC           60     /* Glulx-only */
  #define dynam_string_table_SC         61     /* Glulx-only */

+ #define num_locals_SC                 62

  /*  Index numbers into the keyword group "system_functions" (see "lexer.c")  */

diff -c inform631-orig/lexer.c inform631_source/lexer.c
*** inform631-orig/lexer.c	Sat Jan 28 06:14:30 2006
--- inform631_source/lexer.c	Sun Dec 31 17:21:51 2006
***************
*** 360,365 ****
--- 360,366 ----
      "lowest_object_number", "highest_object_number",
      "oddeven_packing",
      "grammar_table", "dictionary_table", "dynam_string_table",
+     "num_locals",
      "" },
      SYSTEM_CONSTANT_TT, FALSE, TRUE
  };


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.