How do I insert a specific character into the Unicode translation table?

I know that Z files can include a “Unicode translation table” specifying the meaning of ZSCII characters between 155 and 251. I would like to ensure a specific character is inserted into this table, though I don’t care where; I just need to be able to print it later with @print_char.

What’s the standard way to do this in I6 (specifically the form used within I7)? I know about the Zcharacter directive but I believe it’s deprecated?

Says who?

Zcharacter is the documented way to do this.

Doesn’t look like Zcharacter is supported in Inform 10/Inter though.

Oh, perfect. So I can just…

Include (-
Zcharacter table + '@{1b}';
-).

Yep, this seems to work in 9.3! Perfect.

Yeah, that is an issue. I probably need to write a whole new kit for this. Or find a way to hack the Z-machine-specific kit.

Currently not even a kit could do it. Support for Zcharacter will need to be added to Inter.

Hm. Unfortunate. There’s no way to inject raw code into the final I6? I thought there was a specific mechanism for that in Inter, called a “splat” or something like that?

I also need to figure out if Inform 10 supports defining an array with a computed length. It seems like it should, for when you need a buffer whose length is [user-defined constant]+3, but the kits now just hardcode all those values and the usual syntax (Array whatever -> CONST+3) no longer works.

There are details on what Inform 6 isn’t allowed in v10 in WI 27.20. Either of these work:

Array whatever -> CONST+3;
Array whatever_else -> (CONST + 3);

but this doesn’t:

Array whatever_for -> CONST + 3; ! fails in v10
1 Like

Yes, a splat (raw I6 code loaded from a kit or injected from an I7 'Include (- …-) statement) is inserted into the inter compilation tree early in compilation, but these are all subsequently compiled to pure inter code. See here

There is a strongly deprecated means to inject raw code into the final output by using the Inter ‘insert’ directive, e.g. insert "\n[ LITTLE_USED_DO_NOTHING_R; rfalse; ];\n" (see here) but although it may be used by the I7 compiler, I doubt it’s accessible via I7 source- probably by design. You can’t for instance put it in an ‘Include (- … -)’ statement.

1 Like