[CM] SDL is unchanged still but here's another for ImGui
Norman Gray
gray at nxg.name
Mon Jul 8 12:49:36 PDT 2024
Matthew, hello.
On 8 Jul 2024, at 18:48, chohag at jtan.com wrote:
>> Faced with a similar problem, I've used s7 to generate C before.
>> Specifically, I can point towards util-extra.c.in at [1], which
>> includes #(...) forms within the source, which expand to C, using a
>> very simple function in scheme-macro-filter.scm there.
>
> Thanks I'll take a look. I tend to lean toward CPP macros through
> familiarity but that may change as I build up a body of code, provided
> I can keep magic out of the build process.
I'm fully sympathetic with the less-magic point of view. I've written a
modest amount of CPP macro cleverness over the years, and I find my
tolerance for CPP magic has gone _down_ rather than up over the
years.[*]
As it happens, my previous version of that scheme-macro-filter.scm
program was also written in the service of creating an FFI for a
library. That is, exactly the problem of writing repetitive code which
I might want to change my mind about. I started off writing a pile of
CPP macros, and quickly confused myself. I had at the time recently
stumbled across s7, thought hmm...., and very quickly knocked together
the core of the macro-filter program.
Have fun!
Norman
[*] At one point, a while ago, I participated in the maintenance of a
library which was written in object-oriented C. This being the 90s, and
C++ still rather unstable, the original author of the library had
elected to implement the OO system entirely in CPP macros. This was
simultaneously extremely impressive, and completely paralysing, since it
meant that almost the only changes I was confident making were
cut-and-paste-and-tweak. I've had Views about the desirable features of
a macro system ever since.
--
Norman Gray : https://nxg.me.uk
More information about the Cmdist
mailing list