3 # Copyright (C) 2004, 2007, 2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
21 # This script goes through all of the lib header files and creates a .def file
22 # for each DLL for Win32. It recurses as necessary through the subdirectories
24 # This program should only be run if it is necessary to regenerate
25 # the .def files. Normally these files should be updated by hand, adding
26 # new functions to the end and removing obsolete ones.
27 # If you do regenerate them you will also need to modify them by hand to
28 # to pick up those routines not detected by this program (like openlog).
30 # Search String: ^(([_a-z0-9])*( ))*prefix_[_a-z0-9]+_[a-z0-9]+( )*\(
33 @prefixlist = ("isc", "isccfg", "dns", "isccc", "bind9", "lwres", "irs");
34 @iscdirlist = ("isc/include/isc","isc/win32/include/isc","isc/include/pk11",
35 "isc/include/pkcs11","isc/win32/include/pkcs11");
36 @iscprefixlist = ("isc", "pk11", "pkcs");
38 @isccfgdirlist = ("isccfg/include/isccfg");
39 @isccfgprefixlist = ("cfg");
41 @iscccdirlist = ("isccc/include/isccc");
42 @iscccprefixlist = ("isccc");
44 @dnsdirlist = ("dns/include/dns","dns/include/dst");
45 @dnsprefixlist = ("dns", "dst");
47 @lwresdirlist = ("lwres/include/lwres","lwres/win32/include/lwres");
48 @lwresprefixlist = ("lwres");
50 @bind9dirlist = ("bind9/include/bind9");
51 @bind9prefixlist = ("bind9");
53 @irsdirlist = ("irs/include/irs","irs/win32/include/irs");
54 @irsprefixlist = ("irs");
56 # Run the changes for each directory in the directory list
59 createoutfile
($iscprefixlist[0]);
60 foreach $dir (@iscdirlist) {
61 createdeffile
($dir, $iscprefixlist[$ind]);
67 createoutfile
($isccfgprefixlist[0]);
68 foreach $dir (@isccfgdirlist) {
69 createdeffile
($dir, $isccfgprefixlist[$ind]);
75 createoutfile
($dnsprefixlist[0]);
76 foreach $dir (@dnsdirlist) {
77 createdeffile
($dir, $dnsprefixlist[$ind]);
83 createoutfile
($iscccprefixlist[0]);
84 foreach $dir (@iscccdirlist) {
85 createdeffile
($dir, $iscccprefixlist[$ind]);
91 createoutfile
($lwresprefixlist[0]);
92 foreach $dir (@lwresdirlist) {
93 createdeffile
($dir, $lwresprefixlist[$ind]);
99 createoutfile
($bind9prefixlist[0]);
100 foreach $dir (@bind9dirlist) {
101 createdeffile
($dir, $bind9prefixlist[$ind]);
107 createoutfile
($irsprefixlist[0]);
108 foreach $dir (@irsdirlist) {
109 createdeffile
($dir, $irsprefixlist[$ind]);
123 # Get the List of files in the directory to be processed.
125 #^(([_a-z0-9])*( ))*prefix_[_a-z]+_[a-z]+( )*\(
127 $pattern = "\^\(\(\[\_a\-z0\-9\]\)\*\( \)\)\*\(\\*\( \)\+\)\*$prefix";
128 $pattern = "$pattern\_\[\_a\-z0\-9\]\+_\[a\-z0\-9\]\+\( \)\*\\\(";
130 opendir(DIR
,$xdir) || die "No Directory: $!";
131 @files = grep(/\.h$/i, readdir(DIR
));
134 foreach $filename (sort @files) {
136 # Open the file and locate the pattern.
138 open (HFILE
, "$xdir/$filename") ||
139 die "Can't open file $filename : $!";
145 $space = rindex($func, " ") + 1;
147 # strip out return values
148 $func = substr($func, $space, 100);
150 print OUTDEFFILE
"$func\n";
153 # Set up the Patterns
158 # This is the routine that applies the changes
160 # output the result to the platform specific directory.
162 $outfile = "lib$_[0].def";
164 open (OUTDEFFILE
, ">$outfile")
165 || die "Can't open output file $outfile: $!";
166 print OUTDEFFILE
"LIBRARY lib$_[0]\n";
167 print OUTDEFFILE
"\n";
168 print OUTDEFFILE
"; Exported Functions\n";
169 print OUTDEFFILE
"EXPORTS\n";
170 print OUTDEFFILE
"\n";