Debian Codegraph @

DOC/HTML/sgmlspl/specs.html

raw symbols SCIP
1 <HTML>
2 <HEAD>
3 <TITLE>How does the specification file tell sgmlspl what to do?</TITLE>
4 </HEAD>
5 <BODY>
6
7 <P><B>Links</B>: <A HREF=handlers.html>Next</A> <A HREF=dsssl.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P>
8
9 <H1>How does the specification file tell <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> what to do?</H1>
10
11 <P><A HREF=sgmlspl.html><TT>sgmlspl</TT></A> uses an <I>event model</I> rather than
12 a <I>procedural model</I> -- instead of
13 saying "do A then B then C" you say "whenever X
14 happens, do A; whenever Y happens, do B; whenever Z happens, do
15 C". In other words, while you design the code, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A>
16 decides when and how often to run it.</P>
17
18 <P>The specification file, which contains your instructions, is
19 regular <A HREF="http://www.metronet.com/0/perlinfo/perl5/manual/perl.html"><TT>perl5</TT></A> code, and you can define packages and subroutines,
20 display information, read files, create variables, etc. For
21 processing the <A HREF="http://www.sil.org/sgml/sgml.html"><B>SGML</B></A> document, however, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> exports a single
22 subroutine, <TT>sgml(<IT>event</IT>,
23 <IT>handler</IT>)</TT>, into the 'main' package
24 -- each time you call <TT>sgml</TT>, you declare a
25 handler for a specific type of <TT>sgmls</TT> <A HREF="../SGMLSpm/events.html">event</A>, and <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> will then
26 execute that handler every time the event occurs. You may use
27 <TT>sgml</TT> to declare a <A HREF=handlers.html>handler</A> for a <A HREF=generic.html><I>generic event</I></A>, like
28 <TT>'start_element'</TT>, or a <A HREF=specific.html><I>specific event</I></A>,
29 like <TT>'&lt;DOC&gt;'</TT> -- a specific event will
30 always take precedence over a generic event, so when the
31 <TT>DOC</TT> element begins, <A HREF=sgmlspl.html><TT>sgmlspl</TT></A> will execute the
32 <TT>'&lt;DOC&gt;'</TT> handler rather than the
33 <TT>'start_element'</TT> handler.</P>
34
35
36 <P><B>Links</B>: <A HREF=handlers.html>Next</A> <A HREF=dsssl.html>Previous</A> <A HREF=sgmlspl.html>Up</A> <A HREF=sgmlspl.html>Top</A></P>
37
38
39 <ADDRESS>David Megginson <A HREF="mailto:[email protected]">&lt;[email protected]&gt;</A></ADDRESS>
40 </BODY>
41 </HTML>