2001-07-27 17:25:41 +00:00
|
|
|
#!/usr/bin/perl
|
2001-07-22 05:55:40 +00:00
|
|
|
#
|
2014-02-20 23:46:35 +00:00
|
|
|
# Copyright (C) 2004, 2007, 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
|
2012-06-29 11:39:47 +10:00
|
|
|
# Copyright (C) 2001 Internet Software Consortium.
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
|
|
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
|
|
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
|
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
|
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
|
|
|
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
|
|
# PERFORMANCE OF THIS SOFTWARE.
|
2001-07-31 00:03:21 +00:00
|
|
|
|
2012-03-07 01:41:11 +00:00
|
|
|
# $Id$
|
2001-07-27 17:25:41 +00:00
|
|
|
|
2001-07-20 05:10:29 +00:00
|
|
|
# makedefs.pl
|
2001-07-27 05:20:29 +00:00
|
|
|
# This script goes through all of the lib header files and creates a .def file
|
|
|
|
# for each DLL for Win32. It recurses as necessary through the subdirectories
|
2001-07-20 05:10:29 +00:00
|
|
|
#
|
2001-07-22 05:55:40 +00:00
|
|
|
# This program should only be run if it is necessary to regenerate
|
|
|
|
# the .def files. Normally these files should be updated by hand, adding
|
|
|
|
# new functions to the end and removing obsolete ones.
|
2009-01-17 11:41:17 +00:00
|
|
|
# If you do regenerate them you will also need to modify them by hand to
|
2001-07-22 05:55:40 +00:00
|
|
|
# to pick up those routines not detected by this program (like openlog).
|
2001-07-20 05:10:29 +00:00
|
|
|
#
|
|
|
|
# Search String: ^(([_a-z0-9])*( ))*prefix_[_a-z0-9]+_[a-z0-9]+( )*\(
|
|
|
|
# List of directories
|
2001-07-27 17:25:41 +00:00
|
|
|
|
2014-02-20 10:11:06 -08:00
|
|
|
@prefixlist = ("isc", "isccfg", "dns", "isccc", "bind9", "lwres", "irs");
|
|
|
|
@iscdirlist = ("isc/include/isc","isc/win32/include/isc","isc/include/pk11",
|
|
|
|
"isc/include/pkcs11","isc/win32/include/pkcs11");
|
|
|
|
@iscprefixlist = ("isc", "pk11", "pkcs");
|
2001-07-20 05:10:29 +00:00
|
|
|
|
|
|
|
@isccfgdirlist = ("isccfg/include/isccfg");
|
|
|
|
@isccfgprefixlist = ("cfg");
|
|
|
|
|
|
|
|
@iscccdirlist = ("isccc/include/isccc");
|
|
|
|
@iscccprefixlist = ("isccc");
|
|
|
|
|
2014-02-20 10:11:06 -08:00
|
|
|
@dnsdirlist = ("dns/include/dns","dns/include/dst");
|
2001-07-20 05:10:29 +00:00
|
|
|
@dnsprefixlist = ("dns", "dst");
|
|
|
|
|
2014-02-20 10:11:06 -08:00
|
|
|
@lwresdirlist = ("lwres/include/lwres","lwres/win32/include/lwres");
|
2001-07-20 05:10:29 +00:00
|
|
|
@lwresprefixlist = ("lwres");
|
|
|
|
|
2014-02-20 10:11:06 -08:00
|
|
|
@bind9dirlist = ("bind9/include/bind9");
|
|
|
|
@bind9prefixlist = ("bind9");
|
|
|
|
|
|
|
|
@irsdirlist = ("irs/include/irs","irs/win32/include/irs");
|
|
|
|
@irsprefixlist = ("irs");
|
|
|
|
|
2001-07-20 05:10:29 +00:00
|
|
|
# Run the changes for each directory in the directory list
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($iscprefixlist[0]);
|
|
|
|
foreach $dir (@iscdirlist) {
|
2001-07-22 05:55:40 +00:00
|
|
|
createdeffile($dir, $iscprefixlist[$ind]);
|
|
|
|
$ind++;
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($isccfgprefixlist[0]);
|
|
|
|
foreach $dir (@isccfgdirlist) {
|
2001-07-22 05:55:40 +00:00
|
|
|
createdeffile($dir, $isccfgprefixlist[$ind]);
|
|
|
|
$ind++;
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($dnsprefixlist[0]);
|
|
|
|
foreach $dir (@dnsdirlist) {
|
2001-07-22 05:55:40 +00:00
|
|
|
createdeffile($dir, $dnsprefixlist[$ind]);
|
|
|
|
$ind++;
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($iscccprefixlist[0]);
|
|
|
|
foreach $dir (@iscccdirlist) {
|
2001-07-22 05:55:40 +00:00
|
|
|
createdeffile($dir, $iscccprefixlist[$ind]);
|
|
|
|
$ind++;
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($lwresprefixlist[0]);
|
|
|
|
foreach $dir (@lwresdirlist) {
|
2001-07-22 05:55:40 +00:00
|
|
|
createdeffile($dir, $lwresprefixlist[$ind]);
|
|
|
|
$ind++;
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
2014-02-20 10:11:06 -08:00
|
|
|
$ind = 0;
|
|
|
|
createoutfile($bind9prefixlist[0]);
|
|
|
|
foreach $dir (@bind9dirlist) {
|
|
|
|
createdeffile($dir, $bind9prefixlist[$ind]);
|
|
|
|
$ind++;
|
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
|
|
|
$ind = 0;
|
|
|
|
createoutfile($irsprefixlist[0]);
|
|
|
|
foreach $dir (@irsdirlist) {
|
|
|
|
createdeffile($dir, $irsprefixlist[$ind]);
|
|
|
|
$ind++;
|
|
|
|
}
|
|
|
|
close OUTDEFFILE;
|
|
|
|
|
2001-07-22 05:55:40 +00:00
|
|
|
exit;
|
2001-07-27 17:25:41 +00:00
|
|
|
|
2001-07-22 05:55:40 +00:00
|
|
|
#
|
|
|
|
# Subroutines
|
|
|
|
#
|
2001-07-20 05:10:29 +00:00
|
|
|
sub createdeffile {
|
2001-07-27 17:25:41 +00:00
|
|
|
$xdir = $_[0];
|
|
|
|
|
|
|
|
#
|
|
|
|
# Get the List of files in the directory to be processed.
|
|
|
|
#
|
|
|
|
#^(([_a-z0-9])*( ))*prefix_[_a-z]+_[a-z]+( )*\(
|
|
|
|
$prefix = $_[1];
|
|
|
|
$pattern = "\^\(\(\[\_a\-z0\-9\]\)\*\( \)\)\*\(\\*\( \)\+\)\*$prefix";
|
|
|
|
$pattern = "$pattern\_\[\_a\-z0\-9\]\+_\[a\-z0\-9\]\+\( \)\*\\\(";
|
|
|
|
|
|
|
|
opendir(DIR,$xdir) || die "No Directory: $!";
|
|
|
|
@files = grep(/\.h$/i, readdir(DIR));
|
|
|
|
closedir(DIR);
|
|
|
|
|
|
|
|
foreach $filename (sort @files) {
|
|
|
|
#
|
|
|
|
# Open the file and locate the pattern.
|
|
|
|
#
|
|
|
|
open (HFILE, "$xdir/$filename") ||
|
|
|
|
die "Can't open file $filename : $!";
|
|
|
|
|
|
|
|
while (<HFILE>) {
|
|
|
|
if(/$pattern/) {
|
|
|
|
$func = $&;
|
|
|
|
chop($func);
|
|
|
|
$space = rindex($func, " ") + 1;
|
|
|
|
if($space >= 0) {
|
|
|
|
# strip out return values
|
|
|
|
$func = substr($func, $space, 100);
|
|
|
|
}
|
|
|
|
print OUTDEFFILE "$func\n";
|
2001-07-22 05:55:40 +00:00
|
|
|
}
|
|
|
|
}
|
2001-07-27 17:25:41 +00:00
|
|
|
# Set up the Patterns
|
|
|
|
close(HFILE);
|
|
|
|
}
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# This is the routine that applies the changes
|
|
|
|
|
|
|
|
# output the result to the platform specific directory.
|
|
|
|
sub createoutfile {
|
2001-07-27 17:25:41 +00:00
|
|
|
$outfile = "lib$_[0].def";
|
|
|
|
|
|
|
|
open (OUTDEFFILE, ">$outfile")
|
|
|
|
|| die "Can't open output file $outfile: $!";
|
|
|
|
print OUTDEFFILE "LIBRARY lib$_[0]\n";
|
|
|
|
print OUTDEFFILE "\n";
|
|
|
|
print OUTDEFFILE "; Exported Functions\n";
|
|
|
|
print OUTDEFFILE "EXPORTS\n";
|
|
|
|
print OUTDEFFILE "\n";
|
2001-07-20 05:10:29 +00:00
|
|
|
}
|