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

Comparing COMP/SCRAM/src/BuildSystem/Tool.pm (file contents):
Revision 1.1.2.2 by williamc, Mon Apr 10 16:41:04 2000 UTC vs.
Revision 1.1.2.5 by williamc, Thu Apr 20 11:32:26 2000 UTC

# Line 15 | Line 15
15   # url()         : get set the tool url
16   # features()    : return a list of features defined (ordered in relation to
17   #                       their first definition)
18 + # listtype(type) : return a list of all features of the specified type
19   # addfeature(name,@value) : add value(s) to the named feature
20   # setfeature(name,@value) : set value(s) for the named feature
21   # getfeature(name) : return a list of elements belonging to the named feature
# Line 22 | Line 23
23   # type(name[,type]) : get/set the type associated with a feature
24   # addrequirement() : add a requirement at the current parse position
25   # dependencies()   : return a list of dependency objects
26 < # nonembeddeddependencies()   : return a list of dependency objects that
26 < #                               are not embedded into the parameters
27 < # save(location)   : Save object to given file
26 > # store(location)   : Save object to given file
27   # restore(location) : Restore object from specified file
28 + # reset()           : Clean out all the features
29  
30   package BuildSystem::Tool;
31   require 5.004;
# Line 58 | Line 58 | sub url {
58            :$self->{url};
59   }
60  
61 + sub listtype {
62 +        my $self=shift;
63 +        my $type=shift;
64 +
65 +        my @list=();
66 +        foreach $v ( $self->features() ) {
67 +          if ( $self->type($v) eq $type ) {
68 +                push @list, $v;
69 +          }
70 +        }
71 +        return @list;
72 + }
73 +
74   sub type {
75          my $self=shift;
76          my $name=shift;
# Line 87 | Line 100 | sub setfeature {
100          @{$self->{features}{$name}}=@value;
101   }
102  
103 + sub reset {
104 +        my $self=shift;
105 +        undef $self->{features};
106 +        undef $self->{'features_ordered'};
107 +        undef $self->{reqobjs};
108 +        undef $self->{requireposition};
109 + }
110  
111   sub _newfeature {
112          my $self=shift;
# Line 153 | Line 173 | sub dependencies {
173          return @{$self->{recobjs}}
174   }
175  
176 < sub save {
176 > sub store {
177          my $self=shift;
178          my $location=shift;
179  
180          my $fh=FileHandle->new();
181          $fh->open(">".$location) or die "Unable to open $location for output".
182                                  $!."\n";
183 <        print $fh "_sys:name:".$self->name()."\n";
184 <        print $fh "_sys:version:".$self->version()."\n";
183 >        print $fh "name:".$self->name().":_sys\n";
184 >        print $fh "version:".$self->version().":_sys\n";
185 >        print $fh "url:".$self->url().":_sys\n";
186          foreach $f ( $self->features()) {
187            foreach $val ( $self->getfeature($f) ) {
188 <           print $fh $self->type($f).":".$f.":".$val."\n";
188 >           print $fh $f.":".$val.":".$self->type($f)."\n";
189            }
190          }
191          undef $fh;
# Line 182 | Line 203 | sub restore {
203            chomp;
204            next if /^#/;
205            next if /^\s*$/;
206 <          ($type, $variable, $value)=split /:/;
206 >          ($variable, $value, $type)=split /:/;
207            next if ( $variable=~/\&/ );
208            $product=~tr[A-Z][a-z];
209            if ( $type eq "_sys" ) {
210 <             if ( can($variable)) {
210 >             if ( $self->can($variable)) {
211                 $self->$variable($value);
212               }
213            }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines