Closed rrichardson closed 9 years ago
I've collected some of the examples from this repo into a separate project. My original plan was to replace libCello with cmacro macros, but I'm not sure that's the best way to do this.
So far the most advanced feature I have is Algebraic Data Types made with macros. Similar type system extensions could be made.
I'm not exactly sure what you're asking for in that post. Something like defining a data structure in one file, then using that definition to generate sample instances of that structure for testing?
And since we're discussing this: Are there are specific extensions you would like to see in a generic C macro library?
At its most basic, I would like a way to collect all of my cmacro definitions into a special include file. In which I could reference macros anywhere in my source. E.g.
lambda, tup, forEach would all be defined in library.cmh
Then I could use them with something like
cmc -o test.c -i library.cmh test.cmc
then turn around and re-use library.cmh in
cmc -o myapp.c -i library.cmh myapp.cmc
It might also be good to have a special @include directive or somesuch so that I could reference library.cmh from inside of any cmc file.
The macro inclusion directive is -- and I probably forgot to document this -- is cmacro_import
.
Example:
cmacro_import "macros/anaphoric.c"
Awesome! I just tested it. It works exactly as I hoped.
Great to hear that. I should be uploading the C extension library here once I have a little something extra to throw into it.
Neat. One of my major interests for cmacro is making type safe data structures, similar to how it might be done in c++ On Aug 21, 2014 6:03 PM, "Fernando Borretti" notifications@github.com wrote:
Great to hear that. I should be uploading the C extension library here once I have a little something extra to throw into it.
— Reply to this email directly or view it on GitHub https://github.com/eudoxia0/cmacro/issues/8#issuecomment-52991416.
It would be nice to collect a library of macro/helper macros to be used across different applications. Also, I'm running into cases where I want to make type safe data structures, so I would like to put the data structure bits in one data file, then produce a 2nd data file using the bits from the first. Are there any plans to do such things?