-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
[cpp] breakup generator #11785
[cpp] breakup generator #11785
Conversation
I had the same problem with the old @hughsando Please let me know what you think! |
Yeah, thats the key thing I still haven't worked out. Is this actually more managable, or have I just spread things over multiple files! |
I am happy in principle, and what you propose seems reasonable. |
The only thing is that I seem to remember some arcane OCaml (editor?) issue with capitalized file names, but there's a good chance that this is no longer relevant. |
Don't think I ever noticed that files were all lower case before... easy enough to change. Also, is there any standard formatting? gencpp seems to be indented to 3 spaces but other files are 4. I put all these new files through ocamlformat and it idented to two spaces... |
Yeah gencpp had Australian formatting. |
I frequently find myself getting into a bit of a muddle navigating around gencpp, so here's an attempt at making it a bit more managable by splitting it into several modules.
Disclaimer, before I started bodging gencpp a few years ago I had zero ocaml knowledge, I still feel like I have no real idea of what makes good / manageable ocaml, so thoughts welcome!
Anyway, heres some explanation as to how and why I split things up.
t
,tclass
,tvar
, and a few others. No dependencies on anything else.texpr
. No dependencies.t
andtexrp
to cpp ast types. Depends on all the above.gen/
folder should mostly be obvious based on their name, they're responsible for generating C++ from the cpp ast types.CppGen
contains a bunch of functions which are used by the other modules andCppReference
is used to determine what needs to be forward declared or included. Depends on all the above.That now leaves gencpp fairly slim and just sitching a few calls to the gen module. Generating header and implementation files is now completely independent whereas before headers had to be generated after implementation files due to depending on state generated by the implementation generation code.