ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/BuildFile.pm
Revision: 1.1
Committed: Fri Dec 17 11:02:27 1999 UTC (25 years, 4 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: ProtoEnd
Branch point for: V0_9branch
Log Message:
Not tested

File Contents

# User Rev Content
1 williamc 1.1 #
2     # BuildFile.pm - An Active Document
3     #
4     # Originally Written by Christopher Williams
5     #
6     # Description
7     # -----------
8     # Parse a BuildFile to figure out the required build rules
9     #
10     # Interface
11     # ---------
12     # new() : A new BuildFile object
13    
14     package BuildSystem::BuildFile;
15     require 5.001;
16     @ISA=qw(ActiveDoc)
17    
18     sub init {
19     my $self=shift;
20    
21     # set up our data structures
22     $self->{Benv}=BuildEnvironment->new();
23     # Specific tags
24     # environment tags
25     $self->{tags}->addtag("Environment", \&Environment_Start, "",
26     \&Environment_End);
27     # bin tags
28     $self->{bincontext}=0;
29     $self->{tags}->addtag("bin", \&bin_Start, \&bin_text, \&bin_End);
30    
31     $self->_addignore();
32     }
33    
34     # --------------------- Support Routines ----
35     sub _expandvars {
36     my $self=shift;
37     my $string=shift;
38    
39     # Deal with Use in the environment
40    
41     # expand directly from the local build Env
42     $self->{Benv}->expandvars($string);
43     }
44    
45     # ------------------- Tag Routines ------------------------------
46    
47     sub Environment_Start {
48     my $self=shift;
49     my $name=shift;
50     my $hashref=shift;
51    
52     $self->{Benv}->newenv();
53    
54     }
55    
56     sub Environment_End {
57     my $self=shift;
58     my $name=shift;
59     my $hashref=shift;
60    
61     $self->{Benv}->restoreenv();
62     }
63    
64     sub Use_Start {
65     my $self=shift;
66     my $name=shift;
67     my $hashref=shift;
68    
69     # checks
70     $self->checktag($hashref, 'name' ,$name );
71    
72     $self->{Benv}->addparam('scram_use', $$hashref->{'name'});
73     $self->{Benv}->addparam('scram_use_group', $$hashref->{'group'});
74     }
75    
76     # ---- binary specific tags
77     sub bin_Start {
78     my $self=shift;
79     my $name=shift;
80     my $hashref=shift;
81    
82     my $extension;
83    
84     # checks
85     if ( $self->{bincontext} == 0 ) {
86     $self->{bincontext}=1;
87     $self->checktag($hashref, 'file' ,$name );
88     ($extension=$$hashref{file})=~s/.*\.//;
89     if ( ! defined $$hashref{name} ) {
90     ($$hashref{name}=$$hashref{file})=~s/\..*//;
91     }
92    
93     push @{$self->{bins}}, $self->_expandvars(
94     $self->{Toolbox}->gettool($extension, "exe"));
95     }
96     else {
97     $self->parseerror("Attempt to open a new <$name> before a </$name>");
98     }
99     }
100    
101     sub bin_text {
102     my $self=shift;
103     my $name=shift;
104     my $string=shift;
105    
106     push @{$self->{binstext}}, $string;
107     }
108    
109     sub bin_End {
110     my $self=shift;
111     my $name=shift;
112    
113     $self->{bincontext}=0;
114     }
115    
116     sub lib_start {
117     my $self=shift;
118     my $name=shift;
119     my $hashref=shift;
120     }
121    
122     # libray specific tags
123     sub libtype {
124     my $self=shift;
125     my $name=shift;
126     my $hashref=shift;
127     }