[ccan] Stlgen perl module generates C code linked list

Rusty Russell rusty at rustcorp.com.au
Tue Jun 15 20:10:01 EST 2010


On Wed, 9 Jun 2010 11:19:35 pm Greg London wrote:
> I've written a perl module that generates C code.
> The idea was to try to create a front end to a perl
> module that would allow developers to create
> templates of C code and allows users to instantiate
> different "classes" of those templates with different
> types.
> 
> The first template I created is a linked list template.
> 
> I tried to follow the naming convention of the C++
> Standard Template Library for the linked list container.
> 
> Users can then take this module and write a short
> perl script which lists what types of data are to
> be stored in the linked list. The module then
> generates C code for the types requested.
> 
> The perl module is available for download here:
> 
> http://search.cpan.org/~gslondon/Stlgen-0.012/
> 
> It's called "Stlgen" after the Standard Template
> Library for C++, except it "gen"erates C code.
> 
> It is an alpha version of code, so things are
> subject to change.
> 
> But since it isn't just plain C code, I can't really
> upload it to CCAN. I wasn't sure how exactly to
> handle it.
> 
> The module itself is separate from the template,
> so other designers could add other templates.
> For example, a template for a hash could be added,
> and the Stlgen.pm module would provide a common
> interface for users to instantiate their own code.
> 
> Feedback welcome.

Hi Greg,

   This is an excellent question.  I wish I had an excellent answer :(

It doesn't really work as a module as such, so it doesn't fit in the ccan
architecture.  It could be rewritten in C, but that's just silly.  It can
certainly sit in junkcode (where anything can live!) but that's unnecessarily
derogatory.

I think CPAN is the right place...
Rusty.


More information about the ccan mailing list