dangmoody / HLML

Auto-generated maths library for C and C++ based on HLSL/Cg
24 stars 1 forks source link

Major generator refactor needed #49

Closed dangmoody closed 2 years ago

dangmoody commented 3 years ago

The codebase has become a mess over time due to me not being able to see just what the code for the generator would look in it's current state. There's a lot more code than there probably needs to be. No semantic compression happening, etc.

It would be good to refactor the entire generator so that all the code for generating the C files is in one file, all the code for generating the C++ files in another, etc. I think that would be much neater than what we have now.

Then main could just be something like the following:

int main( int argc, char** argv ) {
    // some other pre-existing setup that's probably the same as before...

    Gen_CodeC( ... );
    Gen_CodeCPP( ... );

    // any other shutdown stuff that was here from before

    return EXIT_SUCCESS;
}

I've been trying to treat C and C++ as the same thing with some minor differences, but I think it could much more beneficial to just treat them as two separate languages, and then any similarities can be compressed into helper functions as needed.

If I'm right, this will significantly reduce the amount of code that exists in the generator atm, the codebase would be easier to navigate, and it would be easier to read.

I could be wrong about this, and it could actually be worse but this would be worth for me setting some time aside one day to look at.

Either way, the current state of the generator codebase is a mess and could definitely be done a lot better than how it is now.

dangmoody commented 2 years ago

I'm investigating this now. There probably won't be many other updates for a while because of how much work is involved with this, but the latest release is fine and perfectly usable for people. If people do need any updates/bug fixes being done to the master repo it might be a hot minute before they make it out to the next release.

Bear with me!

dangmoody commented 2 years ago

So this is nearly done. The update will be going live very soon. I'll close this when v2.0.0 goes live.

dangmoody commented 2 years ago

Done! #50