Ive written a module which implements Eric Raymonds 'shred' program, which is pretty well described here.
http://www.arstechnica.com/archive/news/1063140308.html
File::Shred is my working name
My version has a different focus, namely to find duplicate code chunks, write macros for them, and invoke those macros. So maybe a different name is appropriate.
File::Macrofy File::Macroize::C
a Perl version would create a string-eval equivalent:
my $MACRO_NNN = q{ .... }
eval $MACRO_NNN;given its basis in MD5, it cannot find even trivial differences in 2 chunks,
FWIW - Ive applied it to bleadperl source code, and am getting what look like reasonable
results, though I havent tried compiling yet. (I will b4 the .01 release)
Ok, I did, it breaks, have to avoid chunks with unbalanced #ifdefs..
anyway,
[EMAIL PROTECTED] bleadperl]$ ls *.c.new |wc
35 35 415
[EMAIL PROTECTED] bleadperl]$ more *.c.macros |wc
2987 9814 68087
[EMAIL PROTECTED] bleadperl]$ grep MACRO *.c.macros |wc
282 1128 14004
[EMAIL PROTECTED] bleadperl]$ grep MACRO *.c.new |wc
428 856 15234