#!/usr/local/bin/perl print "SIGS <- ["; foreach (@ARGV){ print ",\n\n" if $ok++; ($a = $_) =~ s/\.cam//; print "\"$a\" -> LibInfo({", get_includes($_),"},[",get_func($_),"])"; } print "],\n"; sub get_includes{ my $a=shift; my $r=""; for(`grep '^#include' $_`){ chop; s/.include\s*//; s/\.cam//; $r.= "\"$_\""; } $r =~ s/""/","/g; $r; } sub get_func{ my $a=shift; my $r=""; for(`grep '^FUNC' $_`){ if(/FUNC\s+(\w+)\s*\((.*?)\)\s*:\s*(.*)/) { $r .= "\n\t\t\"$1\" -> OperSig(<".tt($2).">,\"$3\"),";} } chop($r); $r; } sub tt{ my $a=shift; $a=~s/\w+\s*://g; $a=~s/,/","/g; '"'.$a.'"';}