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.3 by williamc, Tue Apr 11 08:58:07 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  
29   package BuildSystem::Tool;
# Line 58 | Line 57 | sub url {
57            :$self->{url};
58   }
59  
60 + sub listtype {
61 +        my $self=shift;
62 +        my $type=shift;
63 +
64 +        my @list=();
65 +        foreach $v ( $self->features() ) {
66 +          if ( $self->type($v) eq $type ) {
67 +                push @list, $v;
68 +          }
69 +        }
70 +        return @list;
71 + }
72 +
73   sub type {
74          my $self=shift;
75          my $name=shift;
# Line 153 | Line 165 | sub dependencies {
165          return @{$self->{recobjs}}
166   }
167  
168 < sub save {
168 > sub store {
169          my $self=shift;
170          my $location=shift;
171  
172          my $fh=FileHandle->new();
173          $fh->open(">".$location) or die "Unable to open $location for output".
174                                  $!."\n";
175 <        print $fh "_sys:name:".$self->name()."\n";
176 <        print $fh "_sys:version:".$self->version()."\n";
175 >        print $fh "name:".$self->name().":_sys\n";
176 >        print $fh "version:".$self->version().":_sys\n";
177          foreach $f ( $self->features()) {
178            foreach $val ( $self->getfeature($f) ) {
179 <           print $fh $self->type($f).":".$f.":".$val."\n";
179 >           print $fh $f.":".$val.":".$self->type($f)."\n";
180            }
181          }
182          undef $fh;
# Line 182 | Line 194 | sub restore {
194            chomp;
195            next if /^#/;
196            next if /^\s*$/;
197 <          ($type, $variable, $value)=split /:/;
197 >          ($variable, $value, $type)=split /:/;
198            next if ( $variable=~/\&/ );
199            $product=~tr[A-Z][a-z];
200            if ( $type eq "_sys" ) {
201 <             if ( can($variable)) {
201 >             if ( $self->can($variable)) {
202                 $self->$variable($value);
203               }
204            }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines