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

Comparing COMP/SCRAM/src/Runtime.pm (file contents):
Revision 1.1.2.3 by williamc, Fri Mar 31 10:27:03 2000 UTC vs.
Revision 1.1.2.5 by williamc, Fri Apr 7 13:34:52 2000 UTC

# Line 18 | Line 18
18  
19   package Runtime;
20   require 5.004;
21 + use ActiveDoc::SimpleDoc;
22  
23   sub new {
24          my $class=shift;
# Line 85 | Line 86 | sub _parsefile {
86          my $self=shift;
87          my $filename=shift;
88  
89 <        my $Tags={
90 <             'Runtime' => \&Runtime_text,
91 <             'Runtime_StartTag' => \&Runtime_start,
92 <             'Runtime_EndTag' => \&Runtime_end,
93 <             'ignore' => 'none',
94 <             'ignore_EndTag' => \&ignoretag_end,
95 <             'ignore_StartTag' => \&ignoretag,
96 <             'Architecture_StartTag' => \&Arch_Start,
97 <             'Architecture' => 'none' ,
98 <             'Architecture_EndTag' => \&Arch_End
98 <        };
99 <        use Utilities::Switcher;
100 <        $self->{switch}=Switcher->new($Tags, $filename);
89 >        $self->{switch}=ActiveDoc::SimpleDoc->new();
90 >        $self->{switch}->newparse("runtime");
91 >        $self->{switch}->addignoretags("runtime");
92 >        $self->{switch}->filetoparse($filename);
93 >        $self->{switch}->addtag("runtime","Runtime",
94 >             \&Runtime_start, $self,
95 >             \&Runtime_text, $self,
96 >             \&Runtime_end, $self);
97 >        $self->{switch}->addtag("runtime","Architecture",
98 >             \&Arch_Start, $self, "",$self, \&Arch_End, $self);
99          $self->{Runtimecontext}=0;
100 <        $self->{switch}->parse();
100 >        $self->{switch}->parse("runtime");
101   }
102  
103   sub _printoutenv {
# Line 120 | Line 118 | sub _printoutenv {
118   # ------ Tag Routines
119  
120   sub Runtime_start {
121 +        my $self=shift;
122          my $name=shift;
123 <        my @vars=@_;
125 <        my $hashref;
123 >        my $hashref=shift;
124  
125 <        $hashref=$self->{switch}->SetupValueHash(\@vars);
126 <        $self->{switch}->checkparam($hashref,$name,'name');
129 <        $self->{switch}->checkparam($hashref,$name,'value');
125 >        $self->{switch}->checktag($name,$hashref,'name');
126 >        $self->{switch}->checktag($name,$hashref,'value');
127          if ( $self->{Arch} ) {
128            if ( $self->{Runtimecontext} == 1 ) {
129 <           print "No </$name> before new tag at line ".
133 <                                $self->{switch}->line()."\n";
134 <           exit 1;
129 >           $self->{switch}->parseerror("No </$name> before new tag");
130            }
131            $self->{Runtimecontext}=1;
132  
# Line 140 | Line 135 | sub Runtime_start {
135            if ( defined $$hashref{'type'} ) {
136               if ( ( exists $self->{'vartype'}{$$hashref{'name'}} ) &&
137                  ( $self->{'vartype'}{$$hashref{'name'}} ne $$hashref{'type'}) ){
138 <                   print "Redefinition of Variable type for ".$$hashref{'name'}
139 <                        ." on line ".$self->{switch}->line();
138 >                   $self->{switch}->parseerror("Redefinition of Variable".
139 >                        " type for ".$$hashref{'name'});
140               }
141               $self->{'vartype'}{$$hashref{'name'}}=$$hashref{'type'};
142               if ( defined $self->{validtypes}{$$hashref{'type'}} ) {
143 <                print "Unknown type ".$$hashref{'type'}." on line ".
144 <                        $self->{switch}->line()."\n";
150 <                exit 1;
143 >                $self->{switch}->parseerror(
144 >                     "Unknown type ".$$hashref{'type'});
145               }
146            }
147            else {
# Line 157 | Line 151 | sub Runtime_start {
151   }
152  
153   sub Runtime_text {
154 +        my $self=shift;
155          my $name=shift;
156          my @vars=@_;
157  
# Line 168 | Line 163 | sub Runtime_text {
163   }
164  
165   sub Runtime_end {
166 +        my $self=shift;
167          my $name=shift;
168          if ( $self->{Arch} ) {
169             $self->{Runtimecontext}=0;
170          }
171   }
172 +
173 + sub Arch_Start {
174 +        my $self=shift;
175 +        my $name=shift;
176 +        my $hashref=shift;
177 +
178 +        $toolswitch->checktag($name, $hashref,'name');
179 +        ( ($ENV{SCRAM_ARCH}=~/$$hashref{name}.*/) )? ($self->{Arch}=1)
180 +                                                : ($self->{Arch}=0);
181 +        push @{$self->{ARCHBLOCK}}, $self->{Arch};
182 + }
183 +
184 + sub Arch_End {
185 +        my $self=shift;
186 +        my $name=shift;
187 +
188 +        pop @{$self->{ARCHBLOCK}};
189 +        $self->{Arch}=$self->{ARCHBLOCK}[$#{$self->{ARCHBLOCK}}];
190 + }
191 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines