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.11 by williamc, Tue Jun 20 12:52:18 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 +          $self->{toolboxsearcher}=shift;
79 +        }
80 +        return $self->{toolboxsearcher};
81 + }
82 +
83   sub setup {
84          my $self=shift;
85          my $file=shift;
# Line 206 | Line 217 | sub _askuser {
217  
218   }
219  
220 + #
221 + # Propgate through the searcher collecting matching tools
222 + #
223 + sub _searchtools {
224 +        my $self=shift;
225 +        my $tool=shift;
226 +
227 +        my @tools=();
228 +        my $area;
229 +        my $rtool;
230 +        if ( defined $self->{toolboxsearcher} ) {
231 +           my $it=$self->{toolboxsearcher}->newiterator();
232 +           while ( ! $it->last()  ) {
233 +             $area=$it->next();
234 +             if ( defined $area ) {
235 +              $self->verbose("Searching for ".$tool->name()." ".
236 +                 $tool->version()." in ".$area->location());
237 +              $rtool=$area->toolbox()->gettool($tool->name(),$tool->version());
238 +              if ( (defined $rtool) && $rtool->equals($tool) ) {
239 +                push @tools,$rtool;
240 +              }
241 +             }
242 +           }
243 +        }
244 +        return @tools;
245 + }
246 +
247 + # search toolboxes for a nice list
248 + #
249 + sub _toolparamcopy {
250 +        my $self=shift;
251 +        my $tool=shift;
252 +        my $param=shift;
253 +
254 +        my $rv=0;
255 +        $self->verbose("Check Other Projects for tool");
256 +        my @validtools=$self->_searchtools($tool);
257 +        if ( ! $self->interactive() ) {
258 +          if ( $#validtools >=0 ) {
259 +           my @params=$validtools[0]->getfeature($param);
260 +           if ( $#params >=0 ) {
261 +                $self->verbose("Extracting Feature $param from tool".
262 +                        " (= @params )\n");
263 +                $tool->setfeature($param,@params);
264 +                $rv=1;
265 +           }
266 +          }
267 +        }
268 +        return $rv;
269 + }
270 +
271   # -- Tag Routines
272  
273   sub Client_start {
# Line 281 | Line 343 | sub Environment_Start {
343              $self->{Envvalue}=$$hashref{'value'};
344            }
345            elsif ( ! $self->interactive() ) {
346 <           # check the environment
347 <           if ( defined $ENV{$$hashref{'name'}} ) {
348 <            $self->{Envvalue}=$ENV{$$hashref{'name'}};
346 >           # check other installed copies of the tool
347 >           if ( $self->_toolparamcopy($self->{tool},$$hashref{'name'}) ) {
348 >              my @tmp=$self->{tool}->getfeature($$hashref{'name'});
349 >              $self->{Envvalue}=$tmp[0]; # assume single val parameter!
350 >           }
351 >           elsif ( defined $ENV{$$hashref{'name'}} ) {
352 >              # check the environment
353 >              $self->{Envvalue}=$ENV{$$hashref{'name'}};
354             }
355             elsif ( $self->_checkdefault($hashref) ) {
356 <            $self->{Envvalue}=$$hashref{'default'};
356 >              $self->{Envvalue}=$$hashref{'default'};
357             }
358            }
359          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines