On Wed, May 04, 2011 at 10:40:22AM -0700, Jeff Johnson wrote:
> It sounds o.k. to me, but my perl knowledge is not that great. Is
> there a volunteer to start the perl script? If someone can read the
> enum.h file into data structures, I can output the correct stuff.
> If not, I can muddle through it. :)
Is this good enough?
=====================================================================
#!/usr/bin/perl -w
use Cwd;
my $src = Cwd::realpath(__FILE__ . "/../../enum.h");
-r $src or die "Can't find enum.h\n";
open IN, "cpp \"$src\"|" or die "Can't run cpp\n";
{ undef local $/; $_ = <IN>; }
/enum monster_type\s*{\s*((?:\w+\s*(?:\s*=\s*\w+)?,\s*)+)}/
or die "Can't find enum monster_type in enum.h\n";
print "$_ => \"\L$_\"\n" for ($1 =~ /(\w+)\s*(?:\s*=\s*\w+)?,/g)
=====================================================================
--
1KB // Microsoft corollary to Hanlon's razor:
// Never attribute to stupidity what can be
// adequately explained by malice.
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Crawl-ref-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crawl-ref-discuss