Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No guard against changing the Z-alphabet late in compilation #309

Open
erkyrath opened this issue Dec 14, 2024 · 1 comment
Open

No guard against changing the Z-alphabet late in compilation #309

erkyrath opened this issue Dec 14, 2024 · 1 comment

Comments

@erkyrath
Copy link
Contributor

This compiles:

[ Main;
	print "Hello. This is a test of Class and String.^";
];

Zcharacter "abCdefgHtjklmnopqrsiuvwxyz"
           "ABcDEFGhIJKLMNOPQRSTUVWXYZ"
           "0123456789!$&*():;.,<>`";

The output is terrible, obviously. We should have an error if you try to change the alphabet after compiling strings.

This interacts with #276 , because Inform compiles a few strings at setup time! A naive fix would break the Zcharacter directive entirely -- because the Zcharacter directive can always corrupt those few strings.

Needs some careful sequencing.

@heasm66
Copy link
Contributor

heasm66 commented Dec 14, 2024

I'm not entirely sure what you mean, but the Zcharacter directive could issue a warning if text translation already is started.

   @@ -1189,6 +1202,8 extern int parse_given_directive(int internal_flag)
               error("The Zcharacter directive has no meaning in Glulx.");
               panic_mode_error_recovery(); return FALSE;
           }
+          if (total_chars_trans > 0)
+             warning("Zcharacter change alphabet after text translation already begun.");

           directive_keywords.enabled = TRUE;
           get_next_token();

Of course, this change after #276, otherwise we get a warning every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants