ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/Requirements.pm
Revision: 1.1.2.1
Committed: Fri Apr 7 08:12:47 2000 UTC (25 years, 1 month ago) by williamc
Content type: text/plain
Branch: V0_9branch
CVS Tags: V0_11_4, V0_11_3, V0_11_2, V0_11_1, V0_11_0
Changes since 1.1: +63 -0 lines
Log Message:
reworked to interface with toolbox unit

File Contents

# Content
1 # Requirements Doc - just to get ordering info
2 #
3 # Interface
4 # ---------
5 # new(file) : new requirements doc
6 # tools() : Return list of requirements (ordered)
7 # version(tool) : return the version of a given tool
8
9 package BuildSystem::Requirements;
10 use ActiveDoc::SimpleDoc;
11 require 5.004;
12
13 sub new {
14 my $class=shift;
15 my $self={};
16 bless $self, $class;
17 $self->{file}=shift;
18 $self->{Arch}=1;
19 push @{$self->{ARCHBLOCK}}, $Arch;
20 $self->init($self->{file});
21 return $self;
22 }
23
24 sub tools {
25 my $self=shift;
26 return @{$self->{tools}};
27 }
28
29 sub version {
30 my $self=shift;
31 my $tool=shift;
32 return $self->{'version'}{$tool};
33 }
34
35 sub init {
36 my $self=shift;
37 my $file=shift;
38
39 my $switch=ActiveDoc::SimpleDoc->new();
40 $switch->filetoparse($file);
41 $switch->newparse("ordering");
42 $switch->addtag("ordering","require",
43 \&require_start,$self,
44 "", $self,
45 "", $self);
46 $self->{switch}=$switch;
47 @{$self->{tools}}=();
48 $switch->parse("ordering");
49 }
50
51 # ---- Tag routines
52 sub require_start {
53 my $self=shift;
54 my $name=shift;
55 my $hashref=shift;
56
57 $self->{switch}->checktag( $name, $hashref, 'version');
58 $self->{switch}->checktag( $name, $hashref, 'name');
59 if ( $self->{Arch} ) {
60 push @{$self->{tools}}, $$hashref{'name'};
61 $self->{version}{$$hashref{'name'}}=$$hashref{'version'}
62 }
63 }