Make #dictionary_table and ZCODE_LESS_DICT_DATA available when compiling for Z-machine?

I’ve noticed that the #dictionary_table system constant is not available when compiling for Z-machine. I’ve also noticed that the new memory setting ZCODE_LESS_DICT_DATA is not available as a virtual constant like some of the other compilation setting values are (e.g. DICT_WORD_SIZE).

It could be helpful for library maintenance purposes to have both of these exposed for use in source code. Library constant HDR_DICTIONARY does contain the same information as #dictionary_table, but I would think that consistency between compilation targets is to be preferred.

1 Like

DICT_ENTRY_BYTES is the Inform constant directly affected by that setting. Making the ZCODE_LESS_DICT_DATA setting directly available in Inform seems more confusing rather than less.

Backporting #dictionary_table to Z-code should be doable. As you say, it’s in a known location in Z-machine memory so nobody thought of giving it a symbolic name before.

(I mean the address is in a known location, HDR_DICTIONARY-->0.)

Agreed that DICT_ENTRY_BYTES is better for any purpose that I can conceive, and thank you for pointing it out, but may I ask where it (and its cousin virtual constants) are documented? I don’t see it in DM4, the current release notes, the StdLib 6.12.5 source, or even the veneer code.

I do see the C constant in 6.36’s inform.c, but the associated comment currently says “Not used in Z-code.”, and it’s not clear to me at what point this is enabled as something to use in I6 source. (A quick experiment shows that it is usable for source compiled to Z-machine, though.)

Looks like it’s not documented and that comment is out of date.

I agree. This would simply a lot of stuff in the Standard Library. In the meantime I have added code to the Standard Library to calculate these values whenever they are needed. I’m not clear what sort of performance hit these calculations incur, but I’d still like to see the values as constants.

This trailed off… what’s the specific request here? I see:

  • Document the predefined constants as they currently exist in the compiler
  • Support #dictionary_table in Z-code

Yes, that’s the current state of the request as I understand it.

For those coming across this thread, it looks like the current state of many of these constants is now documented. See Inform 6 Reference Addendum for more details.

Thank you, zarf!