Configuring Meta-Programming

Mark S <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <[email protected]>
Hello,

I'm looking for advice on how to configure code generated at compile 
time.  My current solution reads the configuration values from a file, 
but the feedback I received indicates that requiring users to create and 
maintain a config file, in order to use this library, will at the very 
least, severely limit its usefulness.

Is there another way to introduce configuration values at compile time?  
Is there a library you can point me to, that has resolved the same issue 
differently?

Specifically, I created code that generates a module, containing a 
custom Cyclic Redundancy Check (CRC) calculation function that utilizes 
a CRC look-up table.  Creating the function and the look-up table 
requires specifying the bit width, polynomial, initial value, final XOR 
value, and whether the input and output values are reflected or not.

To generate the code module, I used Ulf Wiger's parse_trans library. In 
particular, ct_expand:term() to generate the look-up table, and 
codegen:gen_module() to generate the code and finally calling 
merl:compile() to compile the abstract syntax tree, generated by 
gen_module().

Thanks,

Mark Sebald
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.