in reply to Introducing the C Perl-Powered Pre-Processor

I'd like to see some examples of what it's actually capable of.

  • Comment on Re: Introducing the C Perl-Powered Pre-Processor

Replies are listed 'Best First'.
Re^2: Introducing the C Perl-Powered Pre-Processor
by NERDVANA (Priest) on Nov 09, 2023 at 20:29 UTC

    I do need better examples, and a "cookbook" document. The SYNOPSIS is actually fairly complete, showing how all perl code goes into ## directives, and any lines without ## are treated as a template, and how you can use perl string interpolation (with a few extensions) throughout the template. Aside from that, you can do anything with it that Perl can do! It's really just like writing a perl script with C code in here-docs, but with more convenient interpolation of perl variables, and automatic formatting so that the output looks better, and behind-the-scenes magic so that it compiles into a module instead of a one-shot script. Plus, the command line tool that more conveniently populates your parameters and directs your output into multiple files.

    My main use right now is an un-finished C library for doing red/black hash tables, which requires a lot of repetitive code compiled for different bit-widths. I also started an example of how you could implement the C equivalent of std::vector (which is in the examples directory) but it isn't finished or presentable yet.