Closed believeinlain closed 1 year ago
Looks great!
One thing I'm considering is whether the system header parameter might instead be better served by splitting it up into multiple function calls. But I'll have you decide since I don't use C codegen :).
Ah, I didn't think of that! I think it would improve readability to have include_header
and include_system_header
rather than passing a boolean. I'll rework it.
Are things going OK? Would you like me to merge as-is?
Sorry, I kinda got caught up in other stuff. I split include
into include
and include_header
and updated the related docs and tests. It should be good to merge now.
Ah, good catch. I've removed the with-package
config option as it's not relevant to C.
Thank you!
PR that adds rudimentary support for C includes. Since C doesn't have a concept of "modules" we simply import items (which could be a function or variable) from files specified by path, with a boolean to distinguish system headers (such as
#include <stdio.h>
) from local headers (such as#include "foo/bar.h"
).Note that it considers
<stdio.h>
and"stdio.h"
to be different include files. We can let the C compiler sort out correctness - naming local headers with the same names as system headers that one is also using is incredibly bad practice.Added working example and doc test.
Addresses Issue #22