skyfox69 / niflib_gen

Generate niflib sources using new C++ features
1 stars 0 forks source link

nifxml 0.9, niflib structural changes #1

Open hexabits opened 6 years ago

hexabits commented 6 years ago

Hi skyfox,

Nice to see you active.

Didn't really know how else to contact you about this but we noticed you created this repo. We currently already have someone working on prospective niflib rewrites and obviously that requires generation changes. This generator would also need to be updated to even work with nif.xml 0.9, which we're just days away from merging: https://github.com/niftools/nifxml/pull/65

You can see some of the changes conceptually at my nifdocsys repo: https://github.com/jonwd7/nifdocsys/commits/master

It'd be nice to actually discuss this stuff with you so that there's not all this parallel, conflicting work on niflib, and at the very least you could be around to ask about XML format changes that require generator changes. We have a Discord and a development channel which you can get to through https://discord.gg/ZFjdN4x or the NifTools.org mainpage.

We'd especially like to know if you have any plans on doing any work on niflib itself, as there are a lot of big changes there to discuss. I'm mainly pushing for the complete separation of the generated and custom code blocks, using either PIMPL or inheritance. The generated code would then actually be removed from the repo and we'd no longer have commits where you cannot tell if the diff is from code regeneration or custom code changes.

As an example, for a stub file for BSTriShape, the include would be

#include <BSTriShape>

And the stub file contents could be either filled out with the generator based on file existence, or done using C++17. (Filenames are just examples for clarification and would be in different folders)

C++17 method:

#include "BSTriShape.gen.h"

#if __has_include("BSTriShape.custom.h")
#  include "BSTriShape.custom.h"
#else
using BSTriShape = BSTriShapeGenerated;
#endif

Generation method:

// If BSTriShape.custom.h does not exist
#include "BSTriShape.gen.h"
using BSTriShape = BSTriShapeGenerated;
// Else
#include "BSTriShape.gen.h"
#include "BSTriShape.custom.h"

And then of course there are other approaches like the PIMPL method, the benefit being hiding the BSTriShapeGenerated class.

Anyway, it's this kind of stuff and the XML changes that we'd like to talk with you about on Discord. :)

skyfox69 commented 6 years ago

Hi jonwd, many thanks for contacting me. Nice to read you again. Had a brief look around and didn't see anyone working on a niflib generator renewal. After coding in PHP and ruby a long time I wanted to do something in C++ again - a real language ;)

Please give me some time to read through your annotations before leaving some comments or join you on Discord. Sounds very interesting!

BTW: I can just read Python, but I'm far away from programming in Python ;)