Z-Machine 1.1 Standard

Okay, there was no particular desire on my part to make it compatible with Glk, although that couldn’t hurt. That said, it’s probably a good idea to keep the game from being able to choose the file extension, to stop it from creating .exe files or something similar. Unless there’s any particular good reason to add .AUX to the end, it’s probably best to just strip the stuff about extensions. I shall add this to my ever-growing list of ways I broke the Z-Machine Standard, and hopefully get round to fixing it soon.

Speaking of ways I broke the Z-Machine Standard, I noticed the other day that the description of @je is now somewhat contradictory.

The first example in brackets says that @je with just one operand is legal (although Inform cannot compile this), but the note I added from the 1.1 clarifications says that @je with just one operand is not legal. Does anyone know of a good reason why @je with only one operand shouldn’t be legal?

One unfortunate side effect of this will be that there’s a good chance that, if the user has a game that has used these save routines, then with a new version of an interpreter implementing these rules, @restore won’t find a file previously saved with @save, given the change to the file-name algorithm. That is possibly an argument for keeping the extension rules as they are.

Has anyone ever used those save routines?

I believe Infocom used them in some of their Version 6 games, but whether anyone’s used them since then, I don’t know, and it could take a lot of time to investigate.

Maybe when loading a file, the interpreter should first attempt to locate the file using the exact name given by the game, and if that fails, apply the rules to strip out extra characters? But when saving, always strip out the extra characters.

I’m not so keen on specifying that the interpreter has to do that. Possibly we could get away with allowing interpreters to use whatever rules they want to search for a file, without specifying it. Something like this as a replacement for 7.6.1:

  • 7.6.1 The game can pass any string to the interpreter to be used as a filename. In all cases the interpreter will convert the string to an appropriate filename.

  • 7.6.1.1 The interpreter will delete from the filename any characters illegal for a filename. This will include all of the following characters (and more, if the OS requires it): slash, backslash, angle brackets (less-than and greater-than), colon, double-quote, pipe (vertical bar), question-mark, and asterisk. The interpreter will also truncate the filename at the first full stop (deleting the first full stop and any following characters). If the result is the empty string, the interpreter will change it to the string “NULL”.

  • 7.6.1.2 The interpreter may add any appropriate file extension (that is, a full stop followed by a further string that identifies the type of the file) to the filename. Previous versions of this specification suggested a default file extension of “.AUX”, but this is not a requirement.

  • 7.6.1.3 When reading a file without using a prompt to the user, the interpreter may choose to search for the file using any algorithm of its choice, starting from the argument the game passes. For example, if the argument specifies a filename containing a file extension, the interpreter may choose to look for a filename with that extension and read it if it is found.