BerkeleyDB
view release on metacpan or search on metacpan
mkconsts.pl view on Meta::CPAN
EPOLL => '6.3.10',
# enum DB_MEM_CONFIG
DB_MEM_DATABASE => '6.3.10',
DB_MEM_DATABASE_LENGTH => '6.3.10',
DB_MEM_EXTFILE_DATABASE => '6.3.10',
DB_MEM_REP_SITE => '6.3.10',
) ;
sub enum_Macro
{
my $str = shift ;
my ($major, $minor, $patch) = split /\./, $str ;
my $macro =
"#if (DB_VERSION_MAJOR > $major) || \\\n" .
" (DB_VERSION_MAJOR == $major && DB_VERSION_MINOR > $minor) || \\\n" .
" (DB_VERSION_MAJOR == $major && DB_VERSION_MINOR == $minor && \\\n" .
" DB_VERSION_PATCH >= $patch)\n" ;
mkconsts.pl view on Meta::CPAN
foreach my $key (sort keys %constants)
{
my $val = $constants{$key} ;
next if $val eq IGNORE;
if ($val eq STRING)
{ push @names, { name => $key, type => "PV" } }
elsif ($val eq DEFINE)
{ push @names, $key }
else
{ push @names, { name => $key, macro => [enum_Macro($val), "#endif\n"] } }
}
warn "Updating constants.xs & constants.h...\n";
WriteConstants(
NAME => BerkeleyDB,
NAMES => \@names,
C_FILE => 'constants.h',
XS_FILE => 'constants.xs',
) ;
}
#!/usr/local/bin/perl5
# Filename: mkpod
#
# Author: Paul Marquess
# File types
#
# Macro files end with .M
# Tagged source files end with .T
# Output from the code ends with .O
# Pre-Pod file ends with .P
#
# Tags
#
# ## BEGIN tagname
# ...
# ## END tagname
#
# ## 0
# ## 1
#
# Constants
$TOKEN = '##' ;
$Verbose = 1 if $ARGV[0] =~ /^-v/i ;
# Macros files first
foreach $file (glob("*.M"))
{
open (F, "<$file") or die "Cannot open '$file':$!\n" ;
print " Processing Macro file $file\n" ;
while (<F>)
{
# Skip blank & comment lines
next if /^\s*$/ || /^\s*#/ ;
#
($name, $expand) = split (/\t+/, $_, 2) ;
$expand =~ s/^\s*// ;
$expand =~ s/\s*$// ;
if ($expand =~ /\[#/ )
{
}
$Macros{$name} = $expand ;
}
close F ;
}
# Suck up all the code files
foreach $file (glob("t/*.T"))
{
($newfile = $file) =~ s/\.T$// ;
open (F, "<$file") or die "Cannot open '$file':$!\n" ;
open (N, ">$newfile") or die "Cannot open '$newfile':$!\n" ;
if ( $line =~ /^\s*$TOKEN\s*(\w+)\s*$/)
{
warn "No code insert '$1' available\n"
unless $Section{$1} ;
print "Expanding section $1\n" if $Verbose ;
print POD $Section{$1} ;
}
else
{
# $line =~ s/\[#([^\]])]/$Macros{$1}/ge ;
print POD $line ;
}
}
close PPOD ;
close POD ;
}
( run in 0.529 second using v1.01-cache-2.11-cpan-49f99fa48dc )