2 # Copyright 1999, 2000, 2001 Patrik Stridvall
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 use setup
qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
25 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
30 &file_absolutize &file_normalize
32 &file_type &files_filter
33 &file_skip &files_skip
34 &get_api_files &get_c_files &get_h_files &get_spec_files
37 $current_dir $wine_dir $winapi_dir $winapi_check_dir
40 use vars qw($current_dir $wine_dir $winapi_dir $winapi_check_dir);
42 use output qw($output);
49 $_ = file_absolutize($_);
51 m%^(?:libtest|rc|server|tests|tools)/% && return "";
52 m%^(?:programs|debugger|miscemu)/% && return "wineapp";
53 m%^(?:library|tsx11|unicode)/% && return "library";
54 m%^windows/x11drv/wineclipsrv\.c$% && return "application";
63 foreach my $file (@_) {
64 if(file_type($file) eq $type) {
75 $_ = file_absolutize($_);
77 m%^(?:libtest|programs|rc|server|tests|tools)/% && return 1;
78 m%^(?:debugger|miscemu|tsx11|server|unicode)/% && return 1;
79 m%^dlls/wineps/data/% && return 1;
80 m%^windows/x11drv/wineclipsrv\.c$% && return 1;
81 m%^dlls/winmm/wineoss/midipatch\.c$% && return 1;
82 m%(?:glue|spec)\.c$% && return 1;
89 foreach my $file (@_) {
90 if(!file_skip($file)) {
101 $_ = file_normalize($_);
102 if(!s%^$wine_dir/%%) {
103 $_ = "$current_dir/$_";
113 foreach my $dir (split(m%/%, $current_dir)) {
114 if(s%^(\.\./)*\.\./$dir/%%) {
121 while(m%^(.*?)([^/\.]+)/\.\./(.*?)$%) {
122 if($2 ne "." && $2 ne "..") {
138 s%^(?:\./)?(.*?)(?:/\.)?%$1%;
144 my $extension = shift;
148 $output->progress("$wine_dir: searching for *.$extension");
157 while(defined(my $dir = shift @dirs)) {
159 my @entries= readdir(DIR);
167 } elsif(/\.$extension$/ && (!defined($type) || file_type($_) eq $type)) {
179 return _get_files("api", undef, "$winapi_check_dir/$name");
181 sub get_c_files { return _get_files("c", @_); }
182 sub get_h_files { return _get_files("h", @_); }
183 sub get_spec_files { return _get_files("spec", @_); }