ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolDoc.pm
(Generate patch)

Comparing COMP/SCRAM/src/BuildSystem/ToolDoc.pm (file contents):
Revision 1.1.2.10 by williamc, Fri May 5 14:18:45 2000 UTC vs.
Revision 1.1.2.14 by williamc, Thu Jun 22 08:41:52 2000 UTC

# Line 11 | Line 11
11   # ---------
12   # new()         : A new ToolDoc object
13   # tool(toolobj) : set the tool object for the class
14 + # toolsearcher(searcher) : set the searcher for finding reference tools
15   # setup(file,$name,$version) : setup a tool object from the specified file
16   #                               return 0 for OK 1 for cancel
17   # interactive([0|1]) : set the interactive node 0=off 1=on
# Line 18 | Line 19
19   package BuildSystem::ToolDoc;
20   require 5.004;
21   use ActiveDoc::SimpleDoc;
22 + use Utilities::Verbose;
23 + @ISA=qw(Utilities::Verbose);
24  
25   sub new {
26          my $class=shift;
# Line 69 | Line 72 | sub tool {
72          $self->{tool}=shift;
73   }
74  
75 + sub toolsearcher {
76 +        my $self=shift;
77 +        if ( @_ ) {
78 +          my $searcher=shift;
79 +          if ( ! defined $searcher ) {
80 +             $self->error("Undefined Value passed as a Searcher".
81 +                " in ToolDoc::toolsearcher");
82 +          }
83 +          $self->{toolboxsearcher}=$searcher;
84 +        }
85 +        return $self->{toolboxsearcher};
86 + }
87 +
88   sub setup {
89          my $self=shift;
90          my $file=shift;
# Line 206 | Line 222 | sub _askuser {
222  
223   }
224  
225 + #
226 + # Propgate through the searcher collecting matching tools
227 + #
228 + sub _searchtools {
229 +        my $self=shift;
230 +        my $tool=shift;
231 +
232 +        my @tools=();
233 +        my $area;
234 +        my $rtool;
235 +        if ( defined $self->{toolboxsearcher} ) {
236 +           my $it=$self->{toolboxsearcher}->newiterator();
237 +           while ( ! $it->last()  ) {
238 +             $area=$it->next();
239 +             if ( defined $area ) {
240 +              $self->verbose("Searching for ".$tool->name()." ".
241 +                 $tool->version()." in ".$area->location());
242 +              $rtool=$area->toolbox()->gettool($tool->name(),$tool->version());
243 +              if ( (defined $rtool) && $rtool->equals($tool) ) {
244 +                push @tools,$rtool;
245 +              }
246 +             }
247 +           }
248 +        }
249 +        return @tools;
250 + }
251 +
252 + # search toolboxes for a nice list
253 + #
254 + sub _toolparamcopy {
255 +        my $self=shift;
256 +        my $tool=shift;
257 +        my $param=shift;
258 +
259 +        my $rv=0;
260 +        my @params=();
261 +        $self->verbose("Check Other Projects for tool");
262 +        my @validtools=$self->_searchtools($tool);
263 +        if ( ! $self->interactive() ) {
264 +          if ( $#validtools >=0 ) {
265 +           @params=$validtools[0]->getfeature($param);
266 +           if ( $#params >=0 ) {
267 +                $self->verbose("Extracting Feature $param from tool".
268 +                        " (= @params )\n");
269 +                #$tool->setfeature($param,@params);
270 +                $rv=1;
271 +           }
272 +          }
273 +        }
274 +        return ($rv,@params);
275 + }
276 +
277   # -- Tag Routines
278  
279   sub Client_start {
# Line 281 | Line 349 | sub Environment_Start {
349              $self->{Envvalue}=$$hashref{'value'};
350            }
351            elsif ( ! $self->interactive() ) {
352 <           # check the environment
353 <           if ( defined $ENV{$$hashref{'name'}} ) {
354 <            $self->{Envvalue}=$ENV{$$hashref{'name'}};
352 >           # check other installed copies of the tool
353 >           my ($rv,@params)=
354 >                $self->_toolparamcopy($self->{tool},$$hashref{'name'});
355 >           if ( $rv && ($#params == 0)) { #dont use multivalued params!
356 >              $self->{Envvalue}=$params[0]; # single val parameter
357 >           }
358 >           elsif ( defined $ENV{$$hashref{'name'}} ) {
359 >              # check the environment
360 >              $self->{Envvalue}=$ENV{$$hashref{'name'}};
361             }
362             elsif ( $self->_checkdefault($hashref) ) {
363 <            $self->{Envvalue}=$$hashref{'default'};
363 >              $self->{Envvalue}=$$hashref{'default'};
364             }
365            }
366          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines