Closed RavenNevermore closed 9 years ago
Maybe we don't even need public
? What about simply exporting everything?
More formally:
Generally, the comfy source file will be copied to both, the header and the c source file, before it is processed through different modifiers.
These do in the c file:
##
And in the header file:
#
Any preprocessor directive is by default kept in the source file and not exported to the header, in order to prevent cluttering the namespace.
If a preprocessor directive should be exported to the header, one should prepend it with another #
.
#include "will_not_be_in_header.h"
##include "wil_be_in_header.h"
Implemented, via Line masking.
But there need to be a bit more features, to make that actually dry and usable.
Basically, the header generation works of of the notion, that any header line is starting with §
, while a c-source line doesn't.
Now we can write features, that modify the .comfy
source and add or remove masks to lines, to make this even more usefull.
Admit it, you hate them.
More than that, Header files in C basically force you, to repeat yourself with anything, you want to be accessable from somewhere else. Thatway preventing you from writing beautiful and dry code.
With Comfy you don't need to worry about them anymore. In any
.comfy
file, you can simply declare members as public like so.Comfy will parse your file for any public identifiers and if it finds at least one, it will automatically generate a header file, copying the directive as a definition and also taking any documentation comments attached to the identifier.
It will also gate your definitions within a namespace.
So, assuming the above example is in a file called
foobar.comfy
, it would be generated as: