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

Comparing COMP/SCRAM/src/ActiveDoc/ActiveDoc.pm (file contents):
Revision 1.8 by williamc, Tue Nov 23 17:31:10 1999 UTC vs.
Revision 1.9 by williamc, Mon Nov 29 17:32:14 1999 UTC

# Line 15 | Line 15
15   # newparse(parselabel) : Create a new parse type
16   # addtag(parselabel,tagname,start,obj,text,obj,end,obj)
17   #                               : Add tags to the parse given by label
18 + # checktag(tagname, hashref, param) : check for existence of param in
19 + #                                       hashref from a tag call
20   # newdoc(file)  : Return an new object of the appropriate type
21   # getfile(url)  : get a processedfile object given a url
22 + # activatedoc(url) : Return the object ref for a doc described by the given url
23   # config([ActiveConfig]) : Set up/return Configuration for the document
24   # basequery([ActiveConfig]) : Set up/return UserQuery for the doc
25   # copydocconfig(ActiveDoc) : Copy the basic configuration from the ActiveDoc
# Line 155 | Line 158 | sub getfile() {
158          return $fileref;
159   }
160  
161 + sub activatedoc {
162 +        my $self=shift;
163 +        my $url=shift;
164 +
165 +        # first get a preprocessed copy of the file
166 +        my $fileob=$self->getfile($url);
167 +
168 +        # now parse it for the <DocType> tag
169 +        $self->newparse("doctype");
170 +        $self->addtag("doctype","Doc", \&Doc_Start, $self,
171 +                                          "", $self, "", $self);
172 +        $self->parse("doctype");
173 +
174 +        if ( ! defined $self->{docobject} ) {
175 +          print "No <Doc type=> Specified in ".$fileob->url()."\n";
176 +          exit 1;
177 +        }
178 +        # Set up a new object of the specified type
179 +        my $newobj=$self->{docobject}->new($self->config());
180 +        return $newobj;
181 + }
182 +
183   # -------- Error Handling and Error services --------------
184  
185   sub error {
# Line 181 | Line 206 | sub checktag {
206          my $hashref=shift;
207          my $param=shift;
208  
209 +        print keys %$hashref;
210 +        print "-----------------------------------\n";
211          if ( ! exists $$hashref{$param} ) {
212            $self->parseerror("Incomplete Tag <$tagname> : $param required");
213          }
# Line 188 | Line 215 | sub checktag {
215  
216   sub line {
217          my $self=shift;
218 +
219          my ($line, $fileobj)=
220 <                $self->{File}->line($self->{currentparser}->line());
220 >                $self->{File}->realline($self->{currentparser}->line());
221          return ($line, $fileobj);
222   }
223  
# Line 246 | Line 274 | sub Base_end {
274            $self->{urlhandler}->unsetbase($type);
275          }
276   }
277 +
278 + sub Doc_Start {
279 +        my $self=shift;
280 +        my $name=shift;
281 +        my $hashref=shift;
282 +        
283 +        $self->checktag($name, $hashref, "type");
284 +        $self->{docobject}=$$hashref{'type'};
285 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines