Skip to content

Commit

Permalink
GLULX_OBJECT_EXT_BYTES (Mantis 1200) from Andrew Plotkin
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kinder committed Mar 8, 2014
1 parent 74b8a08 commit 9d1d4c9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
7 changes: 7 additions & 0 deletions ReleaseNotes.html
Expand Up @@ -96,6 +96,8 @@ <h3>Features added</h3>
more efficient implementation, using Glulx&rsquo;s unsigned comparison opcodes.
<li><p>The debugging output file, generated when the <tt><b>-k</b></tt> is used, has been changed to a
new, XML-based format.
<li><p>A new Glulx-only setting <tt>$GLULX_OBJECT_EXT_BYTES</tt> has been added, which specifies an
amount of additional space to add to each object record. The default is 0.
</ul>
<h3>Bugs fixed</h3>
Items of the form [Mantis 510] quote the bug&rsquo;s reference number in Inform 7&rsquo;s Mantis bug tracker.
Expand Down Expand Up @@ -126,6 +128,11 @@ <h3>Bugs fixed</h3>
third argument to the statement will not change the global variable that the statement uses internally. [Mantis 1084]
<li><p>The 'Abbreviate' statement now works with words containing non-English characters. [Mantis 1130]
<li><p>Attempting to use <tt>@pop</tt> opcode for V5 or higher no longer results in a crash. [Mantis 1172]
<li><p>The Glulx-only setting <tt>$NUM_ATTR_BYTES</tt>, which determines the number of bytes in an object set aside
for attribute flags, now works correctly. Note that this has required a change to the veneer routines that conflicts
with the definition of <tt>FUNC_2_CP__Tab()</tt> in the &lsquo;Accelerated Functions&rsquo; section of the Glulx 3.1.2
specification. If you change this setting, you should take great care if you also use the Glulx accelerated functions
feature (as Inform 7 does by default). [Mantis 1197]
</ul>

<h2>Compiler 6.32</h2>
Expand Down
4 changes: 3 additions & 1 deletion header.h
Expand Up @@ -2518,11 +2518,13 @@ extern int32 MAX_STATIC_STRINGS, MAX_ZCODE_SIZE, MAX_LINK_DATA_SIZE,

extern int32 MAX_OBJ_PROP_COUNT, MAX_OBJ_PROP_TABLE_SIZE;
extern int MAX_LOCAL_VARIABLES, MAX_GLOBAL_VARIABLES;
extern int DICT_WORD_SIZE, DICT_CHAR_SIZE, DICT_WORD_BYTES, NUM_ATTR_BYTES;
extern int DICT_WORD_SIZE, DICT_CHAR_SIZE, DICT_WORD_BYTES;
extern int NUM_ATTR_BYTES, GLULX_OBJECT_EXT_BYTES;
extern int WARN_UNUSED_ROUTINES, OMIT_UNUSED_ROUTINES;

/* These macros define offsets that depend on the value of NUM_ATTR_BYTES.
(Meaningful only for Glulx.) */
/* GOBJFIELD: word offsets of various elements in the object structure. */
#define GOBJFIELD_CHAIN() (1+((NUM_ATTR_BYTES)/4))
#define GOBJFIELD_NAME() (2+((NUM_ATTR_BYTES)/4))
#define GOBJFIELD_PROPTAB() (3+((NUM_ATTR_BYTES)/4))
Expand Down
2 changes: 1 addition & 1 deletion inform.c
Expand Up @@ -186,7 +186,7 @@ static void select_target(int targ)
}
else {
/* Glulx */
OBJECT_BYTE_LENGTH = (1 + (NUM_ATTR_BYTES) + 6*4);
OBJECT_BYTE_LENGTH = (1 + (NUM_ATTR_BYTES) + 6*4 + (GLULX_OBJECT_EXT_BYTES));
DICT_WORD_BYTES = DICT_WORD_SIZE*DICT_CHAR_SIZE;
if (DICT_CHAR_SIZE == 1) {
DICT_ENTRY_BYTE_LENGTH = (7+DICT_WORD_BYTES);
Expand Down
19 changes: 17 additions & 2 deletions memory.c
Expand Up @@ -255,6 +255,7 @@ int DICT_WORD_SIZE; /* number of characters in a dict word */
int DICT_CHAR_SIZE; /* (glulx) 1 for one-byte chars, 4 for Unicode chars */
int DICT_WORD_BYTES; /* DICT_WORD_SIZE*DICT_CHAR_SIZE */
int NUM_ATTR_BYTES;
int GLULX_OBJECT_EXT_BYTES; /* (glulx) extra bytes for each object record */
int32 MAX_NUM_STATIC_STRINGS;
int32 MAX_UNICODE_CHARS;
int32 MAX_STACK_SIZE;
Expand Down Expand Up @@ -312,6 +313,9 @@ static void list_memory_sizes(void)
printf("| %25s = %-7d |\n","MAX_NUM_STATIC_STRINGS",
MAX_NUM_STATIC_STRINGS);
printf("| %25s = %-7d |\n","MAX_OBJECTS",MAX_OBJECTS);
if (glulx_mode)
printf("| %25s = %-7d |\n","GLULX_OBJECT_EXT_BYTES",
GLULX_OBJECT_EXT_BYTES);
if (glulx_mode)
printf("| %25s = %-7d |\n","MAX_OBJ_PROP_COUNT",
MAX_OBJ_PROP_COUNT);
Expand Down Expand Up @@ -506,13 +510,14 @@ extern void set_memory_sizes(int size_flag)
DICT_WORD_SIZE_g = 9;
NUM_ATTR_BYTES_z = 6;
NUM_ATTR_BYTES_g = 7;
GLULX_OBJECT_EXT_BYTES = 0;
MAX_UNICODE_CHARS = 64;
MEMORY_MAP_EXTENSION = 0;
/* We estimate the default Glulx stack size at 4096. That's about
enough for 90 nested function calls with 8 locals each -- the
same capacity as the Z-Spec's suggestion for Z-machine stack
size. Note that Inform 7 wants more stack, so if you're
compiling an I7 game, crank this up. */
size. Note that Inform 7 wants more stack; I7-generated code
sets MAX_STACK_SIZE to 65536 by default. */
MAX_STACK_SIZE = 4096;
OMIT_UNUSED_ROUTINES = 0;
WARN_UNUSED_ROUTINES = 0;
Expand Down Expand Up @@ -617,6 +622,14 @@ static void explain_parameter(char *command)
plus three.\n");
return;
}
if (strcmp(command,"GLULX_OBJECT_EXT_BYTES")==0)
{ printf(
" GLULX_OBJECT_EXT_BYTES is an amount of additional space to add to each \n\
object record. It is initialized to zero bytes, and the game is free to \n\
use it as desired. (This is only meaningful in Glulx, since Z-code \n\
specifies the object structure.)\n");
return;
}
if (strcmp(command,"MAX_STATIC_DATA")==0)
{ printf(
" MAX_STATIC_DATA is the size of an array of integers holding initial \n\
Expand Down Expand Up @@ -879,6 +892,8 @@ extern void memory_command(char *command)
{ NUM_ATTR_BYTES=j, flag=1;
NUM_ATTR_BYTES_g=NUM_ATTR_BYTES_z=j;
}
if (strcmp(command,"GLULX_OBJECT_EXT_BYTES")==0)
GLULX_OBJECT_EXT_BYTES=j, flag=1;
if (strcmp(command,"MAX_STATIC_DATA")==0)
MAX_STATIC_DATA=j, flag=1;
if (strcmp(command,"MAX_OLDEPTH")==0)
Expand Down
2 changes: 2 additions & 0 deletions symbols.c
Expand Up @@ -652,6 +652,8 @@ static void stockup_symbols(void)
create_symbol("GOBJFIELD_PARENT", GOBJFIELD_PARENT(), CONSTANT_T);
create_symbol("GOBJFIELD_SIBLING", GOBJFIELD_SIBLING(), CONSTANT_T);
create_symbol("GOBJFIELD_CHILD", GOBJFIELD_CHILD(), CONSTANT_T);
create_symbol("GOBJ_EXT_START", 1+NUM_ATTR_BYTES+6*WORDSIZE, CONSTANT_T);
create_symbol("GOBJ_TOTAL_LENGTH", 1+NUM_ATTR_BYTES+6*WORDSIZE+GLULX_OBJECT_EXT_BYTES, CONSTANT_T);
create_symbol("INDIV_PROP_START", INDIV_PROP_START, CONSTANT_T);
}

Expand Down
4 changes: 4 additions & 0 deletions tables.c
Expand Up @@ -1307,6 +1307,10 @@ static void construct_storyfile_g(void)
p[mark++] = (val >> 8) & 0xFF;
p[mark++] = (val) & 0xFF;
}

for (j=0; j<GLULX_OBJECT_EXT_BYTES; j++) {
p[mark++] = 0;
}
}

if (object_props_at != mark)
Expand Down

0 comments on commit 9d1d4c9

Please sign in to comment.