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 |
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 { |
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 |
|
} |
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 |
|
|
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 |
+ |
} |