-
-
Notifications
You must be signed in to change notification settings - Fork 286
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
WIP: make configuration options machine-readable #644
base: main
Are you sure you want to change the base?
Conversation
aad2a1e
to
065105a
Compare
Hi, could you give me some quick feedback on the idea behind this pull request? Otherwise I fear too much time passes and I'd have to re-learn box64 internals. :) |
It looks good. |
I think |
I need to re-check |
|
Thank you for your comments!
Yes, I purposefully didn't work on that to not sink time into a project that you don't like. Would you mind switching out the current ini parser for one like https://github.com/benhoyt/inih which is available in Debian and used by lots of other projects? It wouldn't require an additional build dependency, because the library is tiny and can just be copy-pasted into the source tree.
Okay, I'll remove it.
Okay, then my struct needs another flag for configuration options that should not produce documentation.
You can still remove it independent of this pull request. I was more wondering what you think about the general idea of consolidating all options and their parsing into a unified structure that at the same time produces documentation. |
I'm not a big fan of external dependancies for box. So I would prefer to stick to "in-house" solution if possible. The unified structure for all documentation is great, but the interaction with rcfile should be thought in the conception phase, not as a second thought, because the interactions with the various option and when/how to apply them is not always trivial. |
Yes, that's why I want to add an update to the rcfile reading at the same time in this pull request. That's also why I stumbled upon what made me file #652 😄 Yes, I noticed that there is a lot going on in terms of which configuration options trigger what in which order. But currently these operations are mixed with the retrieving of configuration options itself. My goal is to separate the two and have one place that retrieves the configuration from the environment and from the rcfile and one place that then implements the resulting logic to have a clear separation between these two parts of the code, hopefully making everything easier. I'm sure that my next revision of this pull request will introduce bugs because some things are not happening anymore in the order they should but I hope the process of weeding these out is worth the end result of having everything nicely compartmentalized and hopefully more maintainable in the future. To this end I also wondered why there is a distinction between some variables that are global and then used as |
box64context_t was initialy a proper context. But after a while I realized that I don't need that context to be local, it's really is a global stuff, and the actual "context" is in fact x64emu_t |
With the addition of
docs/box64.pod
, there are now three places that list the box64 configuration options:--help
outputdocs/USAGE.md
docs/box64.pod
To reduce duplication, make maintenance easier and avoid bugs, this pull request is a WIP which tries to encode all options in an array of structs storing function pointers that can handle the option values as well as their documentation in the same place.
In its current state, the
--help
output is already generated from this array of structs. By extending it, calling box64 with--help=markdown
or--help=nroff
could easily generatedocs/USAGE.md
anddocs/box64.1
, respectively, from the same source.While implementing this, I already found a few bugs:
BOX64_DYNAREC_FORCED
is not documentedBOX64_FIX_64BIT_INODES
is not documentedbox64_malloc_hack==1
conditional is never executed because it's inside the body of abox64_malloc_hack
if clauseWhat do you think of this approach? If you think it's a good idea, then i'll extend it to cover the remaining environment variables and output markdown as well as nroff directly.