1 ########################################################################
2 # skel.pl: an SGMLSPL script for producing scripts (!!).
4 # Copyright (c) 1995 by David Megginson <dmeggins@aix1.uottawa.ca>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 # Revision 1.4 1995/11/15 20:21:07 david
25 # Changed "use Output" to "use SGMLS::Output".
27 # Revision 1.3 1995/08/24 15:04:38 david
28 # Fixed commented-out 're' handler.
30 # Revision 1.2 1995/08/12 16:16:42 david
31 # Revised version for 1.01 distribution.
33 # Revision 1.1 1995/04/23 14:49:35 david
36 ########################################################################
41 $version = '$Id: skel.pl,v 1.4 1995/11/15 20:21:07 david Exp $';
43 %subdocs = (); # Subdocument entities seen so far.
44 %entities = (); # External data entities seen so far.
45 %sdata = (); # SDATA strings seen so far.
46 %elements = (); # Elements seen so far.
47 $pi = 0; # Any processing instructions?
49 $intro = 0; # Have we printed the banner yet?
53 sgml('end_element', ''); # Ignore the ends of elements.
54 sgml('end_subdoc', ''); # Ignore the ends of subdocument entities.
55 sgml('cdata', ''); # Ignore CDATA.
56 sgml('re', ''); # Ignore Record Ends.
58 # Note any processing instructions.
59 sgml('pi', sub { $pi = 1; });
61 # Keep track of all subdocument entities.
62 sgml('start_subdoc', sub {
64 $entities{$entity->name} = 1;
66 # Keep track of all external data entities.
69 $entities{$entity->name} = 1;
71 # Keep track of all SDATA strings
77 # Display element handlers as they appear.
78 sgml('start_element', sub {
82 do_intro($element->name);
84 if (!$elements{$element->name}) {
85 output "# Element: " . $element->name . "\n";
86 output "sgml('<" . $element->name . ">', \"\");\n";
87 output "sgml('</" . $element->name . ">', \"\");\n\n";
88 $elements{$element->name} = 1;
93 # generate subdoc handlers
94 my @keys = keys(%subdocs);
96 output "#\n# Subdocument Entity Handlers\n#\n\n";
98 output "# Subdocument Entity: $_\n";
99 output "sgml('{" . $_ . "}', \"\");\n";
100 output "sgml('{/" . $_ . "}', \"\");\n\n";
103 # generate entity handlers
104 my @keys = keys(%entities);
106 output "#\n# External Data Entity Handlers\n#\n\n";
108 output "sgml('&" . $_ . ";', \"\");\n";
111 # generate sdata handlers
112 my @keys = keys(%sdata);
114 output "#\n# SDATA Handlers\n#\n\n";
116 output "sgml('|" . $_ . "|', \"\");\n";
121 output "#\n# Processing-Instruction Handler\n#\n";
122 output "sgml('pi', sub {});\n\n";
127 # Default handlers (uncomment these if needed). Right now, these are set
128 # up to gag on any unrecognised elements, sdata, processing-instructions,
131 # sgml('start_element',sub { die "Unknown element: " . \$_[0]->name; });
132 # sgml('end_element','');
133 # sgml('cdata',sub { output \$_[0]; });
134 # sgml('sdata',sub { die "Unknown SDATA: " . \$_[0]; });
136 # sgml('pi',sub { die "Unknown processing instruction: " . \$_[0]; });
137 # sgml('entity',sub { die "Unknown external entity: " . \$_[0]->name; });
138 # sgml('start_subdoc',sub { die "Unknown subdoc entity: " . \$_[0]->name; });
139 # sgml('end_subdoc','');
140 # sgml('conforming','');
148 # Function to print the banner.
152 ########################################################################
153 # SGMLSPL script produced automatically by the script sgmlspl.pl
155 # Document Type: $doctype
157 ########################################################################
159 use SGMLS; # Use the SGMLS package.
160 use SGMLS::Output; # Use stack-based output.
165 sgml('start', sub {});