On Mon, Jan 14, 2002 at 10:55:52PM -0500, Aaron D. Marasco wrote:
> >#! perl # run with perl -x
> >open 0;while(<0>){last if/^#/;s|\s*--\s+(.*):|--== $1 ==--|||
> >s&\s*--\s*(\w+)\s+(\w+)\s+(\d*)\s*&"$1: $2 std_logic".
> >($3?"_vector($3 downto 0)":'').";\n"&e&&$l>length$1or$l=length$1;
> >$\.=$_}END{$_='';$\=~s/(.*):/$1.' 'x($l-length$1).' :'/ge;print}
>
> Well, it doesn't take into account that the -- can be optional, but I'll
> live... I will play with the -x option tomorrow at work....
It can be optional? Then:
-- SUN:
-- S_RSTb out
-- S_INTb in
-- CMX INTERFACE:
-- CMX_D inout 7
-- CMX_CSb in
-- CMX_A inout 7
#! perl # run with perl -x
open 0;while(<0>){last if/^#/;s|[-\s]+(.*):|--== $1 ==--|||
s&[-\s]+(\w+)\s+(\w+)\s+(\d*)\s*&"$1: $2 std_logic".
($3?"_vector($3 downto 0)":'').";\n"&e&&$l>length$1or$l=length$1;
$\.=$_}END{$_='';$\=~s/[^:\n]+/sprintf"%-${l}s ",$&/gem;print}
> Now to try to decrypt it... what is the "random" e in the middle doing
> (where it is &e&&)? I see that golf trick of screwing with $\...
The first & is part of the s&&& started at the beginning of the
previous line, the last two are an 'and'.
> Thanks for the tidbits... as usual, my ideas get "spanked." So do you
> rotate thru s/// characters randomly? :)
Nah. I just choose, as a general rule, the path of most evil. :)
Joy,
`/anick
--
$_ = 'Oxsgnm0qtkdr0nudq0C`fna`g+0ats0nm0S`snhmd0sgd0B`ldk0hr'
..'0jhmf-';s,(.),!$1?' ':chr(ord($1)+1),eg;print;