cgen
cgen copied to clipboard
Add default args to Define and make elselines optional in IfNdef/Ifdef
Some quality of life improvements. This allows you to write a common include guard pattern such as:
test = c.IfNDef('__HEADER__',
[
c.Define('__HEADER__'),
c.Comment("Header content")
])
print(test)
Which results in:
#ifndef __HEADER__
#define __HEADER__
/* Header content */
#endif
Also added some test for the new ifndef/ifdef functionality.
@inducer let me know what you think of this! :smile: