Modern C++ code is written but not used. What am I missing?

Started by Monsieur OUXX, Thu 04/08/2022 16:53:17

Previous topic - Next topic

Monsieur OUXX

I see in main.cpp that there's this main_process_cmdline function to parse command line arguments.
But I also see in cmdlineopts.cpp that the same code has been rewritten in modern c++.

Is the new code supposed to be part of AGS4, and, if yes, what do I need to toggle to enable the new code? Nothing seems to be using CmdLineOpts::Parse.


My bad. It's used by the new compiler. The Engine's startup simply hasn't been updated to use this too.





 

Monsieur OUXX

 

eri0o

When making the command line handling thing for the new compiler I wanted to add something that could be leveraged in the future for the other command line tools - there are eight already I think.

But the default command line options of AGS engine itself requires a lot more flexibility, there were things that I did not know how to modularize away at the time.

PS: there wasn't any rational towards being modern at the time, it was based on looking other small command line libraries that existed.

Monsieur OUXX

Quote from: eri0o on Sun 07/08/2022 17:45:04
But the default command line options of AGS engine itself requires a lot more flexibility
I simply has options that take more than one argument, I've added 2, 3 and 4 arguments to your mini library.
 

Crimson Wizard

#4
Quote from: Monsieur OUXX on Mon 08/08/2022 08:42:51
I simply has options that take more than one argument, I've added 2, 3 and 4 arguments to your mini library.

Speaking of which; I did not research the code thoroughly yet, so cannot tell why was this necessary, but these 2,3,4 argument sets caught my eye. I wish there were a different implementation, that would not require to have N different sets depending on how many command arguments we need to support.

Monsieur OUXX

Quote from: Crimson Wizard on Mon 08/08/2022 08:47:29
Speaking of which;  these 2,3,4 argument sets caught my eye.
Me too; it does not satisfy the dev in me; but right now I'm trying to get rid of the "old" implementation (greedy parser). That, and the fact that the discovered options were applied on the spot using global variables.

When everything works I can factor together the code for 2, 3, 4 params; this was a quick copy-paste fix after realizing that the feature was missing from the new CmdLineOpts

 

Monsieur OUXX

 

SMF spam blocked by CleanTalk