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

Possible compile_string() bug #49

Open
erkyrath opened this issue May 28, 2022 · 2 comments
Open

Possible compile_string() bug #49

erkyrath opened this issue May 28, 2022 · 2 comments

Comments

@erkyrath
Copy link
Owner

Described in thread: https://intfiction.org/t/help-fixing-everybody-dies-so-its-playable-online/51346

When iosys is zero, printing a string should silently do nothing. Instead it maybe generates a Glk "stream not set" error?

A couple of places seem to generate glk_put_jstring() calls without checking iosys:

oputil_flush_string()
stream_string()
accel_func_map error cases

@erkyrath
Copy link
Owner Author

Now I'm thinking that it's not compile_string() after all. Looks like msww was correct in the thread that stream_string() should check iosys.

@erkyrath
Copy link
Owner Author

The problem turned out to be more subtle than either of us... I think it's fixed now.

accel_func_map errors now only print if iosys is 2. (I have made the same change in glulxe.)

In oputil_flush_string() and stream_string(), we don't need to check iosys. We're printing text buffered for the Glk stream. But we do need to check if the buffered text is empty. The compile_string() layer returns "" if nothing was printed to Glk at all, and we need to not crash in that case.

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

1 participant