[Glulx] Changing the IO system in the middle of decoding a string

With Glulx, it’s possible that a function is called while decoding a string.

Section 1.3.4 of the spec says that when a function called while decoding a string returns, string decoding resumes.

What happens if that function has changed the IO system with @setiosys? Does “resumes” means that the initial IO system (the one when we started decoding the string) is still used, and the new one IO system will take effect on the next @streamstr? Or should we use the new IO system right away?


(While I’m at it, are the call stubs’ DestType 10 to 14 in hex or decimal? I guess hex as every other numbers in the spec, but just to be sure.)

It changes right away. But I’m not sure this has been tested across interpreters. Let me see…

There’s a test in glulxercise.inf which puts a bracketfilter() call into a function slot.

[ bracketfilter;
    @setiosys 1 surroundbracket;
];

That goes into effect as soon as the call is made, and stays in effect.

Yeah, hex.

Thanks! Next time I’ll look into glulxercise before asking a question.

I have to say I find this whole string-decoding business quite convoluted, and I don’t see yet when it can be useful to call a function while decoding a string. But I guess there’s a reason.

Actually, can Inform produce a compressed string with function calls? (Besides the author handwriting it.)

I just looked in one of my Inform 7 projects, and the initial decoding table only contained 0x00 (branch), 0x01 (terminator) and 0x03 (single character) nodes.

Abbreviations use node type 3 (byte string). Dynamic strings like @00 use node type 9, which means it should be possible to set one to a function:

string 0 PrintFunc;

Whether this has ever been tested, I have no memory.

That makes sense, I totally forgot about dynamic strings! Thanks again.

OK, so one (hopefully) last question. When the IO system is set to null, do we skip the entire decoding process (i.e. jump directly to the terminator node), or do we only ignore the printing nodes (type 2 to 5) but still process the indirect calls?

(Or to put it in another way: are function calls during string decoding considered as output?)

You just ignore the printing nodes.