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

Fix issues found moving Windows build to MinGW-w64 clang #105

Closed
wants to merge 0 commits into from

Conversation

DavidKinder
Copy link
Collaborator

@DavidKinder DavidKinder commented Jun 17, 2023

The main issue here is to do with the Glulxe interpreter used in the test harness. At the moment, we build that using the makefiles that come with CheapGlk and Glulxe, passing OS_UNIX in as a define, which causes the Unix code in osdepend.c to be used. This uses the non-standard functions random() and setrandom() to generate random numbers. The trouble here is that a) we're relying on the existence of these non-standard Unix functions, and b) we're relying on all implementations of them having the same algorithm, as several tests rely on the same random number sequence being generated for a given seed. When building on Windows with Cygwin that's fine, as the functions exist and are identical in output to the Linux functions. But moving to a Windows environment with a more recent clang, we don't have those functions any more.

However, the Glulxe source code does contain an implementation of a reasonable random number generator. To use this I've added a new file, dumb.c, to the Glulxe source code in the Inform repository. This replaces osdepend.c with code that should work the same everywhere. To use that code, though, we can no longer use the Glulxe makefile as is, so I've changed inform6.mkscript to build CheapGlk and Glulxe in the same way that Frotz is built. Finally, I've updated affected tests with the appropriate ideal results for this changed random number generator.

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

Successfully merging this pull request may close these issues.

1 participant