Annotation of Amaya/doc/languages.html, revision 1.39
1.37 cvs 1: <?xml version="1.0" encoding="iso-8859-1"?>
2: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4: <html xmlns="http://www.w3.org/1999/xhtml">
1.18 cvs 5: <head>
1.30 cvs 6: <title>The Languages of Thot</title>
1.37 cvs 7: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
1.18 cvs 8: </head>
1.30 cvs 9:
1.18 cvs 10: <body>
11:
1.19 cvs 12: <div class="frontmatter" align="center">
1.18 cvs 13: <h1>The Languages of Thot</h1>
14:
15: <h3>Vincent Quint</h3>
16:
17: <h4>Translated from French by Ethan Munson</h4>
18:
1.39 ! cvs 19: <h4>Version of June 30, 2001</h4>
1.30 cvs 20:
1.37 cvs 21: <p>© 1996-2001 INRIA</p>
22: <hr />
1.18 cvs 23: </div>
24:
25: <div class="tableofcontents">
26: <h2><a href="languages.toc.html">Contents</a></h2>
27: <ul>
1.39 ! cvs 28: <li><big><a href="#sect2">The document model of Thot</a></big>
! 29:
1.30 cvs 30: <ul>
31: <li><strong><a href="#sectb21">The logical structure of
32: documents</a></strong></li>
33: <li><strong><a href="#sectb22">Generic and specific
34: structures</a></strong></li>
35: <li><strong><a href="#sectb23">Logical structure and physical
36: structure</a></strong></li>
37: <li><strong><a href="#sectb24">Document structures and object
38: structures</a></strong></li>
39: </ul>
40: </li>
1.39 ! cvs 41: <li><big><a href="#sect3">The S language</a></big>
! 42:
1.30 cvs 43: <ul>
1.39 ! cvs 44: <li><strong><a href="#sectb31">Document meta-structure</a></strong>
! 45:
1.30 cvs 46: <ul>
47: <li><a href="#sectc311">The basic types</a></li>
48: <li><a href="#sectc312">Constructed elements</a></li>
1.39 ! cvs 49: <li><a href="#sectc313">Logical structure constructors</a>
! 50:
1.30 cvs 51: <ul>
52: <li><small><a href="#sectd3131">Aggregate and
53: List</a></small></li>
54: <li><small><a href="#sectd3132">Choice, Schema, and
55: Unit</a></small></li>
56: <li><small><a href="#sectd3133">Reference and
57: Inclusion</a></small></li>
58: <li><small><a href="#sectd3134">Mark pairs</a></small></li>
59: <li><small><a href="#sectd3135">Restrictions and
60: Extensions</a></small></li>
61: <li><small><a href="#sectd3136">Summary</a></small></li>
62: </ul>
63: </li>
64: <li><a href="#sectc315">Attributes</a></li>
65: <li><a href="#sectc316">Discussion of the model</a></li>
66: </ul>
67: </li>
68: <li><strong><a href="#sectb32">The definition language for generic
1.39 ! cvs 69: structures</a></strong>
! 70:
1.30 cvs 71: <ul>
72: <li><a href="#sectc321">Writing Conventions</a></li>
73: <li><a href="#sectc322">Extension schemas</a></li>
74: <li><a href="#sectc323">The general organization of structure
75: schemas</a></li>
76: <li><a href="#sectc324">The default presentation</a></li>
77: <li><a href="#sectc325">Global Attributes</a></li>
78: <li><a href="#sectc327">Structured elements</a></li>
1.39 ! cvs 79: <li><a href="#sectc328">Structure definitions</a>
! 80:
1.30 cvs 81: <ul>
82: <li><small><a href="#sectd3281">List</a></small></li>
83: <li><small><a href="#sectd3282">Aggregate</a></small></li>
84: <li><small><a href="#sectd3283">Choice</a></small></li>
85: <li><small><a href="#sectd3284">Reference</a></small></li>
86: <li><small><a href="#sectd3285">Mark pairs</a></small></li>
87: </ul>
88: </li>
89: <li><a href="#sectc329">Imports</a></li>
90: <li><a href="#sectc3210">Extension rules</a></li>
91: <li><a href="#sectc3212">Units</a></li>
92: <li><a href="#sectc3213">Skeleton elements</a></li>
93: <li><a href="#sectc3214">Exceptions</a></li>
94: </ul>
95: </li>
1.39 ! cvs 96: <li><strong><a href="#sectb33">Some examples</a></strong>
! 97:
1.30 cvs 98: <ul>
99: <li><a href="#sectc331">A class of documents: articles</a></li>
100: <li><a href="#sectc332">A class of objects: mathematical
101: formulas</a></li>
102: </ul>
103: </li>
104: </ul>
105: </li>
1.39 ! cvs 106: <li><big><a href="#sect4">The P language</a></big>
! 107:
1.30 cvs 108: <ul>
1.39 ! cvs 109: <li><strong><a href="#sectb41">Document presentation</a></strong>
! 110:
1.30 cvs 111: <ul>
112: <li><a href="#sectc411">Two levels of presentation</a></li>
113: <li><a href="#sectc412">Boxes</a></li>
114: <li><a href="#sectc413">Views and visibility</a></li>
115: <li><a href="#sectc414">Pages</a></li>
116: <li><a href="#sectc415">Numbering</a></li>
1.34 cvs 117: <li><a href="#sectc416">Presentation properties</a></li>
1.30 cvs 118: </ul>
119: </li>
120: <li><strong><a href="#sectb42">Presentation description
1.39 ! cvs 121: language</a></strong>
! 122:
1.30 cvs 123: <ul>
124: <li><a href="#sectc421">The organization of a presentation
125: schema</a></li>
126: <li><a href="#sectc422">Views</a></li>
127: <li><a href="#sectc423">Print Views</a></li>
128: <li><a href="#sectc424">Counters</a></li>
129: <li><a href="#sectc425">Presentation constants</a></li>
130: <li><a href="#sectc426">Variables</a></li>
131: <li><a href="#sectc427">Default presentation rules</a></li>
132: <li><a href="#sectc428">Presentation and page layout boxes</a></li>
133: <li><a href="#sectc429">Presentation of structured elements</a></li>
134: <li><a href="#sectc4210">Logical attribute presentation</a></li>
135: <li><a href="#sectc4212">Value transmission rules</a></li>
136: <li><a href="#sectc4213">Presentation rules</a></li>
137: <li><a href="#sectc4214">Conditions applying to presentation
1.39 ! cvs 138: rules</a>
! 139:
1.30 cvs 140: <ul>
1.37 cvs 141: <li><small><a href="#sectd42141">Conditions based on the
142: logical position of the element</a></small></li>
1.30 cvs 143: <li><small><a href="#sectd42142">Conditions on
144: references</a></small></li>
145: <li><small><a href="#sectd42143">Conditions on logical
146: attributes</a></small></li>
147: <li><small><a href="#sectd42144">Conditions on page
148: breaks</a></small></li>
149: <li><small><a href="#sectd42145">Conditions on the element's
150: content</a></small></li>
151: <li><small><a href="#sectd42146">Conditions on
152: counters</a></small></li>
153: </ul>
154: </li>
155: <li><a href="#sectc4215">A presentation rule</a></li>
156: <li><a href="#sectc4216">Box axes</a></li>
157: <li><a href="#sectc4217">Distance units</a></li>
158: <li><a href="#sectc4218">Relative positions</a></li>
1.39 ! cvs 159: <li><a href="#sectc4219">Box extents</a>
! 160:
1.30 cvs 161: <ul>
162: <li><small><a href="#sectd42191">Fixed extents</a></small></li>
163: <li><small><a href="#sectd42192">Relative
164: extents</a></small></li>
165: <li><small><a href="#sectd42193">Elastic
166: extents</a></small></li>
167: </ul>
168: </li>
169: <li><a href="#sectc4220">Overflow</a></li>
170: <li><a href="#sectc4221">Inheritance</a></li>
1.39 ! cvs 171: <li><a href="#sectc4222">Line breaking</a>
! 172:
1.30 cvs 173: <ul>
174: <li><small><a href="#sectd42221">Line spacing</a></small></li>
175: <li><small><a href="#sectd42222">First line
176: indentation</a></small></li>
177: <li><small><a href="#sectd42223">Alignment</a></small></li>
178: <li><small><a href="#sectd42225">Hyphenation</a></small></li>
179: <li><small><a href="#sectd42226">Avoiding line
180: breaking</a></small></li>
181: </ul>
182: </li>
183: <li><a href="#sectc4223">Page breaking and line breaking
184: conditions</a></li>
185: <li><a href="#sectc4224">Visibility</a></li>
1.39 ! cvs 186: <li><a href="#sectc4225">Character style properties</a>
! 187:
1.30 cvs 188: <ul>
189: <li><small><a href="#sectd42251">Character size</a></small></li>
190: <li><small><a href="#sectd42252">Font and character
191: style</a></small></li>
192: <li><small><a href="#sectd42253">Underlining</a></small></li>
193: </ul>
194: </li>
195: <li><a href="#sectc4226">Stacking order</a></li>
196: <li><a href="#sectc4227">Line style</a></li>
197: <li><a href="#sectc4228">Line thickness</a></li>
198: <li><a href="#sectc4229">Fill pattern</a></li>
199: <li><a href="#sectc4230">Colors</a></li>
200: <li><a href="#sectc4230a">Background color and border</a></li>
201: <li><a href="#sectc4230b">Background pictures</a></li>
202: <li><a href="#sectc4231">Presentation box content</a></li>
203: <li><a href="#sectc4232">Presentation box creation</a></li>
204: <li><a href="#sectc4233">Page layout</a></li>
205: <li><a href="#sectc4234">Box copies</a></li>
206: </ul>
207: </li>
208: </ul>
209: </li>
1.39 ! cvs 210: <li><big><a href="#sect5">The T language</a></big>
! 211:
1.30 cvs 212: <ul>
1.39 ! cvs 213: <li><strong><a href="#sectb51">Document translation</a></strong>
! 214:
1.30 cvs 215: <ul>
216: <li><a href="#sectc511">Translation principles</a></li>
217: <li><a href="#sectc512">Translation procedure</a></li>
218: </ul>
219: </li>
220: <li><strong><a href="#sectb52">Translation definition
1.39 ! cvs 221: language</a></strong>
! 222:
1.30 cvs 223: <ul>
224: <li><a href="#sectc521">Organization of a translation
225: schema</a></li>
226: <li><a href="#sectc522">Line length</a></li>
227: <li><a href="#sectc523">Buffers</a></li>
228: <li><a href="#sectc524">Counters</a></li>
229: <li><a href="#sectc525">Constants</a></li>
230: <li><a href="#sectc526">Variables</a></li>
231: <li><a href="#sectc527">Translating structure elements</a></li>
1.39 ! cvs 232: <li><a href="#sectc528">Conditional rules</a>
! 233:
1.30 cvs 234: <ul>
235: <li><small><a href="#sectd5281">Conditions based on the logical
236: position of the element</a></small></li>
237: <li><small><a href="#sectd5282">Conditions on
238: references</a></small></li>
239: <li><small><a href="#sectd5284">Conditions on the
240: alphabets</a></small></li>
241: <li><small><a href="#sectd5285">Conditions on page
242: breaks</a></small></li>
243: <li><small><a href="#sectd5286">Conditions on the element's
244: content</a></small></li>
245: <li><small><a href="#sectd5288">Conditions on the presence of
246: specific presentation rules</a></small></li>
247: <li><small><a href="#sectd5289">Conditions on the presence of
248: logical attributes</a></small></li>
249: <li><small><a href="#sectd52810">Conditions on logical
250: attributes</a></small></li>
251: <li><small><a href="#sectd52811">Conditions on specific
252: presentation rules</a></small></li>
253: </ul>
254: </li>
255: <li><a href="#sectc529">Translation rules</a></li>
256: <li><a href="#sectc5210">The <tt>Create</tt> rule</a></li>
257: <li><a href="#sectc5211">The <tt>Write</tt> rule</a></li>
258: <li><a href="#sectc5212">The <tt>Read</tt> rule</a></li>
259: <li><a href="#sectc5213">The <tt>Include</tt> rule</a></li>
260: <li><a href="#sectc5214">The <tt>Get</tt> rule</a></li>
261: <li><a href="#sectc5215">The <tt>Copy</tt> rule</a></li>
262: <li><a href="#sectc5216">The <tt>Use</tt> rule</a></li>
263: <li><a href="#sectc5217">The <tt>Remove</tt> rule</a></li>
1.31 cvs 264: <li><a href="#sectc5217a">The <code>Ignore</code> rule</a></li>
1.30 cvs 265: <li><a href="#sectc5218">The <tt>NoTranslation</tt> rule</a></li>
266: <li><a href="#sectc5219">The <tt>NoLineBreak</tt> rule</a></li>
267: <li><a href="#sectc5220">The <tt>ChangeMainFile</tt> rule</a></li>
268: <li><a href="#sectc5220a">The <tt>RemoveFile</tt> rule</a></li>
269: <li><a href="#sectc5221">The <tt>Set</tt> and <tt>Add</tt>
270: rules</a></li>
271: <li><a href="#sectc5221a">The <tt>Indent</tt> rule</a></li>
272: <li><a href="#sectc5222">Rule application order</a></li>
273: <li><a href="#sectc5223">Translation of logical attributes</a></li>
274: <li><a href="#sectc5224">Translation of specific
275: presentations</a></li>
276: <li><a href="#sectc5225">Recoding of characters, symbols and
277: graphics</a></li>
278: </ul>
279: </li>
280: </ul>
281: </li>
1.39 ! cvs 282: <li><big><a href="#sect6">Language grammars</a></big>
! 283:
1.30 cvs 284: <ul>
285: <li><strong><a href="#sectb61">The M meta-language</a></strong></li>
286: <li><strong><a href="#sectb62">The S language</a></strong></li>
287: <li><strong><a href="#sectb63">The P language</a></strong></li>
288: <li><strong><a href="#sectb64">The T language</a></strong></li>
289: </ul>
290: </li>
1.39 ! cvs 291: <li><big><a href="#sect7">Character coding</a></big>
! 292:
1.30 cvs 293: <ul>
294: <li><strong><a href="#sectb71">Characters</a></strong></li>
295: <li><strong><a href="#sectb72">Symbols</a></strong></li>
296: <li><strong><a href="#sectb73">Graphical elements</a></strong></li>
297: </ul>
298: </li>
1.18 cvs 299: </ul>
1.37 cvs 300: <hr />
1.18 cvs 301: </div>
1.1 cvs 302:
1.18 cvs 303: <div class="chapter">
1.37 cvs 304: <h1><a name="sect2" id="sect2">The document model of Thot</a></h1>
1.1 cvs 305:
1.30 cvs 306: <p>All of the services which Thot provides to the user are based on the
1.37 cvs 307: system's internal document representation. This representation is itself
308: derived from the document model which underlies Thot. The model is presented
1.30 cvs 309: here, prior to the description of the languages which permit the generic
310: specification of documents.</p>
1.1 cvs 311:
1.18 cvs 312: <div class="section">
1.37 cvs 313: <h2><a name="sectb21" id="sectb21">The logical structure of documents</a></h2>
1.1 cvs 314:
1.30 cvs 315: <p>The document model of Thot is primarily designed to allow the user to
316: operate on those entities which s/he has in mind when s/he works on a
317: document. The model makes no assumptions about the nature of these entities.
318: It is essentially these logical entities, such as paragraphs, sections,
319: chapters, notes, titles, and cross-references which give a document its
320: logical structure.</p>
321:
322: <p>Because of this model, the author can divide the document into chapters,
1.37 cvs 323: giving each one a title. The content of these chapters can be further divided
324: into sections, subsections, etc. The text is organized into successive
1.2 cvs 325: paragraphs, according to the content. In the writing phase, the lines, pages,
1.37 cvs 326: margins, spacing, fonts, and character styles are not very important. In
327: fact, if the system requires documents to be written in these terms, it gets
328: in the way. So, Thot's model is primarily based on the logical aspect of
329: documents. The creation of a model of this type essentially requires the
330: definition :</p>
1.18 cvs 331: <ul>
1.30 cvs 332: <li>of the entities which can appear in the documents,</li>
333: <li>and the relations between these entities.</li>
1.18 cvs 334: </ul>
1.30 cvs 335:
1.37 cvs 336: <p>The choice of entities to include in the model can be subtle. Some
337: documents require chapters, while others only need various levels of
338: sections. Certain documents contain appendices, others don't. In different
339: documents the same logical entity may go by different names (e.g.
340: ``Conclusion'' and ``Summary''). Certain entities which are absolutely
341: necessary in some documents, such as clauses in a contract or the address of
342: the recipient in a letter, are useless in most other cases.</p>
1.30 cvs 343:
344: <p>The differences between documents result from more than just the entities
345: that appear in them, but also from the relationships between these entities
1.37 cvs 346: and the ways that they are linked. In certain documents, notes are spread
1.30 cvs 347: throughout the document, for example at the bottom of the page containing the
1.1 cvs 348: cross-reference to them, while in other documents they are collected at the
1.37 cvs 349: end of each chapter or even at the end of the work. As another example, the
1.1 cvs 350: introduction of some documents can contain many sections, while in other
351: documents, the introduction is restricted to be a short sequence of
1.18 cvs 352: paragraphs.</p>
1.30 cvs 353:
1.37 cvs 354: <p>All of this makes it unlikely that a single model can describe any
355: document at a relatively high level. It is obviously tempting to make up a
356: list of widely used entities, such as chapters, sections, paragraphs, and
357: titles, and then map all other entities onto the available choices. In this
358: way, an introduction can be supported as a chapter and a contract clause
359: supported as a paragraph or section. However, in trying to widen the range of
360: usage of certain entities, their meaning can be lost and the power of the
361: model reduced. In addition, while this widening partially solves the problem
362: of choosing entities, it does not solve the problem of their organization:
363: when a chapter must be composed of sections, how does one indicate that an
364: introduction has none when it is merely another chapter? One solution is to
1.1 cvs 365: include introductions in the list of supported entities. But then, how does
366: one distinguish those introductions which are allowed to have sections from
1.37 cvs 367: those which are not. Perhaps this could be done by defining two types of
1.1 cvs 368: introduction. Clearly, this approach risks an infinite expansion of the list
1.18 cvs 369: of widely used entities.</p>
370: </div>
1.1 cvs 371:
1.18 cvs 372: <div class="section">
1.37 cvs 373: <h2><a name="sectb22" id="sectb22">Generic and specific structures</a></h2>
1.1 cvs 374:
1.30 cvs 375: <p>Thus, it is apparently impossible to construct an exhaustive inventory of
376: all those entities which are necessary and sufficient to precisely describe
1.37 cvs 377: any document. It also seems impossible to specify all possible arrangements
378: of these entities in a document. This is why Thot uses a <em>meta-model</em>
1.18 cvs 379: instead, which permits the description of numerous <em>models</em>, each one
380: describing a <em>class</em> of documents.</p>
1.30 cvs 381:
1.37 cvs 382: <p>A <em>class</em> is a set of documents having very similar structure.
383: Thus, the collection of research reports published by a laboratory
384: constitutes a class; the set of commercial proposals by the sales department
385: of a company constitutes another class; the set of articles published by a
386: journal constitutes a third class. Clearly, it is not possible to enumerate
387: every possible document class. It is also clear that new document classes
388: must be created to satisfy new needs and applications.</p>
1.30 cvs 389:
390: <p>To give a more rigorous definition of classes, we must introduce the ideas
1.37 cvs 391: of <em>generic structure</em> and <em>specific structure</em>. Each document
1.30 cvs 392: has a <em>specific structure</em> which organizes the various parts which
1.37 cvs 393: comprise it. We illustrate this with the help of a simple example comparing
1.30 cvs 394: two reports, A and B (<a href="#specstruct">see Figure</a>). The report A
1.37 cvs 395: contains an introduction followed by three chapters and a conclusion. The
396: first chapter contains two sections, the second, three sections. That is the
1.18 cvs 397: <em>specific</em> structure of document A. Similarly, the structure of
1.1 cvs 398: document B is: an introduction, two chapters, a conclusion; Chapter 1 has
1.37 cvs 399: three sections while Chapter 2 has four. The specific structures of these two
1.18 cvs 400: documents are thus different.</p>
1.1 cvs 401:
1.18 cvs 402: <div class="figure">
1.37 cvs 403: <hr />
1.18 cvs 404: <pre> Report A Report B
1.1 cvs 405: Introduction Introduction
406: Chapter 1 Chapter 1
407: Section 1.1 Section 1.1
408: Section 1.2 Section 1.2
409: Chapter 2 Section 1.3
410: Section 2.1 Chapter 2
411: Section 2.2 Section 2.1
412: Section 2.3 Section 2.2
413: Chapter 3 Section 2.3
414: Conclusion Section 2.4
1.18 cvs 415: Conclusion</pre>
1.30 cvs 416:
1.37 cvs 417: <p align="center"><em><a name="specstruct" id="specstruct">Two specific
1.30 cvs 418: structures</a></em></p>
1.37 cvs 419: <hr />
1.30 cvs 420: </div>
421:
422: <p>The <em>generic structure</em> defines the ways in which specific
1.37 cvs 423: structures can be constructed. It specifies how to generate specific
424: structures. The reports A and B, though different, are constructed in
1.30 cvs 425: accordance with the same generic structure, which specifies that a report
426: contains an introduction followed by a variable number of chapters and a
427: conclusion, with each chapter containing a variable number of sections.</p>
428:
429: <p>There is a one-to-one correspondence between a class and a generic
1.37 cvs 430: structure: all the documents of a class are constructed in accordance with
431: the same generic structure. Hence the definition of the class: a class is a
432: set of documents whose specific structure is constructed in accordance with
433: the same generic structure. A class is characterized by its generic
1.30 cvs 434: structure.</p>
1.19 cvs 435:
1.30 cvs 436: <p>Thus, a generic structure can be considered to be a model at the level
1.37 cvs 437: which interests us, but only for one class of documents. When the definition
1.30 cvs 438: is limited to a single class of documents, it is possible to define a model
439: which does a good job of representing the documents of the class, including
1.37 cvs 440: the necessary entities and unencumbered by useless entities. The description
1.30 cvs 441: of the organization of the documents in the class can then be sufficiently
1.18 cvs 442: precise.</p>
443: </div>
1.1 cvs 444:
1.18 cvs 445: <div class="section">
1.37 cvs 446: <h2><a name="sectb23" id="sectb23">Logical structure and physical
447: structure</a></h2>
1.1 cvs 448:
1.30 cvs 449: <p>Generic structures only describe the <em>logical</em> organization of
1.18 cvs 450: documents, not their <em>physical</em> presentation on a screen or on sheets
1.37 cvs 451: of paper. However, for a document to be displayed or printed, its graphic
1.18 cvs 452: presentation must be taken into account.</p>
1.30 cvs 453:
454: <p>An examination of current printed documents shows that the details of
1.1 cvs 455: presentation essentially serve to bring out their logical structure. Outside
456: of some particular domains, notably advertising, the presentation is rarely
1.37 cvs 457: independent of the logical organization of the text. Moreover, the art of
1.1 cvs 458: typography consists of enhancing the organization of the text being set,
1.37 cvs 459: without catching the eye of the reader with overly pronounced effects. Thus,
460: italic and boldface type are used to emphasize words or expressions which
461: have greater significance than the rest of the text: keywords, new ideas,
462: citations, book titles, etc. Other effects highlight the organization of the
1.1 cvs 463: text: vertical space, margin changes, page breaks, centering, eventually
464: combined with the changes in the shapes or weight of the characters. These
465: effects serve to indicate the transitions between paragraphs, sections, or
466: chapters: an object's level in the logical structure of the document is shown
1.18 cvs 467: by the markedness of the effects.</p>
1.30 cvs 468:
469: <p>Since the model permits the description of all of the logical structure of
470: the document, the presentation can be derived from the model without being
1.37 cvs 471: submerged in the document itself. It suffices to use the logical structure of
1.1 cvs 472: the document to make the desired changes in its presentation: changes in type
1.18 cvs 473: size, type style, spacing, margin, centering, etc.</p>
1.30 cvs 474:
475: <p>Just as one cannot define a unique generic logical structure for all
476: document classes, one cannot define universal presentation rules which can be
1.37 cvs 477: applied to all document classes. For certain types of documents the chapter
478: titles will be centered on the page and printed in large, bold type. For
479: other documents, the same chapter titles will be printed in small, italic
480: type and aligned on the left margin.</p>
1.30 cvs 481:
482: <p>Therefore, it is necessary to base the presentation specifications for
1.37 cvs 483: documents on their class. Such a specification can be very fine-grained,
1.1 cvs 484: because the presentation is expressed in terms of the entities defined in the
1.37 cvs 485: generic logical structure of the class. Thus, it is possible to specify a
1.1 cvs 486: different presentation for the chapter titles and the section titles, and
487: similarly to specify titles for the sections according to their level in the
1.37 cvs 488: section hierarchy. The set of rules which specify the presentation of all the
1.18 cvs 489: elements defined in a generic logical structure is called a <em>generic
490: presentation</em>.</p>
1.30 cvs 491:
492: <p>There are several advantages derived from having a presentation linked to
493: the generic structure and described by a generic presentation. Homogeneity is
1.37 cvs 494: the first. Since every document in a class corresponds to the same generic
1.1 cvs 495: logical structure, a homogenous presentation for different documents of the
496: same class can be assured by applying the same generic presentation to all
1.37 cvs 497: documents of the class. Homogeneity of presentation can also be found among
498: the entities of a single document: every section heading will be presented in
499: the same way, the first line of every paragraph of the same type will have
500: the same indentation, etc.</p>
1.30 cvs 501:
502: <p>Another advantage of this approach to presentation is that it facilitates
1.37 cvs 503: changes to the graphical aspect of documents. A change to the generic
504: presentation rules attached to each type of entity will alter the
505: presentation of the entire document, and will do so homogenously. In this
506: case, the internal homogeneity of the class is no longer assured, but the way
507: to control it is simple. It suffices to adopt a single generic presentation
508: for the entire class.</p>
1.30 cvs 509:
510: <p>If the presentation of the class does not have to be homogenous, then the
1.37 cvs 511: appearance of the document can be adapted to the way it will be used or to
512: the device used to render it. This quality is sufficient to allow the
513: existence of <a name="mulpres" id="mulpres">many generic presentations</a>
514: for the same document class. By applying one or the other of these
515: presentations to it, the document can be seen under different graphical
516: aspects. It must be emphasized that this type of modification of the
517: presentation is not a change to the document itself (in its specific logical
518: structure or its content), but only in its appearance at the time of editing
519: or printing.</p>
1.18 cvs 520: </div>
1.1 cvs 521:
1.18 cvs 522: <div class="section">
1.37 cvs 523: <h2><a name="sectb24" id="sectb24">Document structures and object
524: structures</a></h2>
1.1 cvs 525:
1.30 cvs 526: <p>So far, we have only discussed the global structure of documents and have
1.37 cvs 527: not considered the contents found in that structure. We could limit ourselves
1.30 cvs 528: to purely textual contents by assuming that a title or a paragraph contains a
1.37 cvs 529: simple linear text. But this model would be too restrictive. In fact, certain
530: documents contain not only text, but also contain tables, diagrams,
531: photographs, mathematical formulas, and program fragments. The model must
1.18 cvs 532: permit the representation of such <em>objects</em>.</p>
1.30 cvs 533:
534: <p>Just as with the whole of the document, the model takes into account the
1.37 cvs 535: logical structure of objects of this type. Some are clearly structured,
536: others are less so. Logical structure can be recognized in mathematical
537: formulas, in tables, and in certain types of diagrams. On the other hand, it
538: is difficult to define the structure of a photograph or of some drawings. But
1.1 cvs 539: in any case, it does not seem possible to define one unique structure which
1.37 cvs 540: can represent every one of these types of objects. The approach taken in the
1.1 cvs 541: definition of meta-structure and document classes also applies to objects.
542: Object classes can be defined which put together objects of similar type,
1.18 cvs 543: constructed from the same generic logical structure.</p>
1.30 cvs 544:
545: <p>Thus, a mathematical class can be defined and have a generic logical
1.37 cvs 546: structure associated with it. But even if a single generic structure can
1.30 cvs 547: represent a sufficient variety of mathematical formulas, for other objects
1.37 cvs 548: with less rigorous structure, multiple classes must be defined. As for
549: documents, using multiple classes assures that the model can describe the
550: full range of objects to be presented. It also permits the system to support
551: objects which were not initially anticipated. Moreover, this comment applies
1.30 cvs 552: equally to mathematics: different classes of formulas can be described
553: depending on the domain of mathematics being described.</p>
554:
555: <p>Since objects have the same level of logical representation as documents,
1.37 cvs 556: they gain the same advantages. In particular, it is possible to define the
1.1 cvs 557: presentation separately from the objects themselves and attach it to the
1.37 cvs 558: class. Thus, as for documents, objects of the same type have a uniform
1.1 cvs 559: presentation and the presentation of every object in a given class can be
1.37 cvs 560: changed simply by changing the generic presentation of the class. Another
1.1 cvs 561: advantage of using this document model is that the system does not bother the
562: user with the details of presentation, but rather allows the user to
1.18 cvs 563: concentrate on the logical aspect of the document and the objects.</p>
1.30 cvs 564:
565: <p>It is clear that the documents in a class do not necessarily use the same
1.1 cvs 566: classes of objects: one technical report will contain tables while another
567: report will have no tables but will use mathematical formulas. The usable
1.2 cvs 568: object classes are not always mentioned in a limiting way in the generic
1.37 cvs 569: logical structure of documents. Rather, they can be chosen freely from a
1.18 cvs 570: large set, independent of the document class.</p>
1.30 cvs 571:
572: <p>Thus, the object classes will be made commonplace and usable in every
1.1 cvs 573: document. The notion of ``object'' can be enlarged to include not only
574: non-textual elements, but also certain types of textual elements which can
1.37 cvs 575: appear in practically every document, whatever their class. Among these
1.2 cvs 576: textual elements, one can mention enumerations, descriptions, examples,
1.18 cvs 577: quotations, even paragraphs.</p>
1.30 cvs 578:
579: <p>Thus, the document model is not a single, general model describing every
1.37 cvs 580: type of document in one place. Rather, it is a meta-model which can be used
1.30 cvs 581: to describe many different models each of which represents either a class of
1.1 cvs 582: similar documents or a class of similar objects which every document can
1.18 cvs 583: include.</p>
584: </div>
1.37 cvs 585: <hr />
1.18 cvs 586: </div>
1.1 cvs 587:
1.18 cvs 588: <div class="chapter">
1.37 cvs 589: <h1><a name="sect3" id="sect3">The S language</a></h1>
1.1 cvs 590:
1.18 cvs 591: <div class="section">
1.37 cvs 592: <h2><a name="sectb31" id="sectb31">Document meta-structure</a></h2>
1.1 cvs 593:
1.30 cvs 594: <p>Since the concept of meta-structure is well suited to the task of
595: describing documents at a high level of abstraction, this meta-structure must
1.37 cvs 596: be precisely defined. Toward that end this section first presents the basic
1.1 cvs 597: elements from which documents and structured objects are composed and then
1.37 cvs 598: specifies the ways in which these basic elements are assembled into
599: structures representing complete documents and objects.</p>
1.1 cvs 600:
1.18 cvs 601: <div class="subsection">
1.37 cvs 602: <h3><a name="sectc311" id="sectc311">The basic types</a></h3>
1.1 cvs 603:
1.37 cvs 604: <p>At the lowest level of a document's structure, the first atom considered
605: is the character. However, since characters are seldom isolated, usually
1.1 cvs 606: appearing as part of a linear sequence, and in order to reduce the complexity
1.18 cvs 607: of the document structure, <em>character strings</em> are used as atoms and
1.37 cvs 608: consecutive characters belonging to the same structural element are grouped
609: in the same character string.</p>
1.30 cvs 610:
1.37 cvs 611: <p>If the structure of a document is not refined to go down to the level of
612: words or phrases, the contents of a simple paragraph can be considered to be
613: a single character string. On the other hand, the title of a chapter, the
614: title of the first section of that chapter, and the text of the first
615: paragraph of that section constitute three different character strings,
616: because they belong to distinct structural elements.</p>
1.30 cvs 617:
618: <p>If, instead, a very fine-grained representation for the structure of a
1.1 cvs 619: document is sought, character strings could be defined to contain only a
1.37 cvs 620: single word, or even just a single character. This is the case, for example,
621: in programs, for which one wants to retain a structure very close to the
622: syntax of the programming language. In this case, an assignment statement
1.1 cvs 623: initializing a simple variable to zero would be composed of two structural
624: elements, the identifier of the variable (a short character string) and the
1.18 cvs 625: assigned value (a string of a single character, `0').</p>
1.30 cvs 626:
627: <p>The character string is not the only atom necessary for representing those
1.37 cvs 628: documents that interest us. It suffices for purely textual documents, but as
1.1 cvs 629: soon as the non-textual objects which we have considered arise, there must be
630: other atoms; the number of objects which are to be represented determines the
1.18 cvs 631: number of types of atoms that are necessary.</p>
1.30 cvs 632:
633: <p>Primitive <em>graphical elements</em> are used for tables and figures of
1.37 cvs 634: different types. These elements are simple geometric shapes like horizontal
1.1 cvs 635: or vertical lines, which are sufficient for tables, or even oblique lines,
1.2 cvs 636: arrows, rectangles, circles, polygons, and curves for use in figures. From
637: these elements and character strings, graphical objects and tables can be
1.18 cvs 638: constructed.</p>
1.30 cvs 639:
640: <p>Photographs, though having very little structure, must still appear in
1.37 cvs 641: documents. They are supported by <em>picture</em> elements, which are
1.18 cvs 642: represented as matrices of pixels.</p>
1.30 cvs 643:
644: <p>Finally, mathematical notations require certain elements which are
1.37 cvs 645: simultaneously characters and graphical elements, the <em>symbols</em>. By
646: way of example, radicals, integration signs, or even large parentheses are
647: examples of this type of atom. The size of each of these symbols is
1.1 cvs 648: determined by its environment, that is to say, by the expression to which it
1.18 cvs 649: is attached.</p>
1.30 cvs 650:
651: <p>To summarize, the primitive elements which are used in the construction of
1.18 cvs 652: documents and structured objects are:</p>
653: <ul>
1.30 cvs 654: <li>character strings,</li>
655: <li>graphical elements,</li>
656: <li>pictures,</li>
657: <li>and mathematical symbols.</li>
1.18 cvs 658: </ul>
659: </div>
1.1 cvs 660:
1.18 cvs 661: <div class="subsection">
1.37 cvs 662: <h3><a name="sectc312" id="sectc312">Constructed elements</a></h3>
1.30 cvs 663:
1.37 cvs 664: <p>A document is evidently formed from primitive elements. But the model of
665: Thot also proposes higher level elements. Thus, in a document composed of
666: several chapters, each chapter is an element, and in the chapters each
667: section is also an element, and so on. A document is thus an organized set of
1.30 cvs 668: elements.</p>
1.1 cvs 669:
1.37 cvs 670: <p>In a document there are different sorts of elements. Each element has a
671: <em>type</em> which indicates the role of the element within the document as
672: a whole. Thus, we have, for example, the chapter and section types. The
1.1 cvs 673: document is made up of typed elements: elements of the type chapter and
1.37 cvs 674: elements of the type section, among others, but also character string
675: elements and graphical elements: the primitive elements are typed elements
676: just as well. At the other extreme, the document itself is also considered to
677: be a typed element.</p>
1.30 cvs 678:
679: <p>The important difference between the primitive elements and the other
1.37 cvs 680: elements of the document is that the primitive elements are atoms (they
681: cannot be decomposed), whereas the others, called <em>constructed
682: elements</em>, are composed of other elements, which can either be primitive
683: elements or constructed elements. A constructed element of type chapter (or
684: more simply, ``a chapter'') is composed of sections, which are also
685: constructed elements. A paragraph, a constructed element, can be made up of
686: character strings, which are primitive elements, and of equations, which are
687: constructed elements.</p>
1.30 cvs 688:
1.37 cvs 689: <p>A document is also a constructed element. This is an important point. In
1.1 cvs 690: particular, it allows a document to be treated as part of another document,
691: and conversely, permits a part of a document to be treated as a complete
1.37 cvs 692: document. Thus, an article presented in a journal is treated by its author as
1.1 cvs 693: a document in itself, while the editor of the journal considers it to be part
1.37 cvs 694: of an issue. A table or a figure appearing in a document can be extracted and
1.1 cvs 695: treated as a complete document, for example to prepare transparencies for a
1.18 cvs 696: conference.</p>
1.30 cvs 697:
698: <p>These thoughts about types and constructed elements apply just as well to
1.37 cvs 699: objects as they do to documents. A table is a constructed element made up of
700: other constructed elements, rows and columns. A row is formed of cells, which
1.1 cvs 701: are also constructed elements which contain primitive elements (character
1.18 cvs 702: strings) and/or constructed elements like equations.</p>
703: </div>
1.1 cvs 704:
1.18 cvs 705: <div class="subsection">
1.37 cvs 706: <h3><a name="sectc313" id="sectc313">Logical structure constructors</a></h3>
1.1 cvs 707:
1.30 cvs 708: <p>Having defined the primitive elements and the constructed elements, it is
709: now time to define the types of organization which allow the building of
1.37 cvs 710: structures. For this, we rely on the notion of the <em>constructor</em>. A
711: constructor defines a way of assembling certain elements in a structure. It
1.1 cvs 712: resides at the level of the meta-structure: it does not describe the existing
1.37 cvs 713: relations in a given structure, but rather defines how elements are assembled
1.18 cvs 714: to build a structure that conforms to a model.</p>
1.30 cvs 715:
716: <p>In defining the overall organization of documents, the first two
717: constructors considered are the aggregate and the list.</p>
1.1 cvs 718:
1.18 cvs 719: <div class="subsubsection">
1.37 cvs 720: <h4><a name="sectd3131" id="sectd3131">Aggregate and List</a></h4>
1.1 cvs 721:
1.30 cvs 722: <p>The <em>aggregate</em> constructor is used to define constructed element
723: types which are collections of a given number of other elements. These
1.37 cvs 724: collections may or may not be ordered. The elements may be either constructed
725: or primitive and are specified by their type. A report (that is, a
726: constructed element of the report type) has an aggregate structure. It is
1.30 cvs 727: formed from a title, an author's name, an introduction, a body, and a
1.37 cvs 728: conclusion, making it a collection of five element types. This type of
1.30 cvs 729: constructor is found in practically every document, and generally at several
730: levels in a document.</p>
731:
732: <p>The <em>list</em> constructor is used to define constructed elements which
733: are ordered sequences of elements (constructed or primitive) having the same
734: type. The minimum and maximum numbers of elements for the sequence can be
735: specified in the list constructor or the number of elements can be left
736: unconstrained. The body of a report is a list of chapters and is typically
737: required to contain a minimum of two chapters (is a chapter useful if it is
738: the only one in the report?) The chapter itself can contain a list of
1.37 cvs 739: sections, each section containing a list of paragraphs. In the same way as
740: the aggregate, the list is a very frequently used constructor in every type
741: of document. However, these two constructors are not sufficient to describe
742: every document structure; thus other constructors supplement them.</p>
1.18 cvs 743: </div>
1.1 cvs 744:
1.18 cvs 745: <div class="subsubsection">
1.37 cvs 746: <h4><a name="sectd3132" id="sectd3132">Choice, Schema, and Unit</a></h4>
1.1 cvs 747:
1.30 cvs 748: <p>The <em>choice</em> constructor is used to define the structure of an
749: element type for which one alternative is chosen from several possibilities.
1.37 cvs 750: Thus, a paragraph can be either a simple text paragraph, or an enumeration,
751: or a citation.</p>
1.30 cvs 752:
753: <p>The choice constructor indicates the complete list of possible options,
754: which can be too restrictive in certain cases, the paragraph being one such
755: case. Two constructors, <em>unit</em> and <em>schema</em>, address this
1.37 cvs 756: inconvenience. They allow more freedom in the choice of an element type. If a
757: paragraph is defined by a schema constructor, it is possible to put in the
1.1 cvs 758: place of a paragraph a table, an equation, a drawing or any other object
1.37 cvs 759: defined by another generic logical structure. It is also possible to define a
1.1 cvs 760: paragraph as a sequence of units, which could be character strings, symbols,
1.37 cvs 761: or pictures. The choice constructor alone defines a generic logical structure
1.1 cvs 762: that is relatively constrained; in contrast, using units and schemas, a very
1.18 cvs 763: open structure can be defined.</p>
1.30 cvs 764:
765: <p>The <em>schema</em> constructor represents an object defined by a generic
1.18 cvs 766: logical structure chosen freely from among those available.</p>
1.30 cvs 767:
768: <p>The <em>unit</em> constructor represents an element whose type can be
769: either a primitive type or an element type defined as a unit in the generic
770: logical structure of the document, or in another generic logical structure
1.37 cvs 771: used in the document. Such an element may be used in document objects
1.30 cvs 772: constructed according to other generic structures.</p>
773:
774: <p>Thus, for example, if a cross-reference to a footnote is defined in the
1.37 cvs 775: generic logical structure ``Article'' as a unit, a table (an object defined
776: by another generic structure) can contain cross-references to footnotes, when
777: they appear in an article. In another type of document, a table defined by
1.1 cvs 778: the same generic structure can contain other types of elements, depending on
1.37 cvs 779: the type of document into which the table is inserted. All that is needed is
1.1 cvs 780: to declare, in the generic structure for tables, that the contents of cells
1.37 cvs 781: are units. In this way, the generic structure of objects is divided up
782: between different types of documents which are able to adapt themselves to
783: the environment into which they are inserted.</p>
1.18 cvs 784: </div>
1.1 cvs 785:
1.18 cvs 786: <div class="subsubsection">
1.37 cvs 787: <h4><a name="sectd3133" id="sectd3133">Reference and Inclusion</a></h4>
1.1 cvs 788:
1.30 cvs 789: <p>The <em>reference</em> is used to define document elements that are
1.18 cvs 790: cross-references to other elements, such as a section, a chapter, a
1.37 cvs 791: bibliographic citation, or a figure. The reference is bi-directional. It can
1.18 cvs 792: be used to access both the element being cross-referenced and each of the
793: elements which make use of the cross-reference.</p>
1.30 cvs 794:
1.37 cvs 795: <p>References can be either <em>internal</em> or <em>external</em>. That is,
1.1 cvs 796: they can designate elements which appear in the same document or in another
1.18 cvs 797: document.</p>
1.30 cvs 798:
1.37 cvs 799: <p>The <em><a name="inclusion" id="inclusion">inclusion</a></em> constructor
800: is a special type of reference. Like the reference, it is an internal or
801: external bidirectional link, but it is not a cross-reference. This link
802: represents the ``live'' inclusion of the designated element; it accesses the
803: most recent version of that element and not a ``dead'' copy, fixed in the
804: state in which it was found at the moment the copy was made. As soon as an
805: element is modified, all of its inclusions are automatically brought up to
806: date. It must be noted that, in addition to inclusion, Thot permits the
807: creation of ``dead'' copies.</p>
1.30 cvs 808:
809: <p>There are three types of inclusions: inclusions with full expansion,
1.1 cvs 810: inclusions with partial expansion, and inclusions without expansion. During
811: editing, inclusions without expansion are represented on the screen by the
812: name of the included document, in a special color, while inclusions with
1.37 cvs 813: expansion (full or partial) are represented by a copy (full or partial) of
814: the included element (also in a special color). The on-screen representation
815: of a partial inclusion is a <a href="#sectc3213">``skeleton''</a> image of
816: the included document.</p>
1.30 cvs 817:
818: <p>Inclusion with complete expansion can be used to include parts of the same
1.37 cvs 819: document or of other documents. Thus, it can be either an internal or an
820: external link. It can be used to include certain bibliographic entries of a
1.1 cvs 821: scientific article in another article, or to copy part of a mathematical
822: formula into another formula of the same document, thus assuring that both
1.18 cvs 823: copies will remain synchronized.</p>
1.30 cvs 824:
825: <p>Inclusion without expansion or with partial expansion is used to include
1.37 cvs 826: complete documents. It is always an external link. It is used primarily to
1.1 cvs 827: divide very large documents into sub-documents that are easier to manipulate,
1.37 cvs 828: especially when there are many authors. So, a book can include some chapters,
1.1 cvs 829: where each chapter is a different document which can be edited separately.
830: When viewing the book on the screen, it might be desirable to see only the
1.37 cvs 831: titles of the chapters and sections. This can be achieved using inclusion
1.18 cvs 832: with partial expansion.</p>
1.30 cvs 833:
1.37 cvs 834: <p>During printing, inclusions without expansion or with partial expansion
835: can be represented either as they were shown on the screen or by a complete
836: (and up-to-date) copy of the included element or document.</p>
1.30 cvs 837:
838: <p>The inclusion constructor, whatever its type, respects the generic
839: structure: only those elements authorized by the generic structure can be
840: included at a given position in a document.</p>
1.18 cvs 841: </div>
1.1 cvs 842:
1.18 cvs 843: <div class="subsubsection">
1.37 cvs 844: <h4><a name="sectd3134" id="sectd3134">Mark pairs</a></h4>
1.1 cvs 845:
1.30 cvs 846: <p>It is often useful to delimit certain parts of a document independently
1.37 cvs 847: from the logical structure. For example, one might wish to attach some
1.30 cvs 848: information (in the form of an <a href="#sectc315">attribute</a>) or a
849: particular treatment to a group of words or a set of consecutive paragraphs.
850: <em>Mark pairs</em> are used to do this.</p>
851:
852: <p>Mark pairs are elements which are always paired and are terminals in the
1.37 cvs 853: logical structure of the document. Their position in the structure of the
854: document is defined in the generic structure. It is important to note that
1.18 cvs 855: when the terminals of a mark pair are <em>extensions</em> (see the next
856: section), they can be used quite freely.</p>
857: </div>
1.1 cvs 858:
1.18 cvs 859: <div class="subsubsection">
1.37 cvs 860: <h4><a name="sectd3135" id="sectd3135">Restrictions and Extensions</a></h4>
1.1 cvs 861:
1.30 cvs 862: <p>The primitive types and the constructors presented so far permit the
1.1 cvs 863: definition of the logical structure of documents and objects in a rigorous
1.37 cvs 864: way. But this definition can be very cumbersome in certain cases, notably
1.1 cvs 865: when trying to constrain or extend the authorized element types in a
1.37 cvs 866: particular context. <em>Restrictions</em> and <em>extensions</em> are used to
1.18 cvs 867: cope with these cases.</p>
1.30 cvs 868:
869: <p>A restriction associates with a particular element type <em>A</em>, a list
1.37 cvs 870: of those element types which elements of type <em>A</em> may not contain,
871: even if the definition of type <em>A</em> and those of its components
872: authorize them otherwise. This simplifies the writing of generic logical
873: structures and allows limitations to be placed, when necessary, on the
874: choices offered by the schema and unit constructors.</p>
875:
876: <p>Extensions are the inverse of restrictions. They identify a list of
877: element types whose presence <em>is</em> permitted, even if its definition
878: and those of its components do not authorize them otherwise.</p>
1.18 cvs 879: </div>
880:
881: <div class="subsubsection">
1.37 cvs 882: <h4><a name="sectd3136" id="sectd3136">Summary</a></h4>
1.18 cvs 883:
1.30 cvs 884: <p>Thus, four constructors are used to construct a document:</p>
1.18 cvs 885: <ul>
1.30 cvs 886: <li>the aggregate constructor (ordered or not),</li>
887: <li>the list constructor,</li>
888: <li>the choice constructor and its extensions, the unit and schema
889: constructors,</li>
890: <li>the reference constructor and its variant, the inclusion.</li>
891: </ul>
892:
1.37 cvs 893: <p>These constructors are also sufficient for objects. Thus, these
1.30 cvs 894: constructors provide a homogenous meta-model which can describe both the
895: organization of the document as a whole and that of the various types of
1.37 cvs 896: objects which it contains. After presenting the description language for
1.30 cvs 897: generic structures, we will present several examples which illustrate the
898: appropriateness of the model.</p>
899:
1.37 cvs 900: <p>The first three constructors (aggregate, list and choice) lead to
901: tree-like structures for documents and objects, the objects being simply the
902: subtrees of the tree of a document (or even of other objects' subtrees). The
903: reference constructor introduces other, non-hierarchical, relations which
904: augment those of the tree: when a paragraph makes reference to a chapter or a
905: section, that relation leaves the purely tree-like structure. Moreover,
906: external reference and inclusion constructors permit the establishment of
907: links between different documents, thus creating a hypertext structure.</p>
1.18 cvs 908: </div>
909: </div>
1.1 cvs 910:
1.18 cvs 911: <div class="subsection">
1.37 cvs 912: <h3><a name="sectc315" id="sectc315">Attributes</a></h3>
1.1 cvs 913:
1.30 cvs 914: <p>There remain logical aspects of documents that are not entirely described
1.37 cvs 915: by the structure. Certain types of semantic information, which are not stated
916: explicitly in the text, must also be taken into account. In particular, such
1.1 cvs 917: information is shown by typographic effects which do not correspond to a
1.37 cvs 918: change between structural elements. In fact, certain titles are set in bold
1.1 cvs 919: or italic or are printed in a different typeface from the rest of the text in
1.37 cvs 920: order to mark them as structurally distinct. But these same effects
1.1 cvs 921: frequently appear in the middle of continuous text (e.g. in the interior of a
1.37 cvs 922: paragraph). In this case, there is no change between structural elements; the
923: effect serves to highlight a word, expression, or phrase. The notion of an
1.18 cvs 924: <em>attribute</em> is used to express this type of information.</p>
1.30 cvs 925:
926: <p>An attribute is a piece of information attached to a structural element
927: which augments the type of the element and clarifies its function in the
928: document. Keywords, foreign language words, and titles of other works can all
1.37 cvs 929: be represented by character strings with attached attributes. Attributes may
930: also be attached to constructed elements. Thus, an attribute indicating the
1.1 cvs 931: language can be attached to a single word or to a large part of a
1.18 cvs 932: document.</p>
1.30 cvs 933:
934: <p>In fact, an attribute can be any piece of information which is linked to a
1.37 cvs 935: part of a document and which can be used by agents which work on the
936: document. For example, the language in which the document is written
937: determines the set of characters used by an editor or formatter. It also
938: determines the algorithm or hyphenation dictionary to be used. The attribute
939: ``keyword'' facilitates the work of an information retrieval system. The
940: attribute ``index word'' allows a formatter to automatically construct an
941: index at the end of the document.</p>
1.30 cvs 942:
943: <p>As with the types of constructed elements, the attributes and the values
1.37 cvs 944: they can take are defined separately in each generic logical structure, not
945: in the meta-model, according to the needs of the document class or the nature
946: of the object.</p>
1.30 cvs 947:
948: <p>Many types of attributes are offered: numeric, textual, references, and
1.18 cvs 949: enumerations:</p>
950: <ul>
1.39 ! cvs 951: <li><em>Numeric attributes</em>
! 952: can take integer values (negative, positive, or null).</li>
! 953: <li><em>Textual attributes</em>
! 954: have as their values character strings.</li>
! 955: <li><em>Reference attributes</em>
! 956: designate an element of the logical structure.</li>
! 957: <li><em>Enumeration attributes</em>
! 958: can take one value from a limited list of possible values, each value
! 959: being a name.</li>
1.18 cvs 960: </ul>
1.30 cvs 961:
962: <p>In a generic structure, there is a distinction between <em>global
1.37 cvs 963: attributes</em> and <em>local attributes</em>. A global attribute can be
1.1 cvs 964: applied to every element type defined in the generic structure where it is
1.37 cvs 965: specified. In contrast, a local attribute can only be applied to certain
966: types of elements, even only a single type. The ``language'' attribute
967: presented above is an example of a global attribute. An example of a local
1.1 cvs 968: attribute is the rank of an author (principal author of the document or
969: secondary author): this attribute can only be applied sensibly to an element
1.18 cvs 970: of the ``author'' type.</p>
1.30 cvs 971:
972: <p>Attributes can be assigned to the elements which make up the document in
1.37 cvs 973: many different ways. The author can freely and dynamically place them on any
1.30 cvs 974: part of the document in order to attach supplementary information of his/her
1.18 cvs 975: choice. However, attributes may only be assigned in accordance with the rules
1.37 cvs 976: of the generic structure; in particular, local attributes can only be
977: assigned to those element types for which they are defined.</p>
1.30 cvs 978:
979: <p>In the generic structure, certain local attributes can be made mandatory
1.37 cvs 980: for certain element types. In this case, Thot automatically associates the
981: attribute with the elements of this type and it requires the user to provide
982: a value for this attribute.</p>
983:
984: <p>Attributes can also be automatically assigned, with a given value, by
985: every application processing the document in order to systematically add a
986: piece of information to certain predefined elements of the document. By way
987: of example, in a report containing a French abstract and an English abstract,
988: each of the two abstracts is defined as a sequence of paragraphs. The first
1.1 cvs 989: abstract has a value of ``French'' for the ``language'' attribute while the
1.18 cvs 990: second abstract's ``language'' attribute has a value of ``English''.</p>
1.30 cvs 991:
992: <p>In the case of mark pairs, attributes are logically associated with the
993: pair as a whole, but are actually attached to the first mark.</p>
1.18 cvs 994: </div>
1.1 cvs 995:
1.18 cvs 996: <div class="subsection">
1.37 cvs 997: <h3><a name="sectc316" id="sectc316">Discussion of the model</a></h3>
1.1 cvs 998:
1.37 cvs 999: <p>The notions of attribute, constructor, and structured element are used in
1000: the definition of generic logical structures of documents and objects. The
1001: problem is to assemble them to form generic structures. In fact, many types
1002: of elements and attributes can be found in a variety of generic structures.
1003: Rather than redefine them for each structure in which they appear, it is best
1004: to share them between structures. The object classes already fill this
1005: sharing function. If a mathematical class is defined, its formulas can be
1006: used in many different document classes, without redefining the structure of
1007: each class. This problem arises not only for the objects considered here; it
1008: also arises for the commonplace textual elements found in many document
1009: classes. This is the reason why the notion of object is so broad and why
1010: paragraphs and enumerations are also considered to be objects. These object
1011: classes not only permit the sharing of the structures of elements, but also
1012: of the attributes defined in the generic structures.</p>
1.30 cvs 1013:
1014: <p>Structure, such as that presented here, can appear very rigid, and it is
1.1 cvs 1015: possible to imagine that a document editing system based on this model could
1.37 cvs 1016: prove very constraining to the user. This is, in fact, a common criticism of
1017: syntax-directed editors. This defect can be avoided with Thot, primarily for
1.18 cvs 1018: three reasons:</p>
1019: <ul>
1.30 cvs 1020: <li>the generic structures are not fixed in the model itself,</li>
1021: <li>the model takes the dynamics of documents into account,</li>
1022: <li>the constructors offer great flexibility.</li>
1.18 cvs 1023: </ul>
1.30 cvs 1024:
1025: <p>When the generic structure of a document is not predefined, but rather is
1.1 cvs 1026: constructed specifically for each document class, it can be carefully adapted
1.37 cvs 1027: to the current needs. In cases where the generic structure is inadequate for
1.1 cvs 1028: a particular document of the class, it is always possible either to create a
1029: new class with a generic structure well suited to the new case or to extend
1.37 cvs 1030: the generic structure of the existing class to take into account the
1031: specifics of the document which poses the problem. These two solutions can
1032: also be applied to objects whose structures prove to be poorly designed.</p>
1.30 cvs 1033:
1034: <p>The model is sufficiently flexible to take into account all the phases of
1.37 cvs 1035: the life of the document. When a generic structure specifies that a report
1036: must contain a title, an abstract, an introduction, at least two chapters,
1037: and a conclusion, this means only that a report, <em>upon completion</em>,
1038: will have to contain all of these elements. When the author begins writing,
1039: none of these elements is present. Thot uses this model. Therefore, it
1040: tolerates documents which do not conform strictly to the generic structure of
1041: their class; it also considers the generic logical structure to be a way of
1042: helping the user in the construction of a complex document.</p>
1.30 cvs 1043:
1044: <p>In contrast, other applications may reject a document which does not
1.37 cvs 1045: conform strictly to its generic structure. This is, for example, what is done
1.30 cvs 1046: by compilers which refuse to generate code for a program which is not
1.37 cvs 1047: syntactically correct. This might also occur when using a document
1.18 cvs 1048: application for a report which does not have an abstract or title.</p>
1.30 cvs 1049:
1050: <p>The constructors of the document model bring a great flexibility to the
1.37 cvs 1051: generic structures. A choice constructor (and even more, a unit or schema
1052: constructor) can represent several, very different elements. The list
1053: constructor permits the addition of more elements of the same type. Used
1.1 cvs 1054: together, these two constructors permit any series of elements of different
1.37 cvs 1055: types. Of course, this flexibility can be reduced wherever necessary since a
1.1 cvs 1056: generic structure can limit the choices or the number of elements in a
1.18 cvs 1057: list.</p>
1.30 cvs 1058:
1059: <p>Another difficulty linked to the use of structure in the document model
1.37 cvs 1060: resides in the choice of the level of the structure. The structure of a
1.1 cvs 1061: discussion could be extracted from the text itself via linguistic analysis.
1062: Some studies are exploring this approach, but the model of Thot excludes this
1.37 cvs 1063: type of structure. It only takes into account the logical structure provided
1.18 cvs 1064: explicitly by the author.</p>
1.30 cvs 1065:
1.37 cvs 1066: <p>However, the level of structure of the model is not imposed. Each generic
1067: structure defines its own level of structure, adapted to the document class
1068: or object and to the ways in which it will be processed. If it will only be
1069: edited and printed, a relatively simple structure suffices. If more
1070: specialized processing will be applied to it, the structure must represent
1071: the element types on which this processing must act. By way of example, a
1072: simple structure is sufficient for printing formulas, but a more complex
1073: structure is required to perform symbolic or numeric calculations on the
1074: mathematical expressions. The document model of Thot allows both types of
1075: structure.</p>
1.18 cvs 1076: </div>
1077: </div>
1.1 cvs 1078:
1.18 cvs 1079: <div class="section">
1.37 cvs 1080: <h2><a name="sectb32" id="sectb32">The definition language for generic
1081: structures</a></h2>
1.1 cvs 1082:
1.37 cvs 1083: <p>Generic structures, which form the basis of the document model of Thot,
1084: are specified using a special language. This definition language, called S,
1085: is described in this section.</p>
1.30 cvs 1086:
1087: <p>Each generic structure, which defines a class of documents or objects, is
1.2 cvs 1088: specified by a file, written in the S language, which is called a
1.37 cvs 1089: <em>structure schema</em>. Structure schemas are compiled into tables, called
1.18 cvs 1090: structure tables, which are used by Thot and which determine its behavior.</p>
1.1 cvs 1091:
1.18 cvs 1092: <div class="subsection">
1.37 cvs 1093: <h3><a name="sectc321" id="sectc321">Writing Conventions</a></h3>
1.1 cvs 1094:
1.30 cvs 1095: <p>The grammar of S, like those of the languages P and T presented later, is
1.1 cvs 1096: described using the meta-language M, derived from the Backus-Naur Form
1.18 cvs 1097: (BNF).</p>
1.30 cvs 1098:
1099: <p>In this meta-language each rule of the grammar is composed of a grammar
1.37 cvs 1100: symbol followed by an equals sign (`=') and the right part of the rule. The
1.30 cvs 1101: equals sign plays the same role as the traditional `::=' of BNF: it indicates
1.37 cvs 1102: that the right part defines the symbol of the left part. In the right
1.30 cvs 1103: part,</p>
1.18 cvs 1104: <dl>
1.30 cvs 1105: <dt>concatenation</dt>
1106: <dd>is shown by the juxtaposition of symbols;</dd>
1107: <dt>character strings</dt>
1.37 cvs 1108: <dd>between apostrophes ' represent terminal symbols, that is, keywords
1109: in the language defined. Keywords are written here in upper-case
1110: letters, but can be written in any combination of upper and lower-case
1111: letters. For example, the keyword <tt>DEFPRES</tt> of S can also be
1112: written as <tt>defpres</tt> or <tt>DefPres</tt>.</dd>
1.30 cvs 1113: <dt>material between brackets</dt>
1114: <dd>(`[' and `]') is optional;</dd>
1115: <dt>material between angle brackets</dt>
1116: <dd>(`<' and `>') can be repeated many times or omitted;</dd>
1117: <dt>the slash</dt>
1.37 cvs 1118: <dd>(`/') indicates an alternative, a choice between the options
1119: separated by the slash character;</dd>
1.30 cvs 1120: <dt>the period</dt>
1121: <dd>marks the end of a rule;</dd>
1122: <dt>text between braces</dt>
1123: <dd>(`{' and `}') is simply a comment.</dd>
1.18 cvs 1124: </dl>
1.30 cvs 1125:
1126: <p>The M meta-language also uses the concepts of identifiers, strings, and
1.18 cvs 1127: integers:</p>
1128: <dl>
1.30 cvs 1129: <dt><tt>NAME</tt></dt>
1.37 cvs 1130: <dd>represents an identifier, a sequence of letters (upper or
1131: lower-case), digits, and underline characters (`_'), beginning with a
1132: letter. Also considered a letter is the sequence of characters
1133: `<tt>\nnn</tt>' where the letter <tt>n</tt> represents the ISO Latin-1
1134: code of the letter in octal. It is thus possible to use accented
1135: letters in identifiers. The maximum length of identifiers is fixed by
1136: the compiler. It is normally 31 characters.
1.30 cvs 1137: <p>Unlike keywords, upper and lower-case letters are distinct in
1138: identifiers. Thus, <tt>Title</tt>, <tt>TITLE</tt>, and <tt>title</tt>
1139: are considered different identifiers.</p>
1140: </dd>
1141: <dt><tt>STRING</tt></dt>
1.37 cvs 1142: <dd>represents a string. This is a string of characters delimited by
1143: apostrophes. If an apostrophe must appear in a string, it is doubled.
1144: As with identifiers, strings can contain characters represented by
1145: their octal code (after a backslash). As with apostrophes, if a
1146: backslash must appear in a string, it is doubled.</dd>
1.30 cvs 1147: <dt><tt>NUMBER</tt></dt>
1148: <dd>represents a positive integer or zero (without a sign), or said
1149: another way, a sequence of decimal digits.</dd>
1.18 cvs 1150: </dl>
1.30 cvs 1151:
1152: <p>The M language can be used to define itself as follows:</p>
1.18 cvs 1153: <pre>{ Any text between braces is a comment. }
1.30 cvs 1154: Grammar = Rule < Rule > 'END' .
1155: { The < and > signs indicate zero }
1.1 cvs 1156: { or more repetitions. }
1157: { END marks the end of the grammar. }
1158: Rule = Ident '=' RightPart '.' .
1159: { The period indicates the end of a rule }
1160: RightPart = RtTerminal / RtIntermed .
1161: { The slash indicates a choice }
1162: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
1163: { Right part of a terminal rule }
1.30 cvs 1164: RtIntermed = Possibility < '/' Possibility > .
1.1 cvs 1165: { Right part of an intermediate rule }
1.30 cvs 1166: Possibility = ElemOpt < ElemOpt > .
1167: ElemOpt = Element / '[' Element < Element > ']' /
1168: '<' Element < Element > '>' .
1.1 cvs 1169: { Brackets delimit optional parts }
1170: Element = Ident / KeyWord .
1171: Ident = NAME .
1172: { Identifier, sequence of characters }
1173: KeyWord = STRING .
1174: { Character string delimited by apostrophes }
1.18 cvs 1175: END</pre>
1176: </div>
1.1 cvs 1177:
1.18 cvs 1178: <div class="subsection">
1.37 cvs 1179: <h3><a name="sectc322" id="sectc322">Extension schemas</a></h3>
1.1 cvs 1180:
1.30 cvs 1181: <p>A structure schema defines the generic logical structure of a class of
1.1 cvs 1182: documents or objects, independent of the operations which can be performed on
1.37 cvs 1183: the documents. However, certain applications may require particular
1.1 cvs 1184: information to be represented by the structure for the documents that they
1.37 cvs 1185: operate on. Thus a document version manager will need to indicate in the
1186: document the parts which belong to one version or another. An indexing system
1.1 cvs 1187: will add highly-structured index tables as well as the links between these
1.18 cvs 1188: tables and the rest of the document.</p>
1.30 cvs 1189:
1190: <p>Thus, many applications need to extend the generic structure of the
1.37 cvs 1191: documents on which they operate to introduce new attributes or element types.
1192: These additions are specific to each application and must be able to be
1193: applied to any generic structure: users will want to manage versions or
1194: construct indices for many types of documents. Extension schemas fulfill this
1195: role: they define attributes, elements, units, etc., but they can only be
1196: used jointly with a structure schema that they complete. Otherwise, structure
1197: schemas can always be used without these extensions when the corresponding
1198: applications are not available.</p>
1.18 cvs 1199: </div>
1.1 cvs 1200:
1.18 cvs 1201: <div class="subsection">
1.37 cvs 1202: <h3><a name="sectc323" id="sectc323">The general organization of structure
1203: schemas</a></h3>
1.1 cvs 1204:
1.30 cvs 1205: <p>Every structure schema begins with the keyword <tt>STRUCTURE</tt> and ends
1.37 cvs 1206: with the keyword <tt>END</tt>. The keyword <tt>STRUCTURE</tt> is followed by
1.18 cvs 1207: the keyword <tt>EXTENSION</tt> in the case where the schema defines an
1.1 cvs 1208: extension, then by the name of the generic structure which the schema defines
1.37 cvs 1209: (the name of the document or object class). The name of the structure is
1.18 cvs 1210: followed by a semicolon.</p>
1.30 cvs 1211:
1212: <p>In the case of a complete schema (that is, a schema which is not an
1.1 cvs 1213: extension), the definition of the name of the structure is followed by the
1214: declarations of the default presentation schema, the global attributes, the
1.37 cvs 1215: structure rules, the units, the skeleton elements and the exceptions. Only
1216: the definition of the structure rules is required. Each series of
1217: declarations begins with a keyword: <tt>DEFPRES</tt>, <tt>ATTR</tt>,
1218: <tt>STRUCT</tt>, <tt>UNITS</tt>, <tt>EXPORT</tt>, <tt>EXCEPT</tt>.</p>
1.34 cvs 1219:
1220: <p>In the case of an extension schema, there are no skeleton elements and the
1221: <tt>STRUCT</tt> section is optional, while that section is required in a
1.37 cvs 1222: schema that is not an extension. On the other hand, extension schemas can
1223: contain an <tt>EXTENS</tt> section, which must not appear in a schema which
1224: is not an extension; this section defines the complements to attach to the
1225: rules found in the schema to which the extension will be added. The sections
1226: <tt>ATTR</tt>, <tt>STRUCT</tt>, and <tt>UNITS</tt> define new attributes, new
1227: elements, and new units which add their definitions to the principal
1228: schema.</p>
1.18 cvs 1229: <pre> StructSchema ='STRUCTURE' ElemID ';'
1.1 cvs 1230: 'DEFPRES' PresID ';'
1231: [ 'ATTR' AttrSeq ]
1232: 'STRUCT' RulesSeq
1233: [ 'UNITS' RulesSeq ]
1234: [ 'EXPORT' SkeletonSeq ]
1235: [ 'EXCEPT' ExceptSeq ]
1236: 'END' .
1.18 cvs 1237: ElemID = NAME .</pre>
1.30 cvs 1238:
1239: <p>or</p>
1.18 cvs 1240: <pre> ExtensSchema ='STRUCTURE' 'EXTENSION' ElemID ';'
1.1 cvs 1241: 'DEFPRES' PresID ';'
1242: [ 'ATTR' AttrSeq ]
1243: [ 'STRUCT' RulesSeq ]
1244: [ 'EXTENS' ExtensRuleSeq ]
1245: [ 'UNITS' RulesSeq ]
1246: [ 'EXCEPT' ExceptSeq ]
1247: 'END' .
1.18 cvs 1248: ElemID = NAME .</pre>
1249: </div>
1.1 cvs 1250:
1.18 cvs 1251: <div class="subsection">
1.37 cvs 1252: <h3><a name="sectc324" id="sectc324">The default presentation</a></h3>
1.1 cvs 1253:
1.37 cvs 1254: <p>It was shown <a href="#mulpres">above</a> that many different
1255: presentations are possible for documents and objects of the same class. The
1256: structure schema defines a preferred presentation for the class, called the
1257: <em>default presentation</em>. Like generic structures, presentations are
1258: described by programs, called <em>presentation schemas</em>, which are
1259: written in a specific language, P, presented <a href="#sectb42">later</a> in
1260: this document. The name appearing after the keyword <tt>DEFPRES</tt> is the
1261: name of the default presentation schema. When a new document is created, Thot
1262: will use this presentation schema by default, but the user remains free to
1263: choose another if s/he wishes.</p>
1.18 cvs 1264: <pre> PresID = NAME .</pre>
1265: </div>
1.1 cvs 1266:
1.18 cvs 1267: <div class="subsection">
1.37 cvs 1268: <h3><a name="sectc325" id="sectc325">Global Attributes</a></h3>
1.1 cvs 1269:
1.30 cvs 1270: <p>If the generic structure includes global attributes of its own, they are
1.37 cvs 1271: declared after the keyword <tt>ATTR</tt>. Each global attribute is defined by
1272: its name, followed by an equals sign and the definition of its type. The
1.18 cvs 1273: declaration of a global attribute is terminated by a semi-colon.</p>
1.30 cvs 1274:
1275: <p>For attributes of the numeric, textual, or reference types, the type is
1.37 cvs 1276: indicated by a keyword, <tt>INTEGER</tt>, <tt>TEXT</tt>, or
1277: <tt>REFERENCE</tt> respectively.</p>
1.30 cvs 1278:
1279: <p>In the case of a reference attribute, the keyword <tt>REFERENCE</tt> is
1.37 cvs 1280: followed by the type of the referenced element in parentheses. It can refer
1.18 cvs 1281: to any type at all, specified by using the keyword <tt>ANY</tt>, or to a
1.37 cvs 1282: specific type. In the latter case, the element type designated by the
1.18 cvs 1283: reference can be defined either in the <a href="#sectc327"><tt>STRUCT</tt>
1284: section</a> of the same structure schema or in the <tt>STRUCT</tt> section of
1.37 cvs 1285: another structure schema. When the type is defined in another schema, the
1.1 cvs 1286: element type is followed by the name of the structure schema (within
1.37 cvs 1287: parentheses) in which it is defined. The name of the designated element type
1.18 cvs 1288: can be preceded by the keyword <tt>First</tt> or <tt>Second</tt>, but only in
1.37 cvs 1289: the case where the type is defined as <a href="#sectd3285">a pair</a>. These
1.1 cvs 1290: keywords indicate whether the attribute must designate the first mark of the
1.37 cvs 1291: pair or the second. If the reference refers to a pair and neither of these
1.18 cvs 1292: two keywords is present, then the first mark is used.</p>
1.30 cvs 1293:
1.37 cvs 1294: <p>In the case of an enumeration attribute, the equals sign is followed by
1295: the list of names representing the possible values of the attribute, the
1296: names being separated from each other by commas. An enumeration attribute has
1297: at least one possible value; the maximum number of values is defined by the
1.18 cvs 1298: compiler for the S language.</p>
1.30 cvs 1299: <pre> AttrSeq = Attribute < Attribute > .
1.1 cvs 1300: Attribute = AttrID '=' AttrType ';' .
1301: AttrType = 'INTEGER' / 'TEXT' /
1302: 'REFERENCE' '(' RefType ')' /
1303: ValueSeq .
1304: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .
1305: FirstSec = 'First' / 'Second' .
1306: ExtStruct = '(' ElemID ')' .
1.30 cvs 1307: ValueSeq = AttrVal < ',' AttrVal > .
1.1 cvs 1308: AttrID = NAME .
1.18 cvs 1309: AttrVal = NAME .</pre>
1.30 cvs 1310:
1311: <p>There is a predefined global text attribute, the <em>language</em>, which
1.37 cvs 1312: is automatically added to every Thot structure schema. This attribute allows
1313: Thot to perform certain actions, such as hyphenation and spell-checking,
1314: which cannot be performed without knowing the language in which each part of
1315: the document is written. This attribute can be used just like any explicitly
1.18 cvs 1316: declared attribute: the system acts as if every structure schema contains</p>
1317: <pre>ATTR
1318: Language = TEXT;</pre>
1.30 cvs 1319:
1.18 cvs 1320: <blockquote class="example">
1.30 cvs 1321: <p><strong>Example:</strong></p>
1322:
1323: <p>The following specification defines the global enumeration attribute
1324: WordType.</p>
1325: <pre>ATTR
1.18 cvs 1326: WordType = Definition, IndexWord, DocumentTitle;</pre>
1327: </blockquote>
1328: </div>
1.1 cvs 1329:
1.18 cvs 1330: <div class="subsection">
1.37 cvs 1331: <h3><a name="sectc327" id="sectc327">Structured elements</a></h3>
1.1 cvs 1332:
1.30 cvs 1333: <p>The rules for defining structured elements are required, except in an
1.1 cvs 1334: extension schema: they constitute the core of a structure schema, since they
1335: define the structure of the different types of elements that occur in a
1.18 cvs 1336: document or object of the class defined by the schema.</p>
1.30 cvs 1337:
1338: <p>The first structure rule after the keyword <tt>STRUCT</tt> must define the
1.1 cvs 1339: structure of the class whose name appears in the first instruction
1.37 cvs 1340: (<tt>STRUCTURE</tt>) of the schema. This is the root rule of the schema,
1.18 cvs 1341: defining the root of the document tree or object tree.</p>
1.30 cvs 1342:
1343: <p>The remaining rules may be placed in any order, since the language permits
1.37 cvs 1344: the definition of element types before or after their use, or even in the
1345: same instruction in which they are used. This last case allows the definition
1346: of recursive structures.</p>
1.30 cvs 1347:
1348: <p>Each rule is composed of a name (the name of the element type whose
1349: structure is being defined) followed by an equals sign and a structure
1350: definition.</p>
1351:
1.37 cvs 1352: <p>If any local attributes are associated with the element type defined by
1353: the rule, they appear between parentheses after the type name and before the
1354: equals sign. The parentheses contain, first, the keyword <tt>ATTR</tt>, then
1355: the list of local attributes, separated by commas. Each local attribute is
1.2 cvs 1356: composed of the name of the attribute followed by an equals sign and the
1.18 cvs 1357: definition of the attribute's type, just as in the definition of <a
1.37 cvs 1358: href="#sectc325">global attributes</a>. The name of the attribute can be
1359: preceded by an exclamation point to indicate that the attribute must always
1360: be present for this element type. The same attribute, identified by its name,
1361: can be defined as a local attribute for multiple element types. In this case,
1362: the equals sign and definition of the attribute type need only appear in the
1363: first occurrence of the attribute. It should be noted that global attributes
1364: cannot also be defined as local attributes.</p>
1.30 cvs 1365:
1366: <p>If any <a href="#sectd3135">extensions</a> are defined for this element
1367: type, a plus sign follows the structure definition and the names of the
1.37 cvs 1368: extension element types appear between parentheses after the plus. If there
1369: are multiple extensions, they are separated by commas. These types can either
1.30 cvs 1370: be defined in the same schema, defined in other schemas, or they may be base
1.18 cvs 1371: types identified by the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>,
1372: <tt>SYMBOL</tt>, or <tt>PICTURE</tt>.</p>
1.30 cvs 1373:
1374: <p><a href="#sectd3135">Restrictions</a> are indicated in the same manner as
1.18 cvs 1375: extensions, but they are introduced by a minus sign and they come after the
1376: extensions, or if there are no extensions, after the structure definition.</p>
1.30 cvs 1377:
1.37 cvs 1378: <p>If the values of attributes must be attached systematically to this
1379: element type, they are introduced by the keyword <tt>WITH</tt> and declared
1380: in the form of a list of fixed-value attributes. When such definitions of
1381: fixed attribute values appear, they are always the last part of the rule.</p>
1.30 cvs 1382:
1383: <p>The rule is terminated by a semicolon.</p>
1384: <pre> RuleSeq = Rule < Rule > .
1.1 cvs 1385: Rule = ElemID [ LocAttrSeq ] '=' DefWithAttr ';'.
1.30 cvs 1386: LocAttrSeq = '(' 'ATTR' LocAttr < ';' LocAttr > ')' .
1.1 cvs 1387: LocAttr = [ '!' ] AttrID [ '=' AttrType ] .
1388: DefWithAttr = Definition
1389: [ '+' '(' ExtensionSeq ')' ]
1390: [ '-' '(' RestrictSeq ')' ]
1391: [ 'WITH' FixedAttrSeq ] .
1.30 cvs 1392: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
1.1 cvs 1393: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
1394: 'SYMBOL' / 'PICTURE' .
1.30 cvs 1395: RestrictSeq = RestrictElem < ',' RestrictElem > .
1.1 cvs 1396: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
1.18 cvs 1397: 'SYMBOL' / 'PICTURE' .</pre>
1.30 cvs 1398:
1399: <p>The list of fixed-value attributes is composed of a sequence of
1.37 cvs 1400: attribute-value pairs separated by commas. Each pair contains the name of the
1.1 cvs 1401: attribute and the fixed value for this element type, the two being separated
1.37 cvs 1402: by an equals sign. If the sign is preceded by a question mark the given value
1.1 cvs 1403: is only an initial value that may be modified later rather than a value fixed
1.37 cvs 1404: for all time. Reference attributes are an exception to this norm. They cannot
1405: be assigned a fixed value, but when the name of such an attribute appears
1406: this indicates that this element type must have a valid value for the
1407: attribute. For the other attribute types, the fixed value is indicated by a
1.1 cvs 1408: signed integer (numeric attributes), a character string between apostrophes
1.18 cvs 1409: (textual attributes) or the name of a value (enumeration attributes).</p>
1.30 cvs 1410:
1411: <p>Fixed-value attributes can either be <a href="#sectc325">global</a> or
1412: local to the element type for which they are fixed, but they must be declared
1413: before they are used.</p>
1414: <pre> FixedAttrSeq = FixedAttr < ',' FixedAttr > .
1.1 cvs 1415: FixedAttr = AttrID [ FixedOrModifVal ] .
1416: FixedOrModifVal = [ '?' ] '=' FixedValue .
1417: FixedValue = [ '-' ] NumValue / TextVal / AttrVal .
1418: NumValue = NUMBER .
1.18 cvs 1419: TextVal = STRING .</pre>
1420: </div>
1.1 cvs 1421:
1.18 cvs 1422: <div class="subsection">
1.37 cvs 1423: <h3><a name="sectc328" id="sectc328">Structure definitions</a></h3>
1.1 cvs 1424:
1.37 cvs 1425: <p>The structure of an element type can be a simple base type or a
1426: constructed type.</p>
1.30 cvs 1427:
1428: <p>For constructed types, it is frequently the case that similar structures
1.37 cvs 1429: appear in many places in a document. For example the contents of the
1.1 cvs 1430: abstract, of the introduction, and of a section can have the same structure,
1.37 cvs 1431: that of a sequence of paragraphs. In this case, a single, common structure
1.1 cvs 1432: can be defined (the paragraph sequence in this example), and the schema is
1433: written to indicate that each element type possesses this structure, as
1.18 cvs 1434: follows:</p>
1435: <pre> Abstract = Paragraph_sequence;
1.1 cvs 1436: Introduction = Paragraph_sequence;
1.18 cvs 1437: Section_contents = Paragraph_sequence;</pre>
1.30 cvs 1438:
1439: <p>The equals sign means ``has the same structure as''.</p>
1440:
1.37 cvs 1441: <p>If the element type defined is a simple base type, this is indicated by
1442: one of the keywords <tt>TEXT</tt>, <tt>GRAPHICS</tt>, <tt>SYMBOL</tt>, or
1443: <tt>PICTURE</tt>. If some local attributes must be associated with a base
1444: type, the keyword of the base type is followed by the declaration of the
1445: local attributes using the syntax <a href="#sectc327">presented above.</a></p>
1.30 cvs 1446:
1447: <p>In the case of an open choice, the type is indicated by the keyword
1.18 cvs 1448: <tt>UNIT</tt> for units or the keyword <tt>NATURE</tt> for objects having a
1449: structure defined by any other schema.</p>
1.30 cvs 1450:
1451: <p>A unit represents one of the two following categories:</p>
1.18 cvs 1452: <ul>
1.30 cvs 1453: <li>a base type: text, graphical element, symbol, picture,</li>
1.37 cvs 1454: <li>an element whose type is chosen from among the types defined as units
1455: in the <tt>UNITS</tt> section of the document's structure schema. It can
1.30 cvs 1456: also be chosen from among the types defined as <a
1457: href="#sectd3132">units</a> in the <a href="#sectc3212"><tt>UNITS</tt>
1458: section</a> of the structure schemas that defines the ancestors of the
1459: element to which the rule is applied.</li>
1.18 cvs 1460: </ul>
1.30 cvs 1461:
1462: <p>Before the creation of an element defined as a unit, Thot asks the user to
1.18 cvs 1463: choose between the categories of elements.</p>
1.30 cvs 1464:
1465: <p>Thus, the contents of a paragraph can be specified as a sequence of units,
1.1 cvs 1466: which will permit the inclusion in the paragraphs of character strings,
1467: symbols, and various elements, such as cross-references, if these are defined
1.18 cvs 1468: as units.</p>
1.30 cvs 1469:
1.37 cvs 1470: <p>A schema object (keyword <tt>NATURE</tt>) represents an object defined by
1471: a structure schema freely chosen from among the available schemas; in the
1472: case the element type is defined by the first rule (the root rule) of the
1473: chosen schema.</p>
1.30 cvs 1474:
1475: <p>If the element type defined is a constructed type, the list, aggregate,
1.37 cvs 1476: choice, and reference constructors are used. In this case the definition
1477: begins with a keyword identifying the constructor. This keyword is followed
1.18 cvs 1478: by a syntax specific to each constructor.</p>
1.30 cvs 1479:
1480: <p>The local attribute definitions appear after the name of the element type
1.18 cvs 1481: being defined, if this element type has <a href="#sectc327">local
1482: attributes</a>.</p>
1483: <pre> Definition = BaseType [ LocAttrSeq ] / Constr / Element .
1.1 cvs 1484: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' / 'PICTURE' /
1485: 'UNIT' / 'NATURE' .
1486: Element = ElemID [ ExtOrDef ] .
1487: ExtOrDef = 'EXTERN' / 'INCLUDED' /
1488: [ LocAttrSeq ] '=' Definition .
1489: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
1490: '(' DefWithAttr ')' /
1491: 'BEGIN' DefOptSeq 'END' /
1492: 'AGGREGATE' DefOptSeq 'END' /
1493: 'CASE' 'OF' DefSeq 'END' /
1494: 'REFERENCE' '(' RefType ')' /
1.18 cvs 1495: 'PAIR' .</pre>
1.1 cvs 1496:
1.18 cvs 1497: <div class="subsubsection">
1.37 cvs 1498: <h4><a name="sectd3281" id="sectd3281">List</a></h4>
1.1 cvs 1499:
1.30 cvs 1500: <p>The list constructor permits the definition of an element type composed of
1.37 cvs 1501: a list of elements, all of the same type. A list definition begins with the
1.18 cvs 1502: <tt>LIST</tt> keyword followed by an optional range, the keyword <tt>OF</tt>,
1.1 cvs 1503: and the definition, between parentheses, of the element type which must
1.37 cvs 1504: compose the list. The optional range is composed of the minimum and maximum
1.1 cvs 1505: number of elements for the list separated by two periods and enclosed by
1.37 cvs 1506: brackets. If the range is not present, the number of list elements is
1507: unconstrained. When only one of the two bounds of the range is unconstrained,
1508: it is represented by a star ('*') character. Even when both bounds are
1509: unconstrained, they can be specified by <tt>[*..*]</tt>, but it is simpler
1510: not to specify any bound.</p>
1.18 cvs 1511: <pre> 'LIST' [ '[' min '..' max ']' ]
1.1 cvs 1512: 'OF' '(' DefWithAttr ')'
1513: min = Integer / '*' .
1514: max = Integer / '*' .
1.18 cvs 1515: Integer = NUMBER .</pre>
1.30 cvs 1516:
1517: <p>Before the document is edited, Thot creates the minimum number of elements
1.37 cvs 1518: for the list. If no minimum was given, it creates a single element. If a
1.30 cvs 1519: maximum number of elements is given and that number is attained, the editor
1520: refuses to create new elements for the list.</p>
1521:
1522: <blockquote class="example">
1523: <p><strong>Example:</strong></p>
1524:
1525: <p>The following two instructions define the body of a document as a
1526: sequence of at least two chapters and the contents of a section as a
1.37 cvs 1527: sequence of paragraphs. A single paragraph can be the entire contents of a
1.30 cvs 1528: section.</p>
1529: <pre>Body = LIST [2..*] OF (Chapter);
1.18 cvs 1530: Section_contents = LIST OF (Paragraph);</pre>
1531: </blockquote>
1532: </div>
1.1 cvs 1533:
1.18 cvs 1534: <div class="subsubsection">
1.37 cvs 1535: <h4><a name="sectd3282" id="sectd3282">Aggregate</a></h4>
1.1 cvs 1536:
1.37 cvs 1537: <p>The aggregate constructor is used to define an element type as a
1538: collection of sub-elements, each having a fixed type. The collection may be
1539: ordered or unordered. The elements composing the collection are called
1540: <em>components</em>. In the definition of an aggregate, a keyword indicates
1.18 cvs 1541: whether or not the aggregate is ordered: <tt>BEGIN</tt> for an ordered
1542: aggregate, <tt>AGGREGATE</tt> for an unordered aggregate. This keyword is
1.1 cvs 1543: followed by the list of component type definitions which is terminated by the
1.37 cvs 1544: <tt>END</tt> keyword. The component type definitions are separated by
1.18 cvs 1545: commas.</p>
1.30 cvs 1546:
1547: <p>Before creating an aggregate, the Thot editor creates all the aggregate's
1.1 cvs 1548: components in the order they appear in the structure schema, even for
1.37 cvs 1549: unordered aggregates. However, unlike ordered aggregates, the components of
1.1 cvs 1550: an unordered aggregate may be rearranged using operations of the Thot editor.
1551: The exceptions to the rule are any components whose name was preceded by a
1.37 cvs 1552: question mark character ('?'). These components, which are optional, can be
1.1 cvs 1553: created by explicit request, possibly at the time the aggregate is created,
1.18 cvs 1554: but they are not created automatically <em>prior</em> to the creation of the
1555: aggregate.</p>
1556: <pre> 'BEGIN' DefOptSeq 'END'
1.30 cvs 1557: DefOptSeq = DefOpt ';' < DefOpt ';' > .
1.18 cvs 1558: DefOpt = [ '?' ] DefWithAttr .</pre>
1.30 cvs 1559:
1.18 cvs 1560: <blockquote class="example">
1.30 cvs 1561: <p><strong>Example:</strong></p>
1562:
1563: <p>In a bilingual document, each paragraph has an English version and a
1.37 cvs 1564: French version. In certain cases, the translator wants to add a marginal
1565: note, but this note is present in very few paragraphs. Thus, it must not be
1566: created systematically for every paragraph. A bilingual paragraph of this
1.30 cvs 1567: type is declared:</p>
1568: <pre>Bilingual_paragraph = BEGIN
1.1 cvs 1569: French_paragraph = TEXT;
1570: English_paragraph = TEXT;
1571: ? Note = TEXT;
1.18 cvs 1572: END;</pre>
1573: </blockquote>
1574: </div>
1.1 cvs 1575:
1.18 cvs 1576: <div class="subsubsection">
1.37 cvs 1577: <h4><a name="sectd3283" id="sectd3283">Choice</a></h4>
1.1 cvs 1578:
1.30 cvs 1579: <p>The choice constructor permits the definition of an element type which is
1.37 cvs 1580: chosen from among a set of possible types. The keywords <tt>CASE</tt> and
1581: <tt>OF</tt> are followed by a list of definitions of possible types, which
1582: are separated by semicolons and terminated by the <tt>END</tt> keyword.</p>
1.18 cvs 1583: <pre> 'CASE' 'OF' DefSeq 'END'
1.30 cvs 1584: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .</pre>
1585:
1586: <p>Before the creation of an element defined as a choice, the Thot editor
1.37 cvs 1587: presents the list of possible types for the element to the user. The user has
1.18 cvs 1588: only to select the element type that s/he wants to create from this list.</p>
1.30 cvs 1589:
1.37 cvs 1590: <p>The order of the type declarations is important. It determines the order
1591: of the list presented to the user before the creation of the element. Also,
1.30 cvs 1592: when a Choice element is being created automatically, the first type in the
1.37 cvs 1593: list is used. In fact, using the Thot editor, when an empty Choice element is
1.1 cvs 1594: selected, it is possible to select this element and to enter its text from
1595: keyboard. In this case, the editor uses the first element type which can
1.18 cvs 1596: contain an atom of the character string type.</p>
1.30 cvs 1597:
1598: <p>The two special cases of the choice constructor, the <a
1.18 cvs 1599: href="#sectc328"><em>schema</em></a> and the <a
1600: href="#sectc3212"><em>unit</em></a> are discussed elsewhere.</p>
1.30 cvs 1601:
1.18 cvs 1602: <blockquote class="example">
1.30 cvs 1603: <p><strong>Example:</strong></p>
1604:
1605: <p>It is common in documents to treat a variety of objects as if they were
1.37 cvs 1606: ordinary paragraphs. Thus, a ``Paragraph'' might actually be composed of a
1.30 cvs 1607: block of text (an ordinary paragraph), or a mathematical formula whose
1608: structure is defined by another structure schema named Math, or a table,
1.37 cvs 1609: also defined by another structure schema. Here is a definition of such a
1.30 cvs 1610: paragraph:</p>
1611: <pre>Paragraph = CASE OF
1.1 cvs 1612: Simple_text = TEXT;
1613: Formula = Math;
1614: Table_para = Table;
1.18 cvs 1615: END;</pre>
1616: </blockquote>
1617: </div>
1.1 cvs 1618:
1.18 cvs 1619: <div class="subsubsection">
1.37 cvs 1620: <h4><a name="sectd3284" id="sectd3284">Reference</a></h4>
1.1 cvs 1621:
1.37 cvs 1622: <p>Like all elements in Thot, references are typed. An element type defined
1.30 cvs 1623: as a reference is a cross-reference to an element of some other given type.
1624: The keyword <tt>REFERENCE</tt> is followed by the name of a type enclosed in
1.37 cvs 1625: parentheses. When the type which is being cross-referenced is defined in
1.1 cvs 1626: another structure schema, the type name is itself followed by the name of the
1.18 cvs 1627: external structure schema in which it is defined.</p>
1.30 cvs 1628:
1629: <p>When the designated element type is a <a href="#sectd3285">mark pair</a>,
1.37 cvs 1630: it can be preceded by a <tt>FIRST</tt> or <tt>SECOND</tt> keyword. These
1.18 cvs 1631: keywords indicate whether the reference points to the first or second mark of
1632: the pair. If the reference points to a pair and neither of these two keywords
1633: is present, the reference is considered to point to the first mark of the
1634: pair.</p>
1.30 cvs 1635:
1.37 cvs 1636: <p>There is an exception to the principle of typed references: it is possible
1.30 cvs 1637: to define a reference which designates an element of any type, which can
1638: either be in the same document or another document. In this case, it suffices
1639: to put the keyword <tt>ANY</tt> in the parentheses which indicate the
1640: referenced element type.</p>
1.18 cvs 1641: <pre> 'REFERENCE' '(' RefType ')'
1642: RefType = 'ANY' / [ FirstSec ] ElemID [ ExtStruct ] .</pre>
1.30 cvs 1643:
1644: <p>When defining an inclusion, the <tt>REFERENCE</tt> keyword is not used.
1.1 cvs 1645: Inclusions with complete expansion are not declared as such in the structure
1.37 cvs 1646: schemas, since any element defined in a structure schema can be replaced by
1647: an element of the same type. Instead, inclusions without expansion or with
1.1 cvs 1648: partial expansion must be declared explicitly whenever they will include a
1.37 cvs 1649: complete object ( and not a part of an object). In this case, the object type
1.1 cvs 1650: to be included (that is, the name of its structure schema) is followed by a
1.37 cvs 1651: keyword: <tt>EXTERN</tt> for inclusion without expansion and
1652: <tt>INCLUDED</tt> for partial expansion.</p>
1.30 cvs 1653:
1.37 cvs 1654: <p>Before creating a cross-reference or an inclusion, the Thot editor asks
1655: the user to choose, from the document images displayed, the referenced or
1656: included element.</p>
1.30 cvs 1657:
1.18 cvs 1658: <blockquote class="example">
1.30 cvs 1659: <p><strong>Example:</strong></p>
1660:
1661: <p>If the types Note and Section are defined in the Article structure
1662: schema, it is possible to define, in the same structure schema, a reference
1663: to a note and a reference to a section in this manner:</p>
1664: <pre>Ref_note = REFERENCE (Note);
1.18 cvs 1665: Ref_section = REFERENCE (Section);</pre>
1.30 cvs 1666:
1667: <p>It is also possible to define the generic structure of a collection of
1668: articles, which include (with partial expansion) objects of the Article
1669: class and which possess an introduction which may include cross-references
1.37 cvs 1670: to sections of the included articles. In the Collection structure schema,
1.30 cvs 1671: the definitions are:</p>
1672: <pre>Collection = BEGIN
1.6 cvs 1673: Collection_title = TEXT;
1674: Introduction = LIST OF (Elem = CASE OF
1.1 cvs 1675: TEXT;
1676: Ref_sect;
1677: END);
1.6 cvs 1678: Body = LIST OF (Article INCLUDED);
1679: END;
1.18 cvs 1680: Ref_sect = REFERENCE (Section (Article));</pre>
1.30 cvs 1681:
1682: <p>Here we define a Folder document class which has a title and includes
1683: documents of different types, particularly Folders:</p>
1684: <pre>Folder = BEGIN
1.6 cvs 1685: Folder_title = TEXT;
1686: Folder_contents = LIST OF (Document);
1687: END;
1.1 cvs 1688:
1689: Document = CASE OF
1690: Article EXTERN;
1691: Collection EXTERN;
1692: Folder EXTERN;
1.18 cvs 1693: END;</pre>
1.30 cvs 1694:
1695: <p>Under this definition, Folder represents either an aggregate which
1696: contains a folder title and the list of included documents or an included
1.37 cvs 1697: folder. To resolve this ambiguity, in the P language, the placement of a
1.30 cvs 1698: star character in front of the type name (here, Folder) indicates an
1699: included document.</p>
1.18 cvs 1700: </blockquote>
1701: </div>
1.1 cvs 1702:
1.18 cvs 1703: <div class="subsubsection">
1.37 cvs 1704: <h4><a name="sectd3285" id="sectd3285">Mark pairs</a></h4>
1.1 cvs 1705:
1.37 cvs 1706: <p>Like other elements, mark pairs are typed. The two marks of the pair have
1707: the same type, but there exist two predefined subtypes which apply to all
1708: mark pairs: the first mark of the pair (called <tt>First</tt> in the P and T
1.18 cvs 1709: languages) and the second mark (called <tt>Second</tt>).</p>
1.30 cvs 1710:
1711: <p>In the S language, a mark pair is noted simply by the <tt>PAIR</tt>
1.18 cvs 1712: keyword.</p>
1.30 cvs 1713:
1.37 cvs 1714: <p>In the Thot editor, marks are always moved or destroyed together. The two
1.1 cvs 1715: marks of a pair have the same identifier, unique within the document, which
1.18 cvs 1716: permits intertwining mark pairs without risk of ambiguity.</p>
1717: </div>
1718: </div>
1.1 cvs 1719:
1.18 cvs 1720: <div class="subsection">
1.37 cvs 1721: <h3><a name="sectc329" id="sectc329">Imports</a></h3>
1.1 cvs 1722:
1.30 cvs 1723: <p>Because of schema constructors, it is possible, before editing a document,
1.37 cvs 1724: to use classes defined by other structure schemas whenever they are needed.
1725: It is also possible to assign specific document classes to certain element
1726: types. In this case, these classes are simply designated by their name. In
1727: fact, if a type name is not defined in the structure schema, it is assumed
1728: that it specifies a structure defined by another structure schema.</p>
1.30 cvs 1729:
1.18 cvs 1730: <blockquote class="example">
1.30 cvs 1731: <p><strong>Example:</strong></p>
1732:
1733: <p>If the types Math and Table don't appear in the left part of a structure
1734: rule in the schema, the following two rules indicate that a formula has the
1.37 cvs 1735: structure of an object defined by the structure schema Math and that a
1736: table element has the structure of an object defined by the Table
1737: schema.</p>
1.30 cvs 1738: <pre>Formula = Math;
1.18 cvs 1739: Table_elem = Table;</pre>
1740: </blockquote>
1741: </div>
1742:
1743: <div class="subsection">
1.37 cvs 1744: <h3><a name="sectc3210" id="sectc3210">Extension rules</a></h3>
1.18 cvs 1745:
1.30 cvs 1746: <p>The <tt>EXTENS</tt> section, which can only appear in an extension schema,
1.1 cvs 1747: defines complements to the rules in the primary schema (i.e. the structure
1748: schema to which the extension schema will be applied). More precisely, this
1749: section permits the addition to an existing type of local attributes,
1.18 cvs 1750: extensions, restrictions and fixed-value attributes.</p>
1.30 cvs 1751:
1752: <p>These additions can be applied to the root rule of the primary schema,
1.18 cvs 1753: designated by the keyword <tt>Root</tt>, or to any other explicitly named
1754: rule.</p>
1.30 cvs 1755:
1756: <p>Extension rules are separated from each other by a semicolon and each
1.18 cvs 1757: extension rule has the same syntax as a <a href="#sectc327">structure
1758: rule</a>, but the part which defines the constructor is absent.</p>
1.30 cvs 1759: <pre> ExtenRuleSeq = ExtensRule ';' < ExtensRule ';' > .
1.6 cvs 1760: ExtensRule = RootOrElem [ LocAttrSeq ]
1761: [ '+' '(' ExtensionSeq ')' ]
1762: [ '-' '(' RestrictSeq ')' ]
1763: [ 'WITH' FixedAttrSeq ] .
1.18 cvs 1764: RootOrElem = 'Root' / ElemID .</pre>
1765: </div>
1.1 cvs 1766:
1.18 cvs 1767: <div class="subsection">
1.37 cvs 1768: <h3><a name="sectc3212" id="sectc3212">Units</a></h3>
1.30 cvs 1769:
1770: <p>The <tt>UNITS</tt> section of the structure schema contains the
1771: declarations of the element types which can be used in the external objects
1772: making up parts of the document or in objects of the class defined by the
1.37 cvs 1773: schema. These element types are defined just like other structured element
1774: types. They can be used in the other element types of the schema, but they
1775: can also be used in any other rule of the schema.</p>
1.30 cvs 1776:
1777: <blockquote class="example">
1778: <p><strong>Example:</strong></p>
1.1 cvs 1779:
1.30 cvs 1780: <p>If references to notes are declared as units:</p>
1781: <pre>UNITS
1.18 cvs 1782: Ref_note = REFERENCE (Note);</pre>
1.30 cvs 1783:
1.37 cvs 1784: <p>then it is possible to use references to notes in a cell of a table,
1785: even when <tt>Table</tt> is an external structure schema. The
1786: <tt>Table</tt> schema must declare a cell to be a sequence of units, which
1787: can then be base element types (text, for example) or references to notes
1788: in the document.</p>
1.30 cvs 1789: <pre>Cell = LIST OF (UNITS);</pre>
1.18 cvs 1790: </blockquote>
1791: </div>
1.1 cvs 1792:
1.18 cvs 1793: <div class="subsection">
1.37 cvs 1794: <h3><a name="sectc3213" id="sectc3213">Skeleton elements</a></h3>
1.1 cvs 1795:
1.30 cvs 1796: <p>When editing a document which contains or must contain external references
1797: to several other documents, it may be necessary to load a large number of
1.1 cvs 1798: documents, simply to see the parts designated by the external references of
1.37 cvs 1799: the document while editing, or to access the source of included elements. In
1800: this case, the external documents are not modified and it is only necessary
1801: to see the elements of these documents which could be referenced. Because of
1.1 cvs 1802: this, the editor will suggest that the documents be loaded in ``skeleton''
1.37 cvs 1803: form. This form contains only the elements of the document explicitly
1.18 cvs 1804: mentioned in the <tt>EXPORT</tt> section of their structure schema and, for
1.1 cvs 1805: these elements, only the part of the contents specified in that section. This
1806: form has the advantage of being very compact, thus requiring very few
1.37 cvs 1807: resources from the editor. This is also the skeleton form which constitutes
1.18 cvs 1808: the expanded form of <a href="#inclusion">inclusions</a> with partial
1809: expansion.</p>
1.30 cvs 1810:
1811: <p>Skeleton elements must be declared explicitly in the <tt>EXPORT</tt>
1.37 cvs 1812: section of the structure schema that defines them. This section begins with
1.30 cvs 1813: the keyword <tt>EXPORT</tt> followed by a comma-separated list of the element
1.1 cvs 1814: types which must appear in the skeleton form and ending with a semicolon.
1.18 cvs 1815: These types must have been previously declared in the schema.</p>
1.30 cvs 1816:
1.37 cvs 1817: <p>For each skeleton element type, the part of the contents which is loaded
1818: by the editor, and therefore displayable, can be specified by putting the
1819: keyword <tt>WITH</tt> and the name of the contained element type to be loaded
1820: after the name of the skeleton element type. In this case only that named
1821: element, among all the elements contained in the exportable element type,
1822: will be loaded. If the <tt>WITH</tt> is absent, the entire contents of the
1823: skeleton element will be loaded by the editor. If instead, it is better that
1824: the skeleton form not load the contents of a particular element type, the
1825: keyword <tt>WITH</tt> must be followed by the word <tt>Nothing</tt>.</p>
1.18 cvs 1826: <pre> [ 'EXPORT' SkeletonSeq ]
1.1 cvs 1827:
1.30 cvs 1828: SkeletonSeq = SkelElem < ',' SkelElem > ';' .
1.1 cvs 1829: SkelElem = ElemID [ 'WITH' Contents ] .
1.18 cvs 1830: Contents = 'Nothing' / ElemID [ ExtStruct ] .</pre>
1.30 cvs 1831:
1.18 cvs 1832: <blockquote class="example">
1.30 cvs 1833: <p><strong>Example:</strong></p>
1834:
1835: <p>Suppose that, in documents of the article class, the element types
1836: Article_title, Figure, Section, Paragraph, and Biblio should appear in the
1837: skeleton form in order to make it easier to create external references to
1.37 cvs 1838: them from other documents. When loading an article in its skeleton form,
1.30 cvs 1839: all of these element types will be loaded except for paragraphs, but only
1.37 cvs 1840: the article title will be loaded in its entirety. For figures, the caption
1.30 cvs 1841: will be loaded, while for sections, the title will be loaded, and for
1.37 cvs 1842: bibliographic entries, only the title that they contain will be loaded.
1843: Note that bibliographic elements are defined in another structure schema,
1844: RefBib. To produce this result, the following declarations should be placed
1845: in the Article structure schema:</p>
1.30 cvs 1846: <pre>EXPORT
1.1 cvs 1847: Article_title,
1.5 cvs 1848: Figure With Caption,
1.1 cvs 1849: Section With Section_title,
1850: Paragraph With Nothing,
1.18 cvs 1851: Biblio With Biblio_title(RefBib);</pre>
1852: </blockquote>
1853: </div>
1.1 cvs 1854:
1.18 cvs 1855: <div class="subsection">
1.37 cvs 1856: <h3><a name="sectc3214" id="sectc3214">Exceptions</a></h3>
1.1 cvs 1857:
1.30 cvs 1858: <p>The behavior of the Thot editor and the actions that it performs are
1.37 cvs 1859: determined by the structure schemas. These actions are applied to all
1860: document and object types in accordance with their generic structure. For
1.1 cvs 1861: certain object types, such as tables and graphics, these actions are not
1862: sufficient or are poorly adapted and some special actions must be added to or
1.37 cvs 1863: substituted for certain standard actions. These special actions are called
1.18 cvs 1864: <em>exceptions</em>.</p>
1.30 cvs 1865:
1.37 cvs 1866: <p>Exceptions only inhibit or modify certain standard actions, but they can
1867: be used freely in every structure schema.</p>
1.30 cvs 1868:
1.37 cvs 1869: <p>Each structure schema can contain a section defining exceptions. It begins
1.18 cvs 1870: with the keyword <tt>EXCEPT</tt> and is composed of a sequence of exception
1.37 cvs 1871: declarations, separated by semicolons. Each declaration of an exception
1872: begins with the name of an element type or attribute followed by a colon.
1873: This indicates the element type or attribute to which the following
1874: exceptions apply. When the given element type name is a <a
1875: href="#sectd3285">mark pair</a>, and only in this case, the type name can be
1876: preceded by the keyword <tt>First</tt> or <tt>Second</tt>, to indicate if the
1877: exceptions which follow are associated with the first mark of the pair or the
1878: second. In the absence of this keyword, the first mark is used.</p>
1.30 cvs 1879:
1880: <p>When placed in an <a href="#sectc322">extension schema</a>, the keyword
1.18 cvs 1881: <tt>EXTERN</tt> indicates that the type name which follows is found in the
1.37 cvs 1882: principal schema (the schema being extended by the extension schema). The
1883: exceptions are indicated by a name. They are separated by semicolons.</p>
1.18 cvs 1884: <pre> [ 'EXCEPT' ExceptSeq ]
1.1 cvs 1885:
1.30 cvs 1886: ExceptSeq = Except ';' < Except ';' > .
1.1 cvs 1887: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr
1888: ':' ExcValSeq .
1889: ExcTypeOrAttr = ElemID / AttrID .
1.30 cvs 1890: ExcValSeq = ExcValue < ',' ExcValue > .
1.19 cvs 1891: ExcValue ='NoCut' / 'NoCreate' / 'NoHMove' /
1892: 'NoVMove' / 'NoHResize' / 'NoVResize' /
1893: 'NoMove' / 'NoResize' / 'MoveResize' /
1894: 'NewWidth' / 'NewHeight' / 'NewHPos' /
1895: 'NewVPos' / 'Invisible' /
1.28 cvs 1896: 'NoSelect' / 'NoSpellCheck' /
1.1 cvs 1897: 'Hidden' / 'ActiveRef' /
1898: 'ImportLine' / 'ImportParagraph' /
1899: 'NoPaginate' / 'ParagraphBreak' /
1.19 cvs 1900: 'PageBreak' / 'PageBreakAllowed' / 'PageBreakPlace' /
1901: 'PageBreakRepetition' / 'PageBreakRepBefore' /
1.9 cvs 1902: 'HighlightChildren' / 'ExtendedSelection' /
1.36 cvs 1903: 'SelectParent' / 'ClickableSurface' /
1.29 cvs 1904: 'ReturnCreateNL' / 'ReturnCreateWithin' /
1905: 'IsDraw' / 'IsTable' /
1.19 cvs 1906: 'IsRow' / 'IsColHead' / 'IsCell' /
1907: 'NewPercentWidth' / 'ColRef' / 'ColSpan' /
1908: 'RowSpan' / 'SaveDocument' / 'Shadow' .</pre>
1.30 cvs 1909:
1910: <p>The following are the available exceptions:</p>
1.18 cvs 1911: <dl>
1.30 cvs 1912: <dt><tt>NoCut</tt></dt>
1.37 cvs 1913: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1914: type to which this exception is applied cannot be deleted by the
1915: editor.</dd>
1916: <dt><tt>NoCreate</tt></dt>
1.37 cvs 1917: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1918: type to which this exception is applied cannot be created by ordinary
1.37 cvs 1919: commands for creating new elements. These elements are usually created
1.30 cvs 1920: by special actions associated with other exceptions.</dd>
1921: <dt><tt>NoHMove</tt></dt>
1.37 cvs 1922: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1923: type to which this exception is applied cannot be moved horizontally
1924: with the mouse. Their children elements cannot be moved either.</dd>
1925: <dt><tt>NoVMove</tt></dt>
1.37 cvs 1926: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1927: type to which this exception is applied cannot be moved vertically with
1928: the mouse. Their children elements cannot be moved either.</dd>
1929: <dt><tt>NoMove</tt></dt>
1.37 cvs 1930: <dd>This exception can only be applied to element types. Elements of a
1931: type to which this exception is applied cannot be moved in any
1932: direction with the mouse. Their children elements cannot be moved
1933: either.</dd>
1.30 cvs 1934: <dt><tt>NoHResize</tt></dt>
1.37 cvs 1935: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1936: type to which this exception is applied cannot be resized horizontally
1937: with the mouse. Their children elements cannot be resized either.</dd>
1938: <dt><tt>NoVResize</tt></dt>
1.37 cvs 1939: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1940: type to which this exception is applied cannot be resized vertically
1941: with the mouse. Their children elements cannot be resized either.</dd>
1942: <dt><tt>NoResize</tt></dt>
1.37 cvs 1943: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1944: type to which this exception is applied cannot be resized in any
1.37 cvs 1945: direction with the mouse. Their children elements cannot be resized
1.30 cvs 1946: either.</dd>
1947: <dt><tt>MoveResize</tt></dt>
1.37 cvs 1948: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1949: type to which this exception is applied can be moved and resized in any
1950: direction with the mouse, even if one of their ancestor element has an
1.37 cvs 1951: exception that prevents moving or resizing. Their children elements can
1.30 cvs 1952: also be resized or moved.</dd>
1953: <dt><tt>NewWidth</tt></dt>
1.37 cvs 1954: <dd>This exception can only be applied to numeric attributes. If the
1955: width of an element which has this attribute is modified with the
1956: mouse, the value of the new width will be assigned to the
1957: attribute.</dd>
1.30 cvs 1958: <dt><tt>NewHeight</tt></dt>
1.37 cvs 1959: <dd>This exception can only be applied to numeric attributes. If the
1.30 cvs 1960: height of an element which has this attribute is modified with the
1961: mouse, the value of the new height will be assigned to the
1962: attribute.</dd>
1963: <dt><tt>NewHPos</tt></dt>
1.37 cvs 1964: <dd>This exception can only be applied to numeric attributes. If the
1.30 cvs 1965: horizontal position of an element which has this attribute is modified
1966: with the mouse, the value of the new horizontal position will be
1967: assigned to the attribute.</dd>
1968: <dt><tt>NewVPos</tt></dt>
1.37 cvs 1969: <dd>This exception can only be applied to numeric attributes. If the
1.30 cvs 1970: vertical position of an element which has this attribute is modified
1971: with the mouse, the value of the new vertical position will be assigned
1972: to the attribute.</dd>
1973: <dt><tt>Invisible</tt></dt>
1974: <dd>This exception can only be applied to attributes, but can be applied
1.37 cvs 1975: to all attribute types. It indicates that the attribute must not be
1976: seen by the user and that its value must not be changed directly. This
1.30 cvs 1977: exception is usually used when another exception manipulates the value
1978: of an attribute.</dd>
1979: <dt><tt>NoSelect</tt></dt>
1.37 cvs 1980: <dd>This exception can only be applied to element types. Elements of a
1981: type to which this exception is applied cannot be selected directly
1.30 cvs 1982: with the mouse, but they can be selected by other methods provided by
1983: the editor.</dd>
1984: <dt>NoSpellCheck</dt>
1.37 cvs 1985: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 1986: type to which this exception is applied are not taken into account by
1987: the spell checker.</dd>
1988: <dt><tt>Hidden</tt></dt>
1.37 cvs 1989: <dd>This exception can only be applied to element types. It indicates
1.30 cvs 1990: that elements of this type, although present in the document's
1.37 cvs 1991: structure, must not be shown to the user of the editor. In particular,
1.30 cvs 1992: the creation menus must not propose this type and the selection message
1993: must not pick it.</dd>
1994: <dt><tt>ActiveRef</tt></dt>
1995: <dd>This exception can only be applied to attributes of the reference
1.37 cvs 1996: type. It indicates that when the user of the editor makes a double
1.30 cvs 1997: click on an element which possesses a reference attribute having this
1998: exception, the element designated by the reference attribute will be
1999: selected.</dd>
2000: <dt><tt>ImportLine</tt></dt>
1.37 cvs 2001: <dd>This exception can only be applied to element types. It indicates
1.30 cvs 2002: that elements of this type should receive the content of imported text
1.37 cvs 2003: files. An element is created for each line of the imported file. A
1.30 cvs 2004: structure schema cannot contain several exceptions <tt>ImportLine</tt>
2005: and, if it contains one, it should not contain any exception
2006: <tt>ImportParagraph</tt>.</dd>
2007: <dt><tt>ImportParagraph</tt></dt>
1.37 cvs 2008: <dd>This exception can only be applied to element types. It indicates
1.30 cvs 2009: that elements of this type should receive the content of imported text
1.37 cvs 2010: files. An element is created for each paragraph of the imported file. A
2011: paragraph is a sequence of lines without any empty line. A structure
1.30 cvs 2012: schema cannot contain several exceptions <tt>ImportParagraph</tt> and,
2013: if it contains one, it should not contain any exception
2014: <tt>ImportLine</tt>.</dd>
2015: <dt><tt>NoPaginate</tt></dt>
2016: <dd>This exception can only be applied to the root element, i.e. the name
1.37 cvs 2017: that appear after the keyword <tt>STRUCTURE</tt> at the beginning of
2018: the structure schema. It indicates that the editor should not allow the
1.30 cvs 2019: user to paginate documents of that type.</dd>
2020: <dt><tt>ParagraphBreak</tt></dt>
1.37 cvs 2021: <dd>This exception can only be applied to element types. When the caret
2022: is within an element of a type to which this exception is applied, it
2023: is that element that will be split when the user hits the Return
2024: key.</dd>
1.30 cvs 2025: <dt><tt>ReturnCreateNL</tt></dt>
1.37 cvs 2026: <dd>This exception can only be applied to element types. When the caret
1.30 cvs 2027: is within an element of a type to which this exception is applied, the
2028: Return key simply inserts a New line character (code \212) at the
2029: current position. The Return key does not create a new element; it does
2030: not split the current element either.</dd>
2031: <dt><tt>ReturnCreateWithin</tt></dt>
1.37 cvs 2032: <dd>This exception can only be applied to element types. When the caret
1.30 cvs 2033: is within an element of a type to which this exception is applied, the
2034: Return key will create a new element within that element, not a sibling
2035: after that element.</dd>
2036: <dt><tt>HighlightChildren</tt></dt>
1.37 cvs 2037: <dd>This exception can only be applied to element types. Elements of a
1.30 cvs 2038: type to which this exception is applied are not highlighted themselves
1.32 cvs 2039: when they are selected in the main view, but all their children are
1.37 cvs 2040: highlighted instead. If children have this exception too, the process
2041: is applied recursively. Only the main view defined in the presentation
1.32 cvs 2042: schema is concerned. Tee exception is ignored for other views.</dd>
1.30 cvs 2043: <dt><tt>ExtendedSelection</tt></dt>
1.37 cvs 2044: <dd>This exception can only be applied to element types. The selection
1.30 cvs 2045: extension command (middle button of the mouse) only add the clicked
2046: element (if it has that exception) to the current selection, without
2047: selecting other elements between the current selection and the clicked
2048: element.</dd>
1.36 cvs 2049: <dt><code>SelectParent</code></dt>
2050: <dd>This exception can only be applied to element types. When the user
1.37 cvs 2051: clicks on an element of that type, the parent of the element is
2052: selected instead of the element itself.</dd>
1.36 cvs 2053: <dt><code>ClickableSurface</code></dt>
2054: <dd>This exception can only be applied to element types. When the user
1.37 cvs 2055: clicks within a child of an element of that type, this child is
2056: selected even if it is a graphic leaf that is not filled.</dd>
1.36 cvs 2057: <dt><code>IsDraw</code>, <code>IsTable</code>, <code>IsColHead</code>,
2058: <code>IsRow</code>, <code>IsCell</code></dt>
1.37 cvs 2059: <dd>These exceptions can only be applied to element types. Elements of a
1.30 cvs 2060: type to which these exceptions are applied are identified as Draws,
2061: Tables, Colheads, Rows or Cells and specific processing are applied to
2062: them.</dd>
1.36 cvs 2063: <dt><code>ColRef</code></dt>
1.30 cvs 2064: <dd>This exception can only be applied to attributes of the reference
2065: type. It indicates that this attribute refers to the column head (see
2066: exception IsColHead) which the element belongs to.</dd>
1.36 cvs 2067: <dt><code>ColSpan</code>, <code>RowSpan</code></dt>
1.31 cvs 2068: <dd>These exceptions can only be applied to numeric attributes of cells.
1.30 cvs 2069: They indicate that attribute values give how many columns or rows the
2070: element spans.</dd>
1.36 cvs 2071: <dt><code>Shadow</code></dt>
1.37 cvs 2072: <dd>This exception can only be applied to element types. Text of elements
1.30 cvs 2073: of a type to which this exception is applied are displayed and printed
2074: as a set of stars ('*').</dd>
1.18 cvs 2075: </dl>
1.30 cvs 2076:
1.18 cvs 2077: <blockquote class="example">
1.30 cvs 2078: <p><strong>Example:</strong></p>
2079:
2080: <p>Consider a structure schema for object-style graphics which defines the
2081: Graphic_object element type with the associated Height and Weight numeric
1.37 cvs 2082: attributes. Suppose that we want documents of this class to have the
1.30 cvs 2083: following qualities:</p>
2084: <ul>
2085: <li>Whenever the width or height of an object is changed using the mouse,
2086: the new values are stored in the object's Width and Height
2087: attributes.</li>
2088: <li>The user should not be able to change the values of the Width and
2089: Height attributes via the Attributes menu of the Thot editor.</li>
2090: </ul>
2091:
2092: <p>The following exceptions will produce this effect.</p>
2093: <pre>STRUCT
1.1 cvs 2094: ...
1.5 cvs 2095: Graphics_object (ATTR Height = Integer; Width = Integer)
1.1 cvs 2096: = GRAPHICS with Height ?= 10, Width ?= 10;
2097: ...
2098: EXCEPT
2099: Height: NewHeight, Invisible;
1.18 cvs 2100: Width: NewWidth, Invisible;</pre>
2101: </blockquote>
2102: </div>
2103: </div>
1.1 cvs 2104:
1.18 cvs 2105: <div class="section">
1.37 cvs 2106: <h2><a name="sectb33" id="sectb33">Some examples</a></h2>
1.1 cvs 2107:
1.30 cvs 2108: <p>In order to illustrate the principles of the document model and the syntax
2109: of the S language, this section presents two examples of structure schemas.
2110: One defines a class of documents, the other defines a class of objects.</p>
1.1 cvs 2111:
1.18 cvs 2112: <div class="subsection">
1.37 cvs 2113: <h3><a name="sectc331" id="sectc331">A class of documents: articles</a></h3>
1.1 cvs 2114:
1.30 cvs 2115: <p>This example shows a possible structure for articles published in a
2116: journal. Text between braces is comments.</p>
1.18 cvs 2117: <pre>STRUCTURE Article; { This schema defines the Article class }
1.1 cvs 2118: DEFPRES ArticleP; { The default presentation schema is
2119: ArticleP }
2120: ATTR { Global attribute definitions }
2121: WordType = Definition, IndexWord, DocumentTitle;
2122: { A single global attribute is defined, with three values }
2123: STRUCT { Definition of the generic structure }
2124: Article = BEGIN { The Article class has an aggregate
2125: structure }
2126: Title = BEGIN { The title is an aggregate }
2127: French_title =
2128: Text WITH Language='Fran\347ais';
2129: English_title =
2130: Text WITH Language='English';
2131: END;
2132: Authors =
2133: LIST OF (Author
2134: (ATTR Author_type=principal,secondary)
2135: { The Author type has a local attribute }
2136: = BEGIN
2137: Author_name = Text;
2138: Info = Paragraphs ;
2139: { Paragraphs is defined later }
2140: Address = Text;
2141: END
2142: );
2143: Keywords = Text;
2144: { The journal's editor introduces the article
2145: with a short introduction, in French and
2146: in English }
2147: Introduction =
2148: BEGIN
2149: French_intr = Paragraphs WITH
2150: Language='Fran\347ais';
2151: English_intr = Paragraphs WITH
2152: Language='English';
2153: END;
2154: Body = Sections; { Sections are defined later }
2155: { Appendixes are only created on demand }
2156: ? Appendices =
2157: LIST OF (Appendix =
2158: BEGIN
2159: Appendix_Title = Text;
2160: Appendix_Contents = Paragraphs;
2161: END
2162: );
1.37 cvs 2163: ? Figures = LIST OF (Figure);
2164: ? Bibliography = LIST OF (Biblio_citation);
2165: ? Notes = LIST OF (Note);
1.1 cvs 2166: END; { End of the Article aggregate }
2167:
2168: Sections = LIST [2..*] OF (
2169: Section = { At least 2 sections }
2170: BEGIN
2171: Section_title = Text;
2172: Section_contents =
2173: BEGIN
2174: Paragraphs;
2175: Sections; { Sections at a lower level }
2176: END;
2177: END
2178: );
2179:
2180: Paragraphs = LIST OF (Paragraph = CASE OF
2181: Enumeration =
2182: LIST [2..*] OF
2183: (Item = Paragraphs);
2184: Isolated_formula = Formula;
2185: LIST OF (UNIT);
2186: END
2187: );
2188:
2189: Figure = BEGIN
1.5 cvs 2190: Figure_caption = Text;
1.1 cvs 2191: Illustration = NATURE;
2192: END;
2193:
2194: Biblio_citation = CASE OF
2195: Ref_Article =
2196: BEGIN
2197: Authors_Bib = Text;
2198: Article_Title = Text;
2199: Journal = Text;
2200: Page_Numbers = Text;
2201: Date = Text;
2202: END;
2203: Ref_Livre =
2204: BEGIN
2205: Authors_Bib; { Defined above }
2206: Book_Title = Text;
2207: Editor = Text;
2208: Date; { Defined above }
2209: END;
2210: END;
2211:
2212: Note = Paragraphs - (Ref_note);
2213:
2214: UNITS { Elements which can be used in objects }
2215:
2216: Ref_note = REFERENCE (Note);
2217: Ref_biblio = REFERENCE (Biblio_citation);
2218: Ref_figure = REFERENCE (Figure);
2219: Ref_formula = REFERENCE (Isolated_formula);
2220:
2221: EXPORT { Skeleton elements }
2222:
2223: Title,
1.5 cvs 2224: Figure with Figure_caption,
1.1 cvs 2225: Section With Section_title;
2226:
1.18 cvs 2227: END { End of the structure schema }</pre>
1.30 cvs 2228:
2229: <p>This schema is very complete since it defines both paragraphs and
1.37 cvs 2230: bibliographic citations. These element types could just as well be defined in
2231: other structure schemas, as is the case with the <tt>Formula</tt> class. All
2232: sorts of other elements can be inserted into an article, since a paragraph
2233: can contain any type of unit. Similarly, figures can be any class of document
2234: or object that the user chooses.</p>
2235:
2236: <p>Generally, an article doesn't contain appendices, but it is possible to
2237: add them on explicit request: this is the effect of the question mark before
2238: the word Appendices.</p>
1.30 cvs 2239:
1.37 cvs 2240: <p>Various types of cross-references can be put in paragraphs. They can also
1.30 cvs 2241: be placed the objects which are part of the article, since the
2242: cross-references are defined as units (<tt>UNITS</tt>).</p>
2243:
2244: <p>There is a single restriction to prevent the creation of Ref_note elements
1.18 cvs 2245: within notes.</p>
1.30 cvs 2246:
2247: <p>It is worth noting that the S language permits the definition of recursive
1.37 cvs 2248: structures like sections: a section can contain other sections (which are
2249: thus at the next lower level of the document tree). Paragraphs are also
2250: recursive elements, since a paragraph can contain an enumeration in which
2251: each element (<tt>Item</tt>) is composed of paragraphs.</p>
1.18 cvs 2252: </div>
1.1 cvs 2253:
1.18 cvs 2254: <div class="subsection">
1.37 cvs 2255: <h3><a name="sectc332" id="sectc332">A class of objects: mathematical
2256: formulas</a></h3>
1.1 cvs 2257:
1.30 cvs 2258: <p>The example below defines the <tt>Formula</tt> class which is used in
1.37 cvs 2259: Article documents. This class represents mathematical formulas with a rather
1.30 cvs 2260: simple structure, but sufficient to produce a correct rendition on the screen
1.37 cvs 2261: or printer. To support more elaborate operations (formal or numeric
2262: calculations), a finer structure should be defined. This class doesn't use
2263: any other class and doesn't define any units.</p>
1.18 cvs 2264: <pre>STRUCTURE Formula;
1.1 cvs 2265: DEFPRES FormulaP;
2266:
2267: ATTR
2268: String_type = Function_name, Variable_name;
2269:
2270: STRUCT
2271: Formula = Expression;
2272: Expression = LIST OF (Construction);
2273: Construction = CASE OF
2274: TEXT; { Simple character string }
2275: Index = Expression;
2276: Exponent = Expression;
2277: Fraction =
2278: BEGIN
1.6 cvs 2279: Numerator = Expression;
1.1 cvs 2280: Denominator = Expression;
2281: END;
2282: Root =
2283: BEGIN
2284: ? Order = TEXT;
2285: Root_Contents = Expression;
2286: END;
2287: Integral =
2288: BEGIN
2289: Integration_Symbol = SYMBOL;
2290: Lower_Bound = Expression;
2291: Upper_Bound = Expression;
2292: END;
2293: Triple =
2294: BEGIN
2295: Princ_Expression = Expression;
2296: Lower_Expression = Expression;
2297: Upper_Expression = Expression;
2298: END;
2299: Column = LIST [2..*] OF
2300: (Element = Expression);
2301: Parentheses_Block =
2302: BEGIN
2303: Opening = SYMBOL;
2304: Contents = Expression;
2305: Closing = SYMBOL;
2306: END;
2307: END; { End of Choice Constructor }
1.18 cvs 2308: END { End of Structure Schema }</pre>
1.30 cvs 2309:
2310: <p>This schema defines a single global attribute which allows functions and
1.37 cvs 2311: variables to be distinguished. In the presentation schema, this attribute can
1.1 cvs 2312: be used to choose between roman (for functions) and italic characters (for
1.18 cvs 2313: variables).</p>
1.30 cvs 2314:
1.37 cvs 2315: <p>A formula's structure is that of a mathematical expression, which is
2316: itself a sequence of mathematical constructions. A mathematical construction
2317: can be either a simple character string, an index, an exponent, a fraction, a
2318: root, etc. Each of these mathematical constructions has a sensible structure
2319: which generally includes one or more expressions, thus making the formula
2320: class's structure definition recursive.</p>
1.30 cvs 2321:
2322: <p>In most cases, the roots which appear in the formulas are square roots and
1.37 cvs 2323: their order (2) is not specified. This is why the Order component is marked
2324: optional by a question mark. When explicitly requested, it is possible to add
1.18 cvs 2325: an order to a root, for example for cube roots (order = 3).</p>
1.30 cvs 2326:
2327: <p>An integral is formed by an integration symbol, chosen by the user (simple
1.37 cvs 2328: integral, double, curvilinear, etc.), and two bounds. A more fine-grained
1.1 cvs 2329: schema would add components for the integrand and the integration variable.
1.37 cvs 2330: Similarly, the Block_Parentheses construction leaves the choice of opening
2331: and closing symbols to the user. They can be brackets, braces, parentheses,
1.18 cvs 2332: etc.</p>
2333: </div>
2334: </div>
1.37 cvs 2335: <hr />
1.18 cvs 2336: </div>
1.1 cvs 2337:
1.18 cvs 2338: <div class="chapter">
1.37 cvs 2339: <h1><a name="sect4" id="sect4">The P Language</a></h1>
1.1 cvs 2340:
1.18 cvs 2341: <div class="section">
1.37 cvs 2342: <h2><a name="sectb41" id="sectb41">Document presentation</a></h2>
1.1 cvs 2343:
1.30 cvs 2344: <p>Because of the model adopted for Thot, the presentation of documents is
1.37 cvs 2345: clearly separated from their structure and content. After having presented
1.1 cvs 2346: the logical structure of documents, we now detail the principles implemented
1.37 cvs 2347: for their presentation. The concept of <em>presentation</em> encompasses what
2348: is often called the page layout, the composition, or the document style. It
1.18 cvs 2349: is the set of operations which display the document on the screen or print it
1.37 cvs 2350: on paper. Like logical structure, document presentation is defined
1.18 cvs 2351: generically with the help of a language, called P.</p>
1.1 cvs 2352:
1.18 cvs 2353: <div class="subsection">
1.37 cvs 2354: <h3><a name="sectc411" id="sectc411">Two levels of presentation</a></h3>
1.1 cvs 2355:
1.30 cvs 2356: <p>The link between structure and presentation is clear: the logical
2357: organization of a document is used to carry out its presentation, since the
2358: purpose of the presentation is to make evident the organization of the
1.37 cvs 2359: document. But the presentation is equally dependent on the device used to
1.30 cvs 2360: render the document. Certain presentation effects, notably changes of font or
1.37 cvs 2361: character set, cannot be performed on all printers or on all screens. This is
1.30 cvs 2362: why Thot uses a two-level approach, where the presentation is first described
2363: in abstract terms, without taking into account each particular device, and
2364: then the presentation is realized within the constraints of a given
2365: device.</p>
2366:
2367: <p>Thus, presentation is only described as a function of the structure of the
1.37 cvs 2368: documents and the image that would be produced on an idealized device. For
1.1 cvs 2369: this reason, presentation descriptions do not refer to any device
1.18 cvs 2370: characteristics: they describe <em>abstract presentations</em> which can be
2371: concretized on different devices.</p>
1.30 cvs 2372:
2373: <p>A presentation description also defines a <em>generic presentation</em>,
2374: since it describes the appearance of a class of documents or objects. This
2375: generic presentation must also be applied to document and object instances,
2376: each conforming to its generic logical structure, but with all the allowances
2377: that were called to mind above: missing elements, constructed elements with
2378: other logical structures, etc.</p>
2379:
2380: <p>In order to preserve the homogeneity between documents and objects,
1.1 cvs 2381: presentation is described with a single set of tools which support the layout
2382: of a large document as well as the composition of objects like a graphical
1.37 cvs 2383: figure or mathematical formula. This unity of presentation description tools
1.1 cvs 2384: contrasts with the traditional approach, which focuses more on documents than
2385: objects and thus is based on the usual typographic conventions, such as the
2386: placement of margins, indentations, vertical spaces, line lengths,
1.18 cvs 2387: justification, font changes, etc.</p>
2388: </div>
1.1 cvs 2389:
1.18 cvs 2390: <div class="subsection">
1.37 cvs 2391: <h3><a name="sectc412" id="sectc412">Boxes</a></h3>
1.1 cvs 2392:
1.37 cvs 2393: <p>To assure the homogeneity of tools, all presentation in Thot, for
2394: documents as well as for the objects which they contain, is based on the
2395: notion of the <em>box</em>, such as was implemented in
2396: T<sub><big>E</big></sub>X.</p>
1.30 cvs 2397:
1.37 cvs 2398: <p>Corresponding to each element of the document is a box, which is the
1.1 cvs 2399: rectangle enclosing the element on the display device (screen or sheet of
1.37 cvs 2400: paper); the outline of this rectangle is not visible, except when a <a
2401: href="#sectc4230a"><tt>ShowBox</tt> rule</a> applies to the element. The
2402: sides of the box are parallel to the sides of the screen or the sheet of
2403: paper. By way of example, a box is associated with a character string, a line
2404: of text, a page, a paragraph, a title, a mathematical formula, or a table
2405: cell.</p>
1.30 cvs 2406:
2407: <p>Whatever element it corresponds to, each box possesses four sides and four
1.18 cvs 2408: axes, which we designate as follows (<a href="#boxes">see figure</a>):</p>
2409: <dl>
1.30 cvs 2410: <dt><tt>Top</tt></dt>
2411: <dd>the upper side,</dd>
2412: <dt><tt>Bottom</tt></dt>
2413: <dd>the lower side,</dd>
2414: <dt><tt>Left</tt></dt>
2415: <dd>the left side,</dd>
2416: <dt><tt>Right</tt></dt>
2417: <dd>the right side,</dd>
2418: <dt><tt>VMiddle</tt></dt>
2419: <dd>the vertical axis passing through the center of the box,</dd>
2420: <dt><tt>HMiddle</tt></dt>
2421: <dd>the horizontal axis passing through the center of the box,</dd>
2422: <dt><tt>VRef</tt></dt>
2423: <dd>the vertical reference axis,</dd>
2424: <dt><tt>HRef</tt></dt>
2425: <dd>the horizontal reference axis.</dd>
1.18 cvs 2426: </dl>
2427:
2428: <div class="figure">
1.37 cvs 2429: <hr />
1.18 cvs 2430: <pre> Left VRef VMiddle Right
1.1 cvs 2431: : :
2432: Top -----------------------------
2433: | : : |
2434: | : : |
2435: | : : |
2436: | : : |
2437: | : : |
2438: HMiddle ..|...........................|..
2439: | : : |
2440: | : : |
2441: HRef ..|...........................|..
2442: | : : |
2443: | : : |
2444: Bottom -----------------------------
1.18 cvs 2445: : :</pre>
1.30 cvs 2446:
1.37 cvs 2447: <p align="center"><em><a name="boxes" id="boxes">The sides and axes of
1.30 cvs 2448: boxes</a><em></em></em></p>
1.37 cvs 2449: <hr />
1.30 cvs 2450: </div>
1.19 cvs 2451:
1.37 cvs 2452: <p>The principal role of boxes is to set the extent and position of the
2453: images of the different elements of a document with respect to each other on
2454: the reproduction device. This is done by defining relations between the boxes
2455: of different elements which give relative extents and positions to these
1.18 cvs 2456: boxes.</p>
1.30 cvs 2457:
2458: <p>There are three types of boxes:</p>
1.18 cvs 2459: <ul>
1.30 cvs 2460: <li>boxes corresponding to structural elements of the document,</li>
2461: <li>presentation boxes,</li>
2462: <li>page layout boxes.</li>
1.18 cvs 2463: </ul>
1.30 cvs 2464:
1.37 cvs 2465: <p><strong>Boxes corresponding to structural elements of the
2466: document</strong> are those which linked to each of the elements (base or
2467: structured) of the logical structure of the document. Such a box contains all
2468: the contents of the element to which it corresponds (there is an exception:
2469: see <a href="#sectc4220">rules <tt>VertOverflow</tt> and
2470: <tt>HorizOverflow</tt></a>). These boxes form a tree-like structure,
2471: identical to that of the structural elements to which they correspond. This
2472: tree expresses the inclusion relationships between the boxes: a box includes
2473: all the boxes of its subtree. On the other hand, there are no predefined
2474: rules for the relative positions of the included boxes. If they are at the
2475: same level, they can overlap, be contiguous, or be disjoint. The rules
2476: expressed in the generic presentation specify their relative positions.</p>
1.30 cvs 2477:
2478: <p><strong>Presentation boxes</strong> represent elements which are not found
1.37 cvs 2479: in the logical structure of the document but which are added to meet the
2480: needs of presentation. These boxes are linked to the elements of the logical
1.30 cvs 2481: structure that are best suited to bringing them out. For example, they are
2482: used to add the character string ``Summary:'' before the summary in the
2483: presentation of a report or to represent the fraction bar in a formula, or
1.37 cvs 2484: also to make the title of a field in a form appear. These elements have no
1.30 cvs 2485: role in the logical structure of the document: the presence of a Summary
2486: element in the document does not require the creation of another structural
1.37 cvs 2487: object to hold the word ``Summary''. Similarly, if a Fraction element
2488: contains both a Numerator element and a Denominator element, the fraction bar
2489: has no purpose structurally. On the other hand, these elements of the
2490: presentation are important for the reader of the reproduced document or for
2491: the user of an editor. This is why they must appear in the document's image.
2492: It is the generic presentation which specifies the presentation boxes to add
2493: by indicating their content (a base element for which the value is specified)
2494: and the position that they must take in the tree of boxes. During editing,
2495: these boxes cannot be modified by the user.</p>
2496:
2497: <p><strong>Page layout boxes</strong> are boxes created implicitly by the
2498: page layout rules. These rules indicate how the contents of a structured
2499: element must be broken into lines and pages. In contrast to presentation
2500: boxes, these line and page boxes do not depend on the logical structure of
2501: the document, but rather on the physical constraints of the output devices:
2502: character size, height and width of the window on the screen or of the sheet
2503: of paper.</p>
1.18 cvs 2504: </div>
1.1 cvs 2505:
1.18 cvs 2506: <div class="subsection">
1.37 cvs 2507: <h3><a name="sectc413" id="sectc413">Views and visibility</a></h3>
1.1 cvs 2508:
1.30 cvs 2509: <p>One of the operations that one might wish to perform on a document is to
1.37 cvs 2510: view it is different ways. For this reason, it is possible to define several
1.18 cvs 2511: <em>views</em> for the same document, or better yet, for all documents of the
1.37 cvs 2512: same class. A view is not a different presentation of the document, but
1.1 cvs 2513: rather a filter which only allows the display of certain parts of the
1.37 cvs 2514: document. For example, it might be desirable to see only the titles of
1.1 cvs 2515: chapters and sections in order to be able to move rapidly through the
1.37 cvs 2516: document. Such a view could be called a ``table of contents''. It might also
1.1 cvs 2517: be desirable to see only the mathematical formulas of a document in order to
1.37 cvs 2518: avoid being distracted by the non-mathematical aspects of the document. A
1.18 cvs 2519: ``mathematics'' view could provide this service.</p>
1.30 cvs 2520:
2521: <p>Views, like presentation, are based on the generic logical structure. Each
1.1 cvs 2522: document class, and each generic presentation, can be provided with views
1.37 cvs 2523: which are particularly useful for that class or presentation. For each view,
1.18 cvs 2524: the <em>visibility</em> of elements is defined, indicated whether or not the
1.37 cvs 2525: elements must be presented to the user. The visibility is calculated as a
1.1 cvs 2526: function of the type of the elements or their hierarchical position in the
1.37 cvs 2527: structure of the document. Thus, for a table of contents, all the ``Chapter
2528: Title'' and ``Section Title'' elements are made visible. However, the
1.1 cvs 2529: hierarchical level could be used to make the section titles invisible below a
1.37 cvs 2530: certain threshold level. By varying this threshold, the granularity of the
2531: view can be varied. In the ``mathematics'' view, only Formula elements would
1.18 cvs 2532: be made visible, no matter what their hierarchical level.</p>
1.30 cvs 2533:
2534: <p>Because views are especially useful for producing a synthetic image of the
1.1 cvs 2535: document, it is necessary to adapt the presentation of the elements to the
1.37 cvs 2536: view in which they appear. For example, it is inappropriate to have a page
2537: break before every chapter title in the table of contents. Thus, generic
1.1 cvs 2538: presentations take into account the possible views and permit each element
1.18 cvs 2539: type's presentation to vary according the view in which its image appears.</p>
2540: </div>
1.1 cvs 2541:
1.18 cvs 2542: <div class="subsection">
1.37 cvs 2543: <h3><a name="sectc414" id="sectc414">Pages</a></h3>
1.1 cvs 2544:
1.30 cvs 2545: <p>Presentation schemas can be defined which display the document as a long
1.37 cvs 2546: scroll, without page breaks. This type of schema is particularly well-suited
1.1 cvs 2547: to the initial phase of work on a document, where jumps from page to page
1.37 cvs 2548: would hinder composing and reading the document on a screen. But, once the
2549: document is written, it may be desirable to display the document on the
2550: screen in the same manner in which it will be printed. So, the presentation
2551: schema must define pages.</p>
2552:
2553: <p>The P language permits the specification of the dimensions of pages as
2554: well as their composition. It is possible to generate running titles, page
2555: numbers, zones at the bottom of the page for notes, etc. The editor follows
1.30 cvs 2556: this model and inserts page break marks in the document which are used during
2557: printing, insuring that the pages on paper are the same as on the screen.</p>
2558:
2559: <p>Once a document has been edited with a presentation schema defining pages,
1.37 cvs 2560: it contains page marks. But it is always possible to edit the document using
2561: a schema without pages. In this case, the page marks are simply ignored by
2562: the editor. They are considered again as soon as a schema with pages is used.
1.18 cvs 2563: Thus, the user is free to choose between schemas with and without pages.</p>
1.30 cvs 2564:
2565: <p>Thot treats the page break, rather than the page itself, as a box. This
2566: page break box contains all the elements of one page's footer, a rule marking
1.37 cvs 2567: the edge of this page, and all the elements of the next page's header. The
2568: elements of the header and footer can be running titles, page number, notes,
2569: etc. All these elements, as well as their content and graphical appearance,
2570: are defined by the generic presentation.</p>
1.18 cvs 2571: </div>
1.1 cvs 2572:
1.18 cvs 2573: <div class="subsection">
1.37 cvs 2574: <h3><a name="sectc415" id="sectc415">Numbering</a></h3>
1.1 cvs 2575:
1.30 cvs 2576: <p>Many elements are numbered in documents: pages, chapters, sections,
2577: formulas, theorems, notes, figures, bibliographic references, exercises,
1.37 cvs 2578: examples, lemmas, etc. Because Thot has a notion of logical structure, all of
1.30 cvs 2579: these numbers (with the exception of pages) are redundant with information
1.37 cvs 2580: implicit in the logical structure of the document. Such numbers are simply a
2581: way to make the structure of the document more visible. So, they are part of
1.30 cvs 2582: the document's presentation and are calculated by the editor from the logical
1.37 cvs 2583: structure. The structure does not contain numbers as such; it only defines
1.1 cvs 2584: relative structural positions between elements, which serve as ordering
1.18 cvs 2585: relations on these elements.</p>
1.30 cvs 2586:
2587: <p>If the structure schema defines the body of a document as a sequence of at
1.18 cvs 2588: least two chapters:</p>
2589: <pre>Body = LIST [2..*] OF Chapter;</pre>
1.30 cvs 2590:
2591: <p>the sequence defined by the list constructor is ordered and each chapter
1.37 cvs 2592: can be assigned a number based on its rank in the Body list. Therefore, all
2593: elements contained in lists a the structure of a document can be numbered,
2594: but they are not the only ones. The tree structure induced by the aggregate,
1.18 cvs 2595: list, and choice constructors (excluding references) defines a total order on
1.37 cvs 2596: the elements of the document's primary structure. So, it is possible to
1.18 cvs 2597: define a numbering which uses this order, filtering elements according to
2598: their type so that only certain element types are taken into account in the
1.37 cvs 2599: numbering. In this way, it possible to number all the theorems and lemmas of
1.18 cvs 2600: a chapter in the same sequence of numbers, even when they are not part of the
2601: same list constructor and appear at different levels of the document's tree.
2602: By changing the filter, they can be numbered separately: one sequence of
2603: numbers for theorems, another for the lemmas.</p>
1.30 cvs 2604:
2605: <p>Since they are calculated from the document's logical structure and only
2606: for the needs of the presentation, numbers are presentation elements,
2607: described by presentation boxes, just like the fraction bar or the word
1.37 cvs 2608: ``Summary''. Nevertheless, numbers differ from these other boxes because
2609: their content varies from instance to instance, even though they are of the
2610: same type, whereas all fraction bars are horizontal lines and the same word
1.30 cvs 2611: ``Summary'' appears at the head of every document's summary.</p>
1.18 cvs 2612: </div>
1.1 cvs 2613:
1.18 cvs 2614: <div class="subsection">
1.37 cvs 2615: <h3><a name="sectc416" id="sectc416">Presentation properties</a></h3>
1.1 cvs 2616:
1.34 cvs 2617: <p>The principal properties which determine document presentation are the
1.18 cvs 2618: <em>positions</em> and <em>dimensions</em> of boxes, the <em>font</em>, the
2619: <em>style</em>, the <em>size</em>, the <em>underlining</em> and the
1.37 cvs 2620: <em>color</em> of their content. From these properties, and some others of
1.34 cvs 2621: less importance, it is possible to represent the usual typographic properties
1.37 cvs 2622: for the textual parts of the document. These same properties can be used to
1.1 cvs 2623: describe the geometry of the non-textual elements, even though they are
1.18 cvs 2624: two-dimensional elements unlike the text, which is linear.</p>
1.30 cvs 2625:
1.37 cvs 2626: <p>As we have already seen, the positions of the boxes always respect the
1.30 cvs 2627: rule of enclosure: a box in the tree encloses all the boxes of the next lower
1.37 cvs 2628: level which are attached to it. The positional properties permit the
1.30 cvs 2629: specification of the position of each box in relation to the enclosing box or
1.37 cvs 2630: to its sibling boxes (boxes directly attached to the same enclosing box in
2631: the tree of boxes).</p>
1.30 cvs 2632:
1.37 cvs 2633: <p>The presentation properties also provide control over the dimensions of
2634: the boxes. The dimensions of a box can depend either on its content or on its
1.1 cvs 2635: context (its sibling boxes and the enclosing box). Each dimension (height or
1.18 cvs 2636: width) can be defined independently of the other.</p>
1.30 cvs 2637:
1.34 cvs 2638: <p>Because of the position and dimension properties, it is possible to do the
1.1 cvs 2639: same things that are normally done in typography by changing margins, line
1.37 cvs 2640: lengths, and vertical or horizontal skips. This approach can also align or
1.18 cvs 2641: center elements and groups of elements.</p>
1.30 cvs 2642:
1.34 cvs 2643: <p>In contrast to the position and dimension properties, the font, style,
1.30 cvs 2644: size, underlining, and color do not concern the box itself (the rectangle
1.37 cvs 2645: delimiting the element), but its content. These properties indicate the
2646: typographic attributes which must be applied to the text contained in the
2647: box, and by extension, to all base elements.</p>
1.30 cvs 2648:
1.34 cvs 2649: <p>For text, the font property is used to change the family of characters
1.1 cvs 2650: (Times, Helvetica, Courier, etc.); the style is used to obtain italic or
1.37 cvs 2651: roman, bold or light characters; the size determines the point size of the
1.1 cvs 2652: characters; underlining defines the type and thickness of the lines drawn
1.18 cvs 2653: above, below, or through the characters.</p>
1.30 cvs 2654:
1.34 cvs 2655: <p>For graphics, the line style property can be either solid, dotted, or
2656: dashed; the line thickness property controls the width of the lines; the fill
2657: pattern property determines how closed geometric figures must be filled.</p>
1.30 cvs 2658:
1.34 cvs 2659: <p>While some of the properties which determine the appearance of a box's
1.1 cvs 2660: contents make sense only for one content type (text or graphic), other
1.34 cvs 2661: properties apply to all content types: these are the color properties. These
1.18 cvs 2662: indicate the color of lines and the background color.</p>
2663: </div>
2664: </div>
1.1 cvs 2665:
1.18 cvs 2666: <div class="section">
1.37 cvs 2667: <h2><a name="sectb42" id="sectb42">Presentation description language</a></h2>
1.30 cvs 2668:
1.34 cvs 2669: <p>A generic presentation defines the values of presentation properties (or
1.37 cvs 2670: the way to calculate those values) for a generic structure, or more
2671: precisely, for all the element types and all the global and local attributes
2672: defined in that generic structure. This definition of the presentation
2673: properties is made with the P language. A program written in this language,
2674: that is a generic presentation expressed in P, is call a <em>presentation
2675: schema</em>. This section describes the syntax and semantics of the language,
2676: using the same <a href="#sectc321">meta-language</a> as was used for the
2677: definition of the S language.</p>
2678:
2679: <p>Recall that it is possible to write many different presentation schemas
2680: for the same class of documents or objects. This allows users to choose for a
2681: document the graphical appearance which best suits their type of work or
1.18 cvs 2682: their personal taste.</p>
1.1 cvs 2683:
1.18 cvs 2684: <div class="subsection">
1.37 cvs 2685: <h3><a name="sectc421" id="sectc421">The organization of a presentation
2686: schema</a></h3>
1.1 cvs 2687:
1.30 cvs 2688: <p>A presentation schema begins with the word <tt>PRESENTATION</tt> and ends
1.37 cvs 2689: with the word <tt>END</tt>. The word <tt>PRESENTATION</tt> is followed by the
2690: name of the generic structure to which the presentation will be applied. This
1.30 cvs 2691: name must be the same as that which follows the keyword <tt>STRUCTURE</tt> in
2692: the structure schema associated with the presentation schema.</p>
2693:
1.37 cvs 2694: <p>After this declaration of the name of the structure, the following
2695: sections appear (in order):</p>
1.18 cvs 2696: <ul>
1.37 cvs 2697: <li>Declarations of
1.30 cvs 2698: <ul>
2699: <li>all views,</li>
2700: <li>printed views,</li>
2701: <li>counters,</li>
2702: <li>presentation constants,</li>
2703: <li>variables,</li>
2704: </ul>
2705: </li>
2706: <li>default presentation rules,</li>
2707: <li>presentation box and page layout box definitions,</li>
2708: <li>presentation rules for structured elements,</li>
2709: <li>presentation rules for attributes,</li>
2710: <li>rules for transmitting values to attributes of included documents.</li>
1.18 cvs 2711: </ul>
1.30 cvs 2712:
2713: <p>Each of these sections is introduced by a keyword which is followed by a
1.37 cvs 2714: sequence of declarations. Every section is optional.</p>
1.18 cvs 2715: <pre> SchemaPres ='PRESENTATION' ElemID ';'
1.1 cvs 2716: [ 'VIEWS' ViewSeq ]
2717: [ 'PRINT' PrintViewSeq ]
2718: [ 'COUNTERS' CounterSeq ]
2719: [ 'CONST' ConstSeq ]
2720: [ 'VAR' VarSeq ]
2721: [ 'DEFAULT' ViewRuleSeq ]
2722: [ 'BOXES' BoxSeq ]
2723: [ 'RULES' PresentSeq ]
2724: [ 'ATTRIBUTES' PresAttrSeq ]
2725: [ 'TRANSMIT' TransmitSeq ]
2726: 'END' .
1.18 cvs 2727: ElemID = NAME .</pre>
2728: </div>
1.1 cvs 2729:
1.18 cvs 2730: <div class="subsection">
1.37 cvs 2731: <h3><a name="sectc422" id="sectc422">Views</a></h3>
1.1 cvs 2732:
1.37 cvs 2733: <p>Each of the possible views must be declared in the presentation schema. As
2734: has <a href="#views">already been described</a>, the presentation rules for
2735: an element type can vary according to the view in which the element appears.
2736: The name of the view is used to designate the view to which the presentation
2737: rules apply (see the <a href="#inkeyword"><tt>IN</tt> instruction</a>). The
1.1 cvs 2738: definition of the view's contents are dispersed throughout the presentation
1.37 cvs 2739: rules attached to the different element types and attributes. The
1.18 cvs 2740: <tt>VIEWS</tt> section is simply a sequence of view names separated by commas
2741: and terminated by a semi-colon.</p>
1.30 cvs 2742:
2743: <p>One of the view names (and only one) can be followed by the keyword
1.37 cvs 2744: <tt>EXPORT</tt>. This keyword identifies the view which presents the members
2745: of the document class in <a href="#sectc3213">skeleton form</a>. The
2746: graphical appearance and the content of this view is defined just as with
1.18 cvs 2747: other views, but it is useless to specify presentation rules concerning this
2748: view for the elements which are not loaded in the skeleton form.</p>
1.30 cvs 2749:
2750: <p>It is not necessary to declare any views; in this case there is a single
1.37 cvs 2751: unnamed view. If many views are declared, the first view listed is considered
2752: the principal view. The principal view is the one to which all rules that are
1.18 cvs 2753: not preceded by an indication of a view will apply (see the <a
2754: href="#inkeyword">instruction <tt>IN</tt></a>).</p>
1.30 cvs 2755:
2756: <p>The principal view is the the one which the editor presents on the screen
1.37 cvs 2757: when the user asks to create or edit a document. Thus, it makes sense to put
2758: the most frequently used view at the head of the list. But if the structure
1.18 cvs 2759: schema contains <a href="#sectc3213">skeleton elements</a> and is loaded in
2760: its skeleton form, the view whose name is followed by the keyword
2761: <tt>EXPORT</tt> will be opened and no other views can be opened.</p>
2762: <pre> 'VIEWS' ViewSeq
1.1 cvs 2763: ViewSeq = ViewDeclaration
1.30 cvs 2764: < ',' ViewDeclaration > ';' .
1.1 cvs 2765: ViewDeclaration = ViewID [ 'EXPORT' ] .
1.18 cvs 2766: ViewID = NAME .</pre>
1.30 cvs 2767:
1.18 cvs 2768: <blockquote class="example">
1.30 cvs 2769: <p><strong>Example:</strong></p>
2770:
2771: <p>When editing a report, it might be useful have views of the table of
1.37 cvs 2772: contents and of the mathematical formulas, in addition to the principal
2773: view which shows the document in its entirety. To achieve this, a
2774: presentation schema for the Report class would have the following
2775: <tt>VIEWS</tt> section:</p>
1.30 cvs 2776: <pre>VIEWS
1.18 cvs 2777: Full_text, Table_of_contents, Formulas;</pre>
1.30 cvs 2778:
2779: <p>The contents of these views are specified in the presentation rules of
2780: the schema.</p>
1.18 cvs 2781: </blockquote>
2782: </div>
1.1 cvs 2783:
1.18 cvs 2784: <div class="subsection">
1.37 cvs 2785: <h3><a name="sectc423" id="sectc423">Print Views</a></h3>
1.1 cvs 2786:
1.37 cvs 2787: <p>When editing a document, each view specified by the <tt>VIEWS</tt>
2788: instruction is presented in a different window.</p>
1.30 cvs 2789:
2790: <p>When printing a document, it is possible to print any number of views,
1.37 cvs 2791: chosen from among all the views which the editor can display. Print views, as
2792: well as the order in which they must be printed, are indicated by the
2793: <tt>PRINT</tt> instruction. It appears after the <tt>VIEWS</tt> instruction
2794: and is formed of the keyword <tt>PRINT</tt> followed by the ordered list of
2795: print view names. The print view names are separated by commas and followed
2796: by a semi-colon. A print view name is a view name declared in the
2797: <tt>VIEWS</tt> instruction.</p>
1.18 cvs 2798: <pre> 'PRINT' PrintViewSeq
1.30 cvs 2799: PrintViewSeq = PrintView < ',' PrintView > ';' .
1.37 cvs 2800: PrintView = ViewID .</pre>
1.30 cvs 2801:
2802: <p>If the <tt>PRINT</tt> instruction is absent, the printing program will
2803: print only the principal view (the first view specified by the <tt>VIEWS</tt>
1.18 cvs 2804: instruction or the single, unnamed view when there is no <tt>VIEWS</tt>
2805: instruction).</p>
1.30 cvs 2806:
1.18 cvs 2807: <blockquote class="example">
1.30 cvs 2808: <p><strong>Example:</strong></p>
2809:
2810: <p>Consider a Report presentation using the view declarations from the
1.37 cvs 2811: preceding example. Suppose we want to print the full text and table of
1.30 cvs 2812: contents views, but not the Formulas view, which is only useful when
1.37 cvs 2813: editing. A sensible printing order would be to print the full text followed
2814: by the table of contents. To obtain this result when printing, the
2815: presentation schema would say:</p>
1.30 cvs 2816: <pre>PRINT
1.37 cvs 2817: Full_text, Table_of_contents;</pre>
1.18 cvs 2818: </blockquote>
2819: </div>
2820:
2821: <div class="subsection">
1.37 cvs 2822: <h3><a name="sectc424" id="sectc424">Counters</a></h3>
1.18 cvs 2823:
1.30 cvs 2824: <p>A presentation has a <em>counter</em> for each type of number in the
1.37 cvs 2825: presentation. All counters, and therefore all types of numbers, used in the
1.18 cvs 2826: schema must be declared after the <tt>COUNTERS</tt> keyword.</p>
1.30 cvs 2827:
2828: <p>Each counter declaration is composed of a name identifying the counter
1.1 cvs 2829: followed by a colon and the counting function to be applied to the counter.
1.18 cvs 2830: The counter declaration ends with a semi-colon.</p>
1.30 cvs 2831:
2832: <p>The counting function indicates how the counter values will be calculated.
1.37 cvs 2833: Three types of counting functions are available. The first type is used to
1.16 cvs 2834: count the elements of a list or aggregate: it assigns to the counter the rank
1.37 cvs 2835: of the element in the list or aggregate. More precisely, the function</p>
1.18 cvs 2836: <pre>RANK OF ElemID [ LevelAsc ] [ INIT AttrID ]
2837: [ 'REINIT' AttrID ]</pre>
1.30 cvs 2838:
2839: <p>indicates that when an element creates, by a creation rule (see the <a
1.18 cvs 2840: href="#sectc4232"><tt>Create</tt> instructions</a>), a presentation box
1.37 cvs 2841: containing the counter value, this value is the rank of the creating element,
1.18 cvs 2842: if it is of type <tt>ElemID</tt>, otherwise the rank of the first element of
2843: type <tt>ElemID</tt> which encloses the creating element in the logical
2844: structure of the document.</p>
1.30 cvs 2845:
2846: <p>The type name can be preceded by a star in the special case where the
1.18 cvs 2847: structure schema defines an element of whose <tt>ElemID</tt> is the same as
2848: that of an <a href="#sectd3284">inclusion</a> without expansion or with
1.37 cvs 2849: partial expansion. To resolve this ambiguity, the <tt>ElemID</tt> alone
1.18 cvs 2850: refers to the type defined in the structure schema while the <tt>ElemID</tt>
2851: preceded by a star refers to the included type.</p>
1.30 cvs 2852:
1.37 cvs 2853: <p>The type name <tt>ElemID</tt> can be followed by an integer. That number
2854: represents the relative level, among the ancestors of the creating element,
2855: of the element whose rank is asked. If that relative level <i>n</i> is
2856: unsigned, the <i>n</i><sup>th</sup> element of type <tt>ElemID</tt>
2857: encountered when travelling the logical structure from the root to the
2858: creating element is taken into account. If the relative level is negative,
2859: the logical structure is travelled in the other direction, from the creating
2860: element to the root.</p>
1.30 cvs 2861:
1.37 cvs 2862: <p>The function can end with the keyword <tt>INIT</tt> followed by the name
2863: of a numeric attribute (and only a numeric attribute). Then, the rank of the
1.30 cvs 2864: first element of the list or aggregate is considered to be the value of this
1.1 cvs 2865: attribute, rather than the default value of 1, and the rank of the other
1.37 cvs 2866: elements is shifted accordingly. The attribute which determines the initial
1.18 cvs 2867: value is searched on the element itself and on its ancestors.</p>
1.30 cvs 2868:
2869: <p>The function can end with the keyword <tt>REINIT</tt> followed by the name
1.37 cvs 2870: of a numeric attribute (and only a numeric attribute). Then, if an element to
1.30 cvs 2871: be counted has this attribute, the counter value for this element is the
1.1 cvs 2872: attribute value and the following elements are numbered starting from this
1.18 cvs 2873: value.</p>
1.30 cvs 2874:
2875: <p>When the <tt>RANK</tt> function is written</p>
1.18 cvs 2876: <pre>RANK OF Page [ ViewID ] [ INIT AttrID ]</pre>
1.30 cvs 2877:
2878: <p>(<tt>Page</tt>is a keyword of the P language), the counter takes as its
2879: value the number of the page on which the element which creates the
1.37 cvs 2880: presentation box containing the number appears. This is done as if the pages
2881: of the document form a list for each view. The counter only takes into
1.30 cvs 2882: account the pages of the relevant view, that is the view displaying the
1.37 cvs 2883: presentation box whose contents take the value of the number. However, if the
2884: keyword <tt>Page</tt> is followed by the name of a view (between
2885: parentheses), it is the pages of that view that are taken into account. As in
2886: the preceding form, the <tt>RANK</tt> function applied to pages can end with
2887: the <tt>INIT</tt> keyword followed by the name of a numeric attribute which
2888: sets the value of the first page's number. This attribute must be a local
1.30 cvs 2889: attribute of the document itself, and not of one of its components.</p>
2890:
2891: <p>The second counting function is used to count the occurrences of a certain
1.37 cvs 2892: element type in a specified context. The instruction</p>
1.18 cvs 2893: <pre>SET n ON Type1 ADD m ON Type2 [ INIT AttrID ]</pre>
1.30 cvs 2894:
2895: <p>says that when the document is traversed from beginning to end (in the
2896: order induced by the logical structure), the counter is assigned the value
1.18 cvs 2897: <tt>n</tt> each time an element of type <tt>Type1</tt> is encountered, no
2898: matter what the current value of the counter, and the value <tt>m</tt> is
2899: added to the current value of the counter each time an element of type
2900: <tt>Type2</tt> is encountered.</p>
1.30 cvs 2901:
2902: <p>As with the <tt>RANK</tt> function, the type names can be preceded by a
2903: star to resolve the ambiguity of included elements.</p>
2904:
1.37 cvs 2905: <p>If the function ends with the keyword <tt>INIT</tt> followed by the name
2906: of an attribute and if the document possesses this attribute, the value of
2907: this attribute is used in place of <tt>n</tt>. The attribute must be numeric.
2908: It is searched on the element itself and on its ancestors.</p>
1.30 cvs 2909:
2910: <p>This function can also be used with the <tt>Page</tt> keyword in the place
1.37 cvs 2911: of <tt>Type1</tt> or <tt>Type2</tt>. In the first case, the counter is
1.18 cvs 2912: reinitialized on each page with the value <tt>n</tt>, while in the second
1.37 cvs 2913: case, it is incremented by <tt>m</tt> on each page. As with the preceding
1.18 cvs 2914: counting function, the word <tt>Page</tt> can be followed by a name between
1.37 cvs 2915: parentheses. In this case, the name specifies a view whose pages are taken
1.18 cvs 2916: into account.</p>
1.30 cvs 2917:
2918: <p>The definition of a counter can contain several <tt>SET</tt> functions and
1.37 cvs 2919: several <tt>ADD</tt> functions, each with a different value. The total number
1.18 cvs 2920: of counting functions must not be greater than 6.</p>
1.30 cvs 2921:
1.37 cvs 2922: <p>The third counting function is used to count the elements of a certain
2923: type encountered when travelling from the creating element to the root of the
2924: logical structure. The creating element is included if it is of that type.
1.18 cvs 2925: That function is written</p>
2926: <pre>RLEVEL OF Type</pre>
1.30 cvs 2927:
2928: <p>where <tt>Type</tt> represents the type of the elements to be counted.</p>
2929:
2930: <p>The formal definition of counter declarations is:</p>
1.18 cvs 2931: <pre> 'COUNTERS' CounterSeq
1.30 cvs 2932: CounterSeq = Counter < Counter > .
1.1 cvs 2933: Counter = CounterID ':' CounterFunc ';' .
2934: CounterID = NAME .
2935: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
1.16 cvs 2936: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
1.30 cvs 2937: SetFunction < SetFunction >
2938: AddFunction < AddFunction >
1.16 cvs 2939: [ 'INIT' AttrID ] /
2940: 'RLEVEL' 'OF' ElemID .
1.1 cvs 2941: SLevelAsc = [ '-' ] LevelAsc .
2942: LevelAsc = NUMBER .
2943: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
2944: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
2945: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
1.16 cvs 2946: [ '*' ] ElemID .
1.18 cvs 2947: CounterValue = NUMBER .</pre>
1.30 cvs 2948:
1.18 cvs 2949: <blockquote class="example">
1.30 cvs 2950: <p><strong>Example:</strong></p>
2951:
2952: <p>If the body of a chapter is defined as a sequence of sections in the
2953: structure schema:</p>
2954: <pre>Chapter_body = LIST OF (Section =
1.1 cvs 2955: BEGIN
2956: Section_Title = Text;
2957: Section_Body = Paragraphs;
2958: END
1.18 cvs 2959: );</pre>
1.30 cvs 2960:
2961: <p>the section counter is declared:</p>
2962: <pre>SectionCtr : RANK OF Section;</pre>
2963:
2964: <p>and the display of the section number before the section title is
2965: obtained by a <a href="#sectc4232"><tt>CreateBefore</tt> rule</a> attached
2966: the <tt>Section_Title</tt> type, which creates a presentation box whose
2967: content is the value of the <tt>SectionCtr</tt> counter (see the <a
2968: href="#sectc4231"><tt>Content</tt> instruction</a>).</p>
2969:
2970: <p>In order to number the formulas separately within each chapter, the
2971: formula counter is declared:</p>
2972: <pre>FormulaCtr : SET 0 ON Chapter ADD 1 ON Formula;</pre>
2973:
1.37 cvs 2974: <p>and the display of the formula number in the right margin, alongside
2975: each formula, is obtained by a <tt>CreateAfter</tt> instruction attached to
2976: the <tt>Formula</tt> type, which creates a presentation box whose content
2977: is the value of the <tt>FormulaCtr</tt> counter.</p>
1.30 cvs 2978:
2979: <p>To number the page chapter by chapter, with the first page of each
2980: chapter having the number 1, the counter definition would be</p>
2981: <pre>ChapterPageCtr : SET 0 ON Chapter ADD 1 ON Page;</pre>
2982:
2983: <p>If there is also a chapter counter</p>
2984: <pre>ChapterCtr : RANK OF Chapter;</pre>
2985:
1.37 cvs 2986: <p>the <a href="#sectc4231">content</a> of a presentation box created at
2987: the top of each page could be defined as:</p>
1.30 cvs 2988: <pre>Content : (VALUE(ChapterCtr, URoman) TEXT '-'
1.18 cvs 2989: VALUE(ChapterPageCtr, Arabic));</pre>
1.30 cvs 2990:
2991: <p>Thus, the presentation box contains the number of the chapter in
2992: upper-case roman numerals followed by a hyphen and the number of the page
2993: within the chapter in arabic numerals.</p>
1.18 cvs 2994: </blockquote>
1.30 cvs 2995:
1.18 cvs 2996: <blockquote class="example">
1.30 cvs 2997: <p><strong>Example:</strong></p>
2998:
1.37 cvs 2999: <p>To count tables and figures together in a document of the chapter type,
3000: a counter could be defined using:</p>
1.30 cvs 3001: <pre>CommonCtr : SET 0 ON Chapter ADD 1 ON Table
1.18 cvs 3002: ADD 1 ON Figure;</pre>
3003: </blockquote>
3004: </div>
1.1 cvs 3005:
1.18 cvs 3006: <div class="subsection">
1.37 cvs 3007: <h3><a name="sectc425" id="sectc425">Presentation constants</a></h3>
1.1 cvs 3008:
1.30 cvs 3009: <p>Presentation constants are used in the definition of the content of
1.37 cvs 3010: presentation boxes. This content is used in <a href="#sectc426">variable
3011: definitions</a> and in the <a href="#sectc4231"><tt>Content</tt> rule</a>.
3012: The only presentation constants which can be used are character strings,
1.2 cvs 3013: mathematical symbols, graphical elements, and pictures, that is to say, base
1.18 cvs 3014: elements.</p>
1.30 cvs 3015:
3016: <p>Constants can be defined directly in the variables or presentation boxes
1.37 cvs 3017: (<tt>Content</tt> rule) which use them. But it is only necessary them to
1.1 cvs 3018: declare once, in the constant declaration section, even though they are used
1.37 cvs 3019: in many variables or boxes. Thus, each declared constant has a name, which
1.1 cvs 3020: allows it to be designated whenever it is used, a type (one of the four base
3021: types) and a value (a character string or a single character for mathematical
1.18 cvs 3022: symbols and graphical elements).</p>
1.30 cvs 3023:
1.37 cvs 3024: <p>The constant declarations appear after the keyword <tt>CONST</tt>. Each
3025: declaration is composed of the name of the constant, an equals sign, a
3026: keyword representing its type (<tt>Text</tt>, <tt>Symbol</tt>,
3027: <tt>Graphics</tt> or <tt>Picture</tt>) and the string representing its value.
3028: A semi-colon terminates each declaration.</p>
1.30 cvs 3029:
3030: <p>In the case of a character string, the keyword <tt>Text</tt> can be
3031: followed by the name of an alphabet (for example, <tt>Greek</tt> or
1.37 cvs 3032: <tt>Latin</tt>) in which the constant's text should be expressed. If the
3033: alphabet name is absent, the Latin alphabet is used. When the alphabet name
3034: is present, only the first letter of the alphabet name is interpreted. Thus,
3035: the words <tt>Greek</tt> and <tt>Grec</tt> designate the same alphabet. In
1.30 cvs 3036: current versions of Thot, only the Greek and Latin alphabets are
3037: available.</p>
1.18 cvs 3038: <pre> 'CONST' ConstSeq
1.30 cvs 3039: ConstSeq = Const < Const > .
1.1 cvs 3040: Const = ConstID '=' ConstType ConstValue ';' .
3041: ConstID = NAME .
3042: ConstType ='Text' [ Alphabet ] / 'Symbol' /
3043: 'Graphics' / 'Picture' .
3044: ConstValue = STRING .
1.18 cvs 3045: Alphabet = NAME .</pre>
1.30 cvs 3046:
3047: <p>For character strings in the Latin alphabet (ISO Latin-1 character set),
1.1 cvs 3048: characters having codes higher than 127 (decimal) are represented by their
1.18 cvs 3049: code in octal.</p>
1.30 cvs 3050:
3051: <p>In the case of a symbol or graphical element, the value only contains a
1.37 cvs 3052: single character, between apostrophes, which indicates the form of the
3053: element which must be drawn in the box whose content is the constant. The
3054: symbol or graphical element takes the dimensions of the box, which are
3055: determined by the <tt>Height</tt> and <tt>Width</tt> rules. See <a
3056: href="#sectb72">table of codes</a> for the symbols and graphical elements.</p>
1.30 cvs 3057:
1.18 cvs 3058: <blockquote class="example">
1.30 cvs 3059: <p><strong>Example:</strong></p>
3060:
3061: <p>The constants ``Summary:'' and fraction bar, which were described
3062: earlier, are declared:</p>
3063: <pre>CONST
1.1 cvs 3064: SummaryConst = Text 'Summary:';
1.18 cvs 3065: Bar = Graphics 'h';</pre>
3066: </blockquote>
3067: </div>
1.1 cvs 3068:
1.18 cvs 3069: <div class="subsection">
1.37 cvs 3070: <h3><a name="sectc426" id="sectc426">Variables</a></h3>
1.1 cvs 3071:
1.37 cvs 3072: <p>Variables permit the definition of computed content for presentation
3073: boxes. A variable is associated with a presentation box by a <tt>Content</tt>
3074: rule; but before being used in a <tt>Content</tt> rule, a variable can be
3075: defined in the <tt>VAR</tt> section. It is also possible to define a variable
3076: at the time of its use in a <tt>Content</tt> rule, as can be done with a
1.30 cvs 3077: constant.</p>
3078:
3079: <p>A variable has a name and a value which is a character string resulting
1.37 cvs 3080: from the concatenation of the values of a sequence of functions. Each
1.30 cvs 3081: variable declaration is composed of the variable name followed by a colon and
1.37 cvs 3082: the sequence of functions which produces its value, separated by spaces. Each
1.18 cvs 3083: declaration is terminated by a semi-colon.</p>
3084: <pre> 'VAR' VarSeq
1.30 cvs 3085: VarSeq = Variable < Variable > .
1.1 cvs 3086: Variable = VarID ':' FunctionSeq ';' .
3087: VarID = NAME .
1.30 cvs 3088: FunctionSeq = Function < Function > .</pre>
3089:
1.37 cvs 3090: <p>Several functions are available. The first two return, in the form of a
3091: character string, the current date. <tt>DATE</tt> returns the date in
1.18 cvs 3092: English, while <tt>FDATE</tt> returns the date in french.</p>
1.30 cvs 3093:
3094: <p>Two other functions, <tt>DocName</tt> and <tt>DirName</tt>, return the
1.18 cvs 3095: document name and the directory where the document is stored.</p>
1.30 cvs 3096:
1.38 cvs 3097: <p>Function <tt>ElemName</tt> returns the name of the element which created
1.30 cvs 3098: the presentation box whose contents are the variable.</p>
3099:
1.38 cvs 3100: <p>Function <tt>AttributeName</tt> returns the name of the attribute which
3101: created the presentation box whose contents are the variable. The
3102: presentation box must be created by an attribute.</p>
3103:
3104: <p>Function <tt>AttributeValue</tt> returns the value of the attribute which
3105: created the presentation box whose contents are the variable. The
3106: presentation box must be created by an attribute.</p>
3107:
1.30 cvs 3108: <p>Another function simply returns the value of a presentation constant. For
3109: any constant declared in the <tt>CONST</tt> section, it is sufficient to give
1.37 cvs 3110: the name of the constant. Otherwise, the type and value of the constant must
1.30 cvs 3111: be given, using the same form as in a <a href="#sectc425">constant
1.18 cvs 3112: declaration</a>. If the constant is not of type text, (types <tt>Symbol</tt>,
3113: <tt>Graphics</tt> or <tt>Picture</tt>), it must be alone in the variable
3114: definition; only constants of type <tt>Text</tt> can be mixed with other
3115: functions.</p>
1.30 cvs 3116:
3117: <p>It is also possible to obtain the value of an attribute, simply by
1.37 cvs 3118: mentioning the attribute's name. The value of this function is the value of
1.30 cvs 3119: the attribute for the element which created the presentation box whose
1.37 cvs 3120: contents are the variable. If the creating element does not have the
3121: indicated attribute, the value is an empty string. In the case of a numeric
1.30 cvs 3122: attribute, the attribute is translated into a decimal number in arabic
1.37 cvs 3123: numerals. If another form is desired, the <tt>VALUE</tt> function must be
1.30 cvs 3124: used.</p>
3125:
3126: <p>The last available function returns, as a character string, the value of a
1.1 cvs 3127: counter, an attribute or a page number. This value can be presented in
1.37 cvs 3128: different styles. The keyword <tt>VALUE</tt> is followed (between
1.1 cvs 3129: parentheses) by the name of the counter, the name of the attribute, or the
1.18 cvs 3130: keyword <tt>PageNumber</tt> and the desired style, the two parameters being
1.37 cvs 3131: separated by a comma. The style is a keyword which indicates whether the
1.18 cvs 3132: value should be presented in arabic numerals (<tt>Arabic</tt>), lower-case
3133: roman numerals (<tt>LRoman</tt>), or upper-case roman numerals
3134: (<tt>URoman</tt>), or by an upper-case letter (<tt>Uppercase</tt>) or
3135: lower-case letter (<tt>Lowercase</tt>).</p>
1.30 cvs 3136:
3137: <p>For a page counter, the keyword <tt>PageNumber</tt> can be followed,
3138: between parentheses, by the name of the view from which to obtain the page
1.37 cvs 3139: number. By default, the first view declared in the <tt>VIEWS</tt> section is
3140: used. The value obtained is the number of the page on which is found the
1.30 cvs 3141: element that is using the variable in a <tt>Content</tt> rule.</p>
3142:
3143: <p>For an ordinary counter, the name of the counter can be preceded by the
1.37 cvs 3144: keyword <tt>MaxRangeVal</tt> or <tt>MinRangeVal</tt>. These keywords mean
1.1 cvs 3145: that the value returned by the function is the maximum (minimum resp.) value
3146: taken by the counter in the whole document, not the value for the element
1.18 cvs 3147: concerned by the function.</p>
3148: <pre> Function = 'DATE' / 'FDATE' /
1.1 cvs 3149: 'DocName' / 'DirName' /
1.38 cvs 3150: 'ElemName' / 'AttributeName' / 'AttributeValue' /
1.1 cvs 3151: ConstID / ConstType ConstValue /
3152: AttrID /
3153: 'VALUE' '(' PageAttrCtr ','
3154: CounterStyle ')' .
1.6 cvs 3155: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
1.1 cvs 3156: [ MinMax ] CounterID / AttrID .
3157: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
3158: 'Uppercase' / 'Lowercase' .
1.18 cvs 3159: MinMax = 'MaxRangeVal' / 'MinRangeVal' .</pre>
1.30 cvs 3160:
1.18 cvs 3161: <blockquote class="example">
1.30 cvs 3162: <p><strong>Example:</strong></p>
3163:
3164: <p>To make today's date appear at the top of the first page of a report, a
3165: <a href="#sectc4232"><tt>CREATE</tt> rule</a> associated with the
3166: Report_Title element type generates a presentation box whose content
3167: (specified by the <tt>Content</tt> rule of that presentation box) is the
3168: variable:</p>
3169: <pre>VAR
1.18 cvs 3170: Todays_date : TEXT 'Version of ' DATE;</pre>
1.30 cvs 3171:
3172: <p>To produce, before each section title, the chapter number (in upper-case
3173: roman numerals) followed by the section number (in arabic numerals), two
3174: counters must be defined:</p>
3175: <pre>COUNTERS
1.1 cvs 3176: ChapterCtr : RANK OF Chapter;
1.18 cvs 3177: SectionCtr : RANK OF Section;</pre>
1.30 cvs 3178:
3179: <p>and the Section_Title element must create a presentation box whose
3180: content is the variable</p>
3181: <pre>VAR
1.1 cvs 3182: SectionNum : VALUE (ChapterCtr, URoman) TEXT '-'
1.18 cvs 3183: VALUE (SectionCtr, Arabic);</pre>
1.30 cvs 3184:
3185: <p>In order to make the page number on which each section begins appear in
3186: the table of contents view next to the section title, each Section_Title
3187: element must create a presentation box, visible only in the table of
3188: contents view, whose content is the variable:</p>
3189: <pre>VAR
1.1 cvs 3190: TitlePageNume :
1.18 cvs 3191: VALUE (PageNumber(Full_text), Arabic);</pre>
3192: </blockquote>
3193: </div>
1.1 cvs 3194:
1.18 cvs 3195: <div class="subsection">
1.37 cvs 3196: <h3><a name="sectc427" id="sectc427">Default presentation rules</a></h3>
1.1 cvs 3197:
1.30 cvs 3198: <p>In order to avoid having to specify, for each element type defined in the
1.1 cvs 3199: structure schema, values for every one of the numerous presentation
1.34 cvs 3200: properties, the presentation schema allows the definition of a set of default
1.37 cvs 3201: presentation rules. These rules apply to all the boxes of the elements
1.1 cvs 3202: defined in the structure schema and to the presentation boxes and page layout
1.37 cvs 3203: boxes defined in the presentation schema. Only rules which differ from these
1.18 cvs 3204: default need to be specified in other sections of the presentation schema.</p>
1.30 cvs 3205:
3206: <p>For the primary view, the default rules can define every presentation
1.34 cvs 3207: property, but not the <a href="#presfunct">presentation functions</a> or the
1.18 cvs 3208: <a href="#sectc4223">linebreaking conditions</a> (the <tt>NoBreak1</tt>,
3209: <tt>NoBreak2</tt>, and <tt>Gather</tt> rules).</p>
1.30 cvs 3210:
3211: <p>In a presentation schema, the default presentation rules section is
3212: optional; in this case, the <tt>DEFAULT</tt> keyword is also absent and the
3213: following rules are considered to be the default rules:</p>
1.26 cvs 3214: <pre> Visibility: Enclosing =;
3215: VertRef: * . Left;
3216: HorizRef: Enclosed . HRef;
3217: Height: Enclosed . Height;
3218: Width: Enclosed . Width;
3219: VertPos: Top = Previous . Bottom;
3220: HorizPos: Left = Enclosing . Left;
3221: MarginTop: 0;
3222: MarginRight: 0;
3223: MarginBottom: 0;
3224: MarginLeft: 0;
3225: PaddingTop: 0;
3226: PaddingRight: 0;
3227: PaddingBottom: 0;
3228: PaddingLeft: 0;
3229: BorderTopWidth: 0;
3230: BorderRightWidth: 0;
3231: BorderBottomWidth: 0;
3232: BorderLeftWidth: 0;
3233: BorderTopColor: Foreground;
3234: BorderRightColor: Foreground;
3235: BorderBottomColor: Foreground;
3236: BorderLeftColor: Foreground;
3237: BorderTopStyle: None;
3238: BorderRightStyle: None;
3239: BorderBottomStyle: None;
3240: BorderLeftStyle: None;
3241: VertOverflow: No;
3242: HorizOverflow: No;
3243: Size: Enclosing =;
3244: Style: Enclosing =;
3245: Weight: Enclosing =;
3246: Font: Enclosing =;
3247: Underline: Enclosing =;
3248: Thickness: Enclosing =;
3249: Indent: Enclosing =;
3250: LineSpacing: Enclosing =;
3251: Adjust: Enclosing =;
3252: Hyphenate: Enclosing =;
3253: PageBreak: Yes;
3254: LineBreak: Yes;
3255: InLine: Yes;
3256: Depth: 0;
3257: LineStyle: Enclosing =;
3258: LineWeight: Enclosing =;
3259: FillPattern: Enclosing =;
3260: Background: Enclosing =;
3261: Foreground: Enclosing =;</pre>
1.30 cvs 3262:
3263: <p>If other values are desired for the default rules, they must be defined
1.37 cvs 3264: explicitly in the default rules section. In fact, it is only necessary to
1.1 cvs 3265: define those default rules which differ from the ones above, since the rules
1.18 cvs 3266: above will be used whenever a rule is not explicitly named.</p>
1.30 cvs 3267:
1.37 cvs 3268: <p>Default rules for views other than the primary view can also be specified.
1.1 cvs 3269: Otherwise, the default rules for the primary views are applied to the other
1.18 cvs 3270: views.</p>
1.30 cvs 3271:
3272: <p>Default rules are expressed in the same way as <a
3273: href="#sectc4215">explicit rules for document elements</a>.</p>
1.18 cvs 3274: </div>
1.1 cvs 3275:
1.18 cvs 3276: <div class="subsection">
1.37 cvs 3277: <h3><a name="sectc428" id="sectc428">Presentation and page layout
3278: boxes</a></h3>
1.1 cvs 3279:
1.30 cvs 3280: <p>The presentation process uses elements which are not part of the logical
1.1 cvs 3281: structure of the document, such as pages (which are the page layout boxes) or
3282: alternatively, rules, numbers, or words introducing certain parts of the
3283: document, such as ``Summary'', ``Appendices'', ``Bibliography'', etc. (which
1.18 cvs 3284: are presentation boxes).</p>
1.30 cvs 3285:
3286: <p>After the word <tt>BOXES</tt>, each presentation or page layout box is
3287: defined by its name and a sequence of presentation rules which indicate how
1.37 cvs 3288: they must be displayed. These rules are the same as those which define the
3289: boxes associated with element of the logical structure of the document, with
3290: a single exception, the <a href="#sectc4231"><tt>Content</tt> rule</a> which
3291: is used only to specify the content of presentation boxes. The content of
3292: boxes associated with elements of the document structure is defined in each
3293: document or object and thus is not specified in the presentation schema,
3294: which applies to all documents or objects of a class.</p>
1.30 cvs 3295:
3296: <p>Among the rules which define a presentation box, certain ones can refer to
1.37 cvs 3297: another presentation box (for example, in their positional rules). If the
1.1 cvs 3298: designated box is defined after the box which designates it, a
1.18 cvs 3299: <tt>FORWARD</tt> instruction followed by the name of the designated box must
3300: appear before the designation.</p>
3301: <pre> 'BOXES' BoxSeq
1.30 cvs 3302: BoxSeq = Box < Box > .
1.1 cvs 3303: Box ='FORWARD' BoxID ';' /
3304: BoxID ':' ViewRuleSeq .
1.18 cvs 3305: BoxID = NAME .</pre>
3306: </div>
1.1 cvs 3307:
1.18 cvs 3308: <div class="subsection">
1.37 cvs 3309: <h3><a name="sectc429" id="sectc429">Presentation of structured
3310: elements</a></h3>
1.1 cvs 3311:
1.30 cvs 3312: <p>After the words <tt>RULES</tt>, the presentation schema gives the
3313: presentation rules that apply to the elements whose types are defined in the
1.37 cvs 3314: structure schema. Only those rules which differ from the <a
1.18 cvs 3315: href="#sectc427">default</a> must be specified in the <tt>RULES</tt>
3316: section.</p>
1.30 cvs 3317:
3318: <p>The rule definitions for each element type are composed of the name of the
1.1 cvs 3319: element type (as specified in the structure schema) followed by a colon and
1.18 cvs 3320: the set of rules specific to that type.</p>
1.30 cvs 3321:
3322: <p>The type name can be preceded by a star in the special case where the
1.18 cvs 3323: structure schema defines an <a href="#sectd3284">inclusion</a> without
1.1 cvs 3324: expansion (or with partial expansion) of a type with the same name as an
1.18 cvs 3325: element of defined in the structure schema.</p>
1.30 cvs 3326:
3327: <p>In the case where the element is a <a href="#sectd3285">mark pair</a>, but
1.18 cvs 3328: only in this case, the type name can be preceded by the keywords
1.37 cvs 3329: <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether the rules
1.18 cvs 3330: that follow apply to the first or second mark of the pair.</p>
3331: <pre> 'RULES' PresentSeq
1.30 cvs 3332: PresentSeq = Present < Present > .
1.6 cvs 3333: Present = [ '*' ] [ FirstSec ] ElemID ':'
3334: ViewRuleSeq .
1.18 cvs 3335: FirstSec = 'First' / 'Second' .</pre>
1.30 cvs 3336:
3337: <p>A presentation schema can define presentation rules for base elements,
1.37 cvs 3338: which are defined implicitly in the structure schemas. In the English version
1.30 cvs 3339: of the presentation schema compiler, the base type names are the same as in
3340: the S language, but they are terminated by the <tt>_UNIT</tt> suffix:
1.18 cvs 3341: <tt>TEXT_UNIT</tt>, <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>,
1.37 cvs 3342: <tt>GRAPHICS_UNIT</tt>. The base type names are written in upper-case
1.18 cvs 3343: letters.</p>
3344: </div>
3345:
3346: <div class="subsection">
1.37 cvs 3347: <h3><a name="sectc4210" id="sectc4210">Logical attribute presentation</a></h3>
1.18 cvs 3348:
1.30 cvs 3349: <p>After the keyword <tt>ATTRIBUTES</tt>, all attributes which are to have
1.37 cvs 3350: some effect on the presentation of the element to which they are attached
3351: must be mentioned, along with the corresponding presentation rules. This is
3352: true for both global attributes (which can be attached to all element types)
3353: and local attributes (which can only be attached to certain element
3354: types).</p>
1.30 cvs 3355:
3356: <p>Also mentioned in this section are attributes which imply an effect on
1.1 cvs 3357: elements in the subtree of the element to which they are attached. The
1.37 cvs 3358: presentation of these descendants can be modified as a function of the value
1.1 cvs 3359: of the attribute which they inherit, just as if it was attached to them
1.18 cvs 3360: directly.</p>
1.30 cvs 3361:
3362: <p>The specification for each attribute includes the attribute's name,
3363: followed by an optional value specification and, after a colon, a set of
1.37 cvs 3364: rules. The set of rules must contain at least one rule.</p>
1.30 cvs 3365:
1.37 cvs 3366: <p>When there is no value specification, the rules are applied to all
3367: elements which carry the attribute, no matter what their value. When the
3368: rules must only apply when the attribute has certain values, these values
3369: must be specified. Thus, the same attribute can appear in the
3370: <tt>ATTRIBUTES</tt> section several times, with each appearance having a
3371: different value specification. However, reference attributes never have a
3372: value specification and, as a result, can only appear once in the
3373: <tt>ATTRIBUTES</tt> section.</p>
1.30 cvs 3374:
3375: <p>To specify that the presentation rules apply to some of the descendants of
3376: the element having the attribute, the name of the affected element type is
1.37 cvs 3377: given, between parentheses, after the attribute name. This way, the
3378: presentation rules for the attribute will be applied to the element having
3379: the attribute, if it is of the given type, and to all of its descendants of
3380: the given type. In the case where this type is a <a href="#sectd3285">mark
3381: pair</a>, but only in this case, the type name can be preceded by the
3382: keywords <tt>First</tt> or <tt>Second</tt>. These keywords indicate whether
3383: the rules that follow apply to the first or second mark of the pair. If the
3384: rule must apply to several different element types, the specification must be
3385: repeated for each element type.</p>
1.30 cvs 3386:
3387: <p>The specification of values for which the presentation rules will be
3388: applied varies according to the type of the attribute:</p>
1.18 cvs 3389: <dl>
1.30 cvs 3390: <dt>numeric attribute</dt>
3391: <dd>If the rules are to apply for one value of the attribute, then the
1.37 cvs 3392: attribute name is followed by an equals sign and this value. If the
1.30 cvs 3393: rules are to apply for all values less than (or greater than) a
3394: threshold value, non-inclusive, the attribute name followed by a '<'
1.37 cvs 3395: sign (or a '>' sign, respectively) and the threshold value. If the
3396: rules must apply to a range of values, the attribute name is followed
3397: by the word '<tt>IN</tt>' and the two bounds of the range, enclosed in
3398: brackets and separated by two periods ('<tt>..</tt>'). In the case of
3399: ranges, the values of the bounds are included in the range.
1.30 cvs 3400: <p>The threshold value in the comparisons can be the value of an
1.37 cvs 3401: attribute attached to an ancestor element. In this case, the attribute
1.30 cvs 3402: name is given instead of a constant value.</p>
1.37 cvs 3403: <p>It is also possible to write rules which apply only when a
3404: comparison between two different attributes of the element's ancestors
3405: is true. In this case, the first attribute name is followed by a
3406: comparison keyword and the name of the second attribute. The comparison
3407: keywords are <tt>EQUAL</tt> (simple equality), <tt>LESS</tt>
3408: (non-inclusive less than), and <tt>GREATER</tt> (non-inclusive greater
3409: than).</p>
1.30 cvs 3410: </dd>
3411: <dt>text attribute</dt>
3412: <dd>If the rules are to apply for one value of the attribute, then the
3413: attribute name is followed by an equals sign and this value.</dd>
3414: <dt>reference attribute</dt>
3415: <dd>There is never a value specification; the rules apply no matter what
3416: element is designated by the attribute.</dd>
3417: <dt>enumerated attribute</dt>
3418: <dd>If the rules are to apply for one value of the attribute, then the
3419: attribute name is followed by an equals sign and this value.</dd>
1.18 cvs 3420: </dl>
1.30 cvs 3421:
3422: <p>The order in which the rules associated with a numeric attribute are
1.37 cvs 3423: defined is important. When multiple sets of rules can be applied, the first
1.30 cvs 3424: set declared is the one used.</p>
3425:
3426: <p>Rules for attributes have priority over both default rules and rules
1.37 cvs 3427: associated with element types. The attribute rules apply to the element to
3428: which the attribute is attached. It is the rules which apply to the
1.1 cvs 3429: surrounding elements (and especially to the descendants) which determine the
3430: effect of the attribute rules on the environment ( and especially on the
1.18 cvs 3431: terminal elements of the structure).</p>
3432: <pre> 'ATTRIBUTES' PresAttrSeq
1.30 cvs 3433: PresAttrSeq = PresAttr < PresAttr > .
1.1 cvs 3434: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
3435: [ AttrRelation ] ':' ViewRuleSeq .
3436: AttrID = NAME .
3437: AttrRelation ='=' AttrVal /
1.30 cvs 3438: '>' [ '-' ] MinValue /
1.1 cvs 3439: '<' [ '-' ] MaxValue /
3440: 'IN' '[' [ '-' ] LowerBound '..'
3441: [ '-' ] UpperBound ']' /
3442: 'GREATER' AttrID /
3443: 'EQUAL' AttrID /
3444: 'LESS' AttrID .
3445: AttrVal = [ '-' ] EqualNum / EqualText /
3446: AttrValue .
3447: MinValue = NUMBER .
3448: MaxValue = NUMBER .
3449: LowerBound = NUMBER .
3450: UpperBound = NUMBER.
3451: EqualNum = NUMBER .
3452: EqualText = STRING .
1.18 cvs 3453: AttrValue = NAME .</pre>
1.30 cvs 3454:
1.37 cvs 3455: <p>In presentation rules associated with a numeric attribute (and only in
3456: such rules), the attribute name can be used in place of a numeric value. In
3457: this case, the value of the attribute is used in the application of the rule.
3458: Thus, the attribute can represent a relation between the size of two boxes,
3459: the height and width of a box, the height of an area where page breaks are
3460: prohibited, the distance between two boxes, the position of the reference
3461: axis of a box, the interline spacing, the indentation of the first line, the
1.18 cvs 3462: visibility, the depth (z-order), or the character set.</p>
1.30 cvs 3463:
1.37 cvs 3464: <p>The presentation rules associated with reference attributes, it is
3465: possible to use the element designated by the attribute as a reference box in
3466: a positional or extent rule. This element is represented in the <a
1.18 cvs 3467: href="#sectc4218">position</a> or <a href="#sectc4219">extent</a> rule by the
3468: keyword <tt>Referred</tt>.</p>
1.30 cvs 3469:
1.18 cvs 3470: <blockquote class="example">
1.30 cvs 3471: <p><strong>Example:</strong></p>
3472:
1.37 cvs 3473: <p>In all structure schemas, there is a global Language attribute defined
3474: as follows:</p>
1.30 cvs 3475: <pre>ATTR
1.18 cvs 3476: Language = TEXT;</pre>
1.30 cvs 3477:
3478: <p>The following rules would make French text be displayed in roman
3479: characters and English text be displayed in italics:</p>
3480: <pre>ATTRIBUTES
1.1 cvs 3481: Language = 'French' :
1.6 cvs 3482: Style : Roman;
1.1 cvs 3483: Language = 'English' :
1.18 cvs 3484: Style : Italics;</pre>
1.30 cvs 3485:
3486: <p>Using these rules, when the user puts the Language attribute with the
3487: value 'English' on the summary of a document, every character string
1.37 cvs 3488: (terminal elements) contained in the summary are displayed in italics. See
1.30 cvs 3489: the <a href="#sectd42252"><tt>Style</tt> rule</a>.</p>
1.18 cvs 3490: </blockquote>
1.30 cvs 3491:
1.18 cvs 3492: <blockquote class="example">
1.30 cvs 3493: <p><strong>Example:</strong></p>
3494:
3495: <p>A numeric attribute representing the importance of the part of the
3496: document to which it is attached can be defined:</p>
3497: <pre>ATTR
1.18 cvs 3498: Importance = INTEGER;</pre>
1.30 cvs 3499:
3500: <p>In the presentation schema, the importance of an element is reflected in
3501: the choice of character size, using the following rules.</p>
3502: <pre>ATTRIBUTES
1.1 cvs 3503: Importance < 2 :
3504: Size : 1;
3505: Importance IN [2..4] :
3506: Size : Importance;
3507: Importance = 10 :
3508: Size : 5;
1.30 cvs 3509: Importance > 4 :
1.18 cvs 3510: Size : 4;</pre>
1.30 cvs 3511:
3512: <p>Thus, the character size corresponds to the value of the Importance
3513: attribute; its value is</p>
3514: <ul>
3515: <li>the value of the Importance attribute when the value is between 2 and
3516: 4 (inclusive),</li>
3517: <li>1, when the value of the Importance attribute is less than 2,</li>
3518: <li>4, when the value of the Importance attribute is greater than 4,</li>
3519: <li>5, when the value of the Importance attribute is 10.</li>
3520: </ul>
3521:
1.37 cvs 3522: <p>The last case (value 5) must be defined before the case which handles
3523: all Importance values greater than 4, because the two rules are not
3524: disjoint and the first one defined will have priority. Otherwise, when the
3525: Importance attribute has value 10, the font size will be 4.</p>
1.18 cvs 3526: </blockquote>
1.30 cvs 3527:
1.18 cvs 3528: <blockquote class="example">
1.30 cvs 3529: <p><strong>Example:</strong></p>
3530:
3531: <p>Suppose the structure defines a list element which can have an attribute
3532: defining the type of list (numbered or not):</p>
3533: <pre>STRUCT
1.1 cvs 3534: list (ATTR list_type = enumeration, dash)
1.18 cvs 3535: = LIST OF (list_item = TEXT);</pre>
1.30 cvs 3536:
3537: <p>Then, the presentation schema could use the attribute placed on the list
3538: element to put either a dash or a number before the each element of the
3539: list:</p>
3540: <pre>ATTRIBUTES
1.1 cvs 3541: list_type (list_item) = enumeration :
3542: CreateBefore (NumberBox);
3543: list_type (list_item) = dash :
1.18 cvs 3544: CreateBefore (DashBox);</pre>
3545: </blockquote>
1.30 cvs 3546:
1.18 cvs 3547: <blockquote class="example">
1.30 cvs 3548: <p><strong>Example:</strong></p>
3549:
1.37 cvs 3550: <p>Suppose that two attributes are defined in the structure schema. The
3551: first is a numeric global attribute called ``version''. The other is a
1.30 cvs 3552: local attribute defined on the root of the document called
3553: ``Document_version'':</p>
3554: <pre>STRUCTURE Document
1.1 cvs 3555: ATTR
3556: version = INTEGER;
3557: STRUCT
3558: Document (ATTR Document_version = INTEGER) =
3559: BEGIN
3560: SomeElement ;
3561: ...
3562: SomeOtherElement ;
3563: END ;
1.18 cvs 3564: ...</pre>
1.30 cvs 3565:
3566: <p>These attributes can be used in the presentation schema to place change
3567: bars in the margin next to elements whose version attribute has a value
3568: equal to the Document_version attribute of the root and to place a star in
3569: margin of elements whose version attribute is less than the value of the
3570: root's Document_version attribute:</p>
3571: <pre>ATTRIBUTES
1.1 cvs 3572: version EQUAL Document_version :
3573: CreateBefore (ChangeBarBox) ;
3574: version LESS Document_version :
1.18 cvs 3575: CreateBefore (StarBox) ;</pre>
3576: </blockquote>
3577: </div>
1.1 cvs 3578:
1.18 cvs 3579: <div class="subsection">
1.37 cvs 3580: <h3><a name="sectc4212" id="sectc4212">Value transmission rules</a></h3>
1.1 cvs 3581:
1.30 cvs 3582: <p>The last section of a presentation schema, which is optional, serves to
1.1 cvs 3583: defines the way in which a document transmits certain values to its
1.37 cvs 3584: sub-documents. A sub-document is an document <a
1.18 cvs 3585: href="#inclusion">included</a> without expansion or with partial expansion.
1.1 cvs 3586: The primary document can transmit to its sub-documents the values of certain
3587: counters or the textual content of certain of its elements, as a function of
1.18 cvs 3588: their type.</p>
1.30 cvs 3589:
3590: <p>The sub-documents receive these values in attributes which must be defined
1.37 cvs 3591: in their structure schema as local attributes of the root element. The types
1.30 cvs 3592: of these attributes must correspond to the type of the value which they
3593: receive: numeric attributes for receiving the value of a counter, textual
3594: attributes for receiving the content of an element.</p>
3595:
3596: <p>In the structure schema of the primary document, there appears at the end,
1.37 cvs 3597: after the <tt>TRANSMIT</tt> keyword, a sequence of transmission rules. Each
1.1 cvs 3598: rule begins with the name of the counter to transmit or of the element type
1.37 cvs 3599: whose textual content will be transmitted. This name is followed by the
3600: keyword <tt>To</tt> and the name of the attribute of the sub-document to
3601: which the value is transmitted. The sub-document class is indicated between
3602: parentheses after the name of the attribute. The transmission rule ends with
1.18 cvs 3603: a semicolon.</p>
1.30 cvs 3604: <pre> TransmitSeq = Transmit < Transmit > .
1.1 cvs 3605: Transmit = TypeOrCounter 'To' ExternAttr
3606: '(' ElemID ')' ';' .
3607: TypeOrCounter = CounterID / ElemID .
1.18 cvs 3608: ExternAttr = NAME .</pre>
1.30 cvs 3609:
1.18 cvs 3610: <blockquote class="example">
1.30 cvs 3611: <p><strong>Example:</strong></p>
3612:
3613: <p>Consider a Book document class which includes instances of the Chapter
1.37 cvs 3614: document class. These classes might have the following schemas:</p>
1.30 cvs 3615: <pre>STRUCTURE Book
1.1 cvs 3616: STRUCT
3617: Book = BEGIN
3618: Title = Text;
3619: Body = LIST OF (Chapter INCLUDED);
3620: END;
3621: ...
3622:
3623: STRUCTURE Chapter
3624: STRUCT
3625: Chapter (ATTR FirstPageNum = Integer;
3626: ChapterNum = Integer;
3627: CurrentTitle = Text) =
1.6 cvs 3628: BEGIN
3629: ChapterTitle = Text;
3630: ...
3631: END;
1.18 cvs 3632: ...</pre>
1.30 cvs 3633:
3634: <p>Then the presentation schema for books could define chapter and page
3635: counters. The following transmission rules in the book presentation schema
3636: would transmit values for the three attributes defined at the root of each
3637: chapter sub-document.</p>
3638: <pre>PRESENTATION Book;
1.1 cvs 3639: VIEWS
3640: Full_text;
3641: COUNTERS
3642: ChapterCtr: Rank of Chapter;
3643: PageCtr: Rank of Page(Full_text);
3644: ...
3645: TRANSMIT
3646: PageCtr TO FirstPageNum(Chapter);
3647: ChapterCtr TO ChapterNum(Chapter);
3648: Title TO CurrentTitle(Chapter);
1.18 cvs 3649: END</pre>
1.30 cvs 3650:
3651: <p>Thus, each chapter included in a book can number its pages as a function
3652: of the number of pages preceding it in the book, can make the chapter's
3653: number appear before the number of each of its sections, or can place the
3654: title of the book at the top of each page.</p>
1.18 cvs 3655: </blockquote>
3656: </div>
1.1 cvs 3657:
1.18 cvs 3658: <div class="subsection">
1.37 cvs 3659: <h3><a name="sectc4213" id="sectc4213">Presentation rules</a></h3>
1.1 cvs 3660:
1.30 cvs 3661: <p>Whether defining the appearance of a presentation or page layout box, an
1.1 cvs 3662: element type, or an attribute value, the set of presentation rules that apply
1.18 cvs 3663: is always defined in the same way.</p>
1.30 cvs 3664:
3665: <p>Normally, a set of presentation rules is placed between the keywords
1.18 cvs 3666: <tt>BEGIN</tt> and <tt>END</tt>, the keyword <tt>END</tt> being followed by a
1.37 cvs 3667: semicolon. The first section of this block defines the rules that apply to
1.18 cvs 3668: the primary view, if the <a href="#sectc427">default rules</a> are not
1.37 cvs 3669: completely suitable. Next comes the rules which apply to specific other
1.1 cvs 3670: views, with a rule sequence for each view for which the default rules are not
1.37 cvs 3671: satisfactory. If the default rules are suitable for the non-primary views,
3672: there will not be any specific rules for these views. If there is only one
1.18 cvs 3673: rule which applies to all views then the keywords <tt>BEGIN</tt> and
3674: <tt>END</tt> need not appear.</p>
1.30 cvs 3675:
3676: <p>For each view, it is only necessary to specify those rules which differ
3677: from the default rules for the view, so that for certain views (or even all
3678: views), there may be no specific rules.</p>
3679:
3680: <p>The specific rules for a non-primary view are introduced by the <a
1.37 cvs 3681: name="inkeyword" id="inkeyword"><tt>IN</tt> keyword</a>, followed by the view
3682: name. The rules for that view follow, delimited by the keywords
3683: <tt>BEGIN</tt> and <tt>END</tt>, or without these two keywords when there is
3684: only one rule.</p>
1.30 cvs 3685:
3686: <p><strong>Note:</strong> the view name which follows the <tt>IN</tt> keyword
1.1 cvs 3687: must not be the name of the primary view, since the rules for that view are
1.18 cvs 3688: found before the rules for the other views.</p>
1.30 cvs 3689:
3690: <p>Within each block concerning a view, other blocks can appear, delimited by
1.37 cvs 3691: the same keywords <tt>BEGIN</tt> and <tt>END</tt>. Each of these blocks
3692: gathers the presentation rules that apply, for a given view, only when a
3693: given condition is satisfied. Each block is preceded by a condition
3694: introduced by the <tt>IF</tt> keyword. If such a conditional block contains
3695: only one rule, the keywords <tt>BEGIN</tt> and <tt>END</tt> can be
3696: omitted.</p>
3697:
3698: <p>Although the syntax allows any presentation rule to appear in a
3699: conditional block, only <a href="#sectc4232">creation rules</a> are allowed
3700: after any condition; other rules are allowed only after conditions
3701: <tt>Within</tt> and ElemID. In addition, the following rules cannot be
3702: conditional: <tt>PageBreak, LineBreak, Inline, Gather</tt>.</p>
1.30 cvs 3703:
3704: <p>For a given view, the rules that apply without any condition must appear
1.37 cvs 3705: before the first conditional block. If some rules apply only when none of the
3706: specified condition holds, they are grouped in a block preceded by the
3707: keyword <tt>Otherwise</tt>, and that block must appear after the last
3708: conditionnal block concerning the same view.</p>
1.30 cvs 3709: <pre> ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
1.1 cvs 3710: 'END' ';' /
3711: ViewRules / CondRules / Rule .
3712: RulesAndCond = CondRules / Rule .
3713: ViewRules = 'IN' ViewID CondRuleSeq .
1.30 cvs 3714: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
1.1 cvs 3715: CondRules / Rule .
1.30 cvs 3716: CondRules = CondRule < CondRule >
1.1 cvs 3717: [ 'Otherwise' RuleSeq ] .
3718: CondRule = 'IF' ConditionSeq RuleSeq .
1.30 cvs 3719: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' /
1.18 cvs 3720: Rule .</pre>
1.30 cvs 3721:
1.18 cvs 3722: <blockquote class="example">
1.30 cvs 3723: <p><strong>Example:</strong></p>
3724:
3725: <p>The following rules for a report's title make the title visible in the
1.37 cvs 3726: primary view and invisible in the table of contents and in the formula
3727: views (see the <a href="#sectc4224"><tt>Visibility</tt> rule</a>).</p>
1.30 cvs 3728: <pre>Title : BEGIN
1.1 cvs 3729: Visibility : 1;
3730: ... {Other rules for the primary view}
3731: IN Table_of_contents
3732: Visibility : 0;
3733: IN Formulas
3734: Visibility : 0;
1.18 cvs 3735: END;</pre>
3736: </blockquote>
3737: </div>
1.1 cvs 3738:
1.18 cvs 3739: <div class="subsection">
1.37 cvs 3740: <h3><a name="sectc4214" id="sectc4214">Conditions applying to presentation
3741: rules</a></h3>
1.1 cvs 3742:
1.37 cvs 3743: <p>Many conditions can be applied to presentation rules. Conditions allow
3744: certain presentation rules to apply only in certain cases. These conditions
3745: can be based on the structural position of the element. They can be based on
1.1 cvs 3746: whether the element has references, and what type of references, whether the
1.33 cvs 3747: element has attributes, whether the element is empty or not, whether the
3748: element is the root of its document or not. They can also be based on the
3749: value of a counter.</p>
1.30 cvs 3750:
1.37 cvs 3751: <p>It is possible to specify several conditions which must all be true for
3752: the rules to apply.</p>
1.30 cvs 3753:
1.37 cvs 3754: <p>A set of conditions is specified by the <tt>IF</tt> keyword. This keyword
1.30 cvs 3755: is followed by the sequence of conditions, separated by the <tt>AND</tt>
3756: keyword. Each condition is specified by a keyword which defines the condition
3757: type. In some cases, the keyword is followed by other data, which specify the
3758: condition more precisely.</p>
3759:
3760: <p>An elementary condition can be negative; it is then preceded by the
1.18 cvs 3761: <tt>NOT</tt> keyword.</p>
1.30 cvs 3762:
3763: <p>When the presentation rule(s) controlled by the condition apply to a
3764: reference element or a reference attribute, an elementary condition can also
1.37 cvs 3765: apply to element referred by this reference. The <tt>Target</tt> keyword is
3766: used for that purpose. It must appear before the keyword defining the
1.30 cvs 3767: condition type.</p>
1.18 cvs 3768: <pre> CondRule ='IF' ConditionSeq RuleSeq .
1.30 cvs 3769: ConditionSeq = Condition < 'AND' Condition > .
1.1 cvs 3770: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
3771: ConditionElem ='First' / 'Last' /
3772: [ 'Immediately' ] 'Within' [ NumParent ]
3773: ElemID [ ExtStruct ] /
3774: ElemID /
3775: 'Referred' / 'FirstRef' / 'LastRef' /
3776: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
3777: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
3778: 'UserPage' / 'StartPage' / 'ComputedPage' /
1.33 cvs 3779: 'Empty' / 'Root' /
1.1 cvs 3780: '(' [ MinMax ] CounterName CounterCond ')' /
3781: CondPage '(' CounterID ')' .
3782: NumParent = [ GreaterLess ] NParent .
1.30 cvs 3783: GreaterLess ='>' / '<' .
1.1 cvs 3784: NParent = NUMBER.
1.6 cvs 3785: ExtStruct ='(' ElemID ')' .
1.30 cvs 3786: CounterCond ='<' MaxCtrVal / '>' MinCtrVal /
1.1 cvs 3787: '=' EqCtrVal /
3788: 'IN' '[' ['-'] MinCtrBound '.' '.'
3789: ['-'] MaxCtrBound ']' .
3790: PageCond ='Even' / 'Odd' / 'One' .
3791: MaxCtrVal = NUMBER .
3792: MinCtrVal = NUMBER .
3793: EqCtrVal = NUMBER .
3794: MaxCtrBound = NUMBER .
1.18 cvs 3795: MinCtrBound = NUMBER .</pre>
1.1 cvs 3796:
1.18 cvs 3797: <div class="subsubsection">
1.37 cvs 3798: <h4><a name="sectd42141" id="sectd42141">Conditions based on the logical
3799: position of the element</a></h4>
1.30 cvs 3800:
3801: <p>The condition can be on the position of the element in the document's
1.37 cvs 3802: logical structure tree. It is possible to test whether the element is the
1.30 cvs 3803: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is
3804: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>). These
1.18 cvs 3805: conditions can be associated only with <a href="#sectc4232">creation
3806: rules</a>.</p>
1.30 cvs 3807:
1.33 cvs 3808: <p>It is possible to test if the element is the root of its document (keyword
3809: <code>Root</code>).</p>
3810:
1.30 cvs 3811: <p>It is also possible to test if the element is contained in an element of a
1.18 cvs 3812: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). The type
3813: is indicated after the keyword <tt>Within</tt>. If that element type is
1.1 cvs 3814: defined in a structure schema which is not the one which corresponds to the
3815: presentation schema, the type name of this element must be followed, between
1.18 cvs 3816: parentheses, by the name of the structure schema which defines it.</p>
1.30 cvs 3817:
3818: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the
1.18 cvs 3819: condition is satisfied only if the <em>parent</em> element has the type
3820: indicated. If the word <tt>Immediately</tt> is missing, the condition is
3821: satisfied if any <em>ancestor</em> has the type indicated.</p>
1.30 cvs 3822:
3823: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the
1.37 cvs 3824: type. It specifies the number of ancestors of the indicated type that must be
3825: present for the condition to be satisfied. If the keyword
1.18 cvs 3826: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the
1.37 cvs 3827: element must have the indicated type. The integer <i>n</i> must be positive
3828: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a
3829: maximum or minimum number of ancestors. If these symbols are missing, the
3830: condition is satisfied only if it exists exactly <i>n</i> ancestors. When
1.30 cvs 3831: this number is missing, it is equivalent to > 0.</p>
3832:
3833: <p>If the condition applies to presentation rules associated with an
3834: attribute, in the <tt>ATTRIBUTES</tt> section of the presentation schema, the
3835: condition can be simply an element name. Presentation rules are then executed
3836: only if the attribute is attached to an element of that type. The keyword
3837: <tt>NOT</tt> before the element name indicates that the presentation rules
3838: must be executed only if the element is not of the type indicated.</p>
1.18 cvs 3839: </div>
1.1 cvs 3840:
1.18 cvs 3841: <div class="subsubsection">
1.37 cvs 3842: <h4><a name="sectd42142" id="sectd42142">Conditions on references</a></h4>
1.30 cvs 3843:
3844: <p>References may be taken into account in conditions, which can be based on
3845: the fact that the element, or one of its ancestors, is designated by a at
3846: least one reference (<tt>Referred</tt>) or by none (<tt>NOT
3847: Referred</tt>).</p>
3848:
3849: <p>If the element or attribute to which the condition is attached is a
3850: reference, the condition can be based on the fact that it acts as the first
3851: reference to the designated element (<tt>FirstRef</tt>), or as the last
3852: (<tt>LastRef</tt>), or as a reference to an element located in another
3853: document (<tt>ExternalRef</tt>) or in the same document
3854: (<tt>InternalRef</tt>).</p>
1.1 cvs 3855:
1.30 cvs 3856: <p>The condition can also be based on the fact that the element is an <a
1.37 cvs 3857: href="#inclusion">inclusion</a>. This is noted (<tt>CopyRef</tt>).</p>
1.30 cvs 3858:
3859: <p>Like all conditions, conditions on references can be inverted by the
1.18 cvs 3860: <tt>NOT</tt> keyword. These conditions can be associated only with <a
3861: href="#sectc4232">creation rules</a>.</p>
3862: </div>
1.1 cvs 3863:
1.18 cvs 3864: <div class="subsubsection">
1.37 cvs 3865: <h4><a name="sectd42143" id="sectd42143">Conditions on logical
3866: attributes</a></h4>
1.30 cvs 3867:
3868: <p>The condition can be based on the presence or absence of attributes
3869: associated with the element, no matter what the attributes or their values.
3870: The <tt>AnyAttributes</tt> keyword expresses this condition.</p>
1.1 cvs 3871:
1.30 cvs 3872: <p>If the condition appears in the presentation rules of an attribute, the
1.37 cvs 3873: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate
3874: that the rules must only be applied if this attribute is the first attribute
3875: for the element or if it is the last (respectively). These conditions can
3876: also be inverted by the <tt>NOT</tt> keyword. These conditions can be
3877: associated only with <a href="#sectc4232">creation rules</a>.</p>
1.30 cvs 3878:
3879: <p>It is also possible to apply certain presentation rules only when the
3880: element being processed or one of its ancestors has a certain attribute,
1.37 cvs 3881: perhaps with a certain value. This can be done in the <a
1.18 cvs 3882: href="#sectc4210"><tt>ATTRIBUTES</tt> section</a>.</p>
3883: </div>
1.1 cvs 3884:
1.18 cvs 3885: <div class="subsubsection">
1.37 cvs 3886: <h4><a name="sectd42144" id="sectd42144">Conditions on page breaks</a></h4>
1.1 cvs 3887:
1.30 cvs 3888: <p>The page break base type (and only this type) can use the following
1.18 cvs 3889: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, and <tt>UserPage</tt>.
3890: The <tt>ComputedPage</tt> condition indicates that the presentation rule(s)
1.37 cvs 3891: should apply if the page break was created automatically by Thot; the
3892: <tt>StartPage</tt> condition is true if the page break is generated before
3893: the element by the <tt>Page</tt> rule; and the <tt>UserPage</tt> condition
3894: applies if the page break was inserted by the user.</p>
1.30 cvs 3895:
3896: <p>These conditions can be associated only with <a href="#sectc4232">creation
1.18 cvs 3897: rules</a>.</p>
3898: </div>
1.1 cvs 3899:
1.18 cvs 3900: <div class="subsubsection">
1.37 cvs 3901: <h4><a name="sectd42145" id="sectd42145">Conditions on the element's
3902: content</a></h4>
1.1 cvs 3903:
1.37 cvs 3904: <p>The condition can be based on whether or not the element is empty. An
1.30 cvs 3905: element which has no children or whose leaves are all empty is considered to
1.37 cvs 3906: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword,
1.30 cvs 3907: optionally preceded by the <tt>NOT</tt> keyword. This condition can be
3908: associated only with <a href="#sectc4232">creation rules</a>.</p>
1.18 cvs 3909: </div>
1.1 cvs 3910:
1.18 cvs 3911: <div class="subsubsection">
1.37 cvs 3912: <h4><a name="sectd42146" id="sectd42146">Conditions on counters</a></h4>
1.1 cvs 3913:
1.30 cvs 3914: <p>Presentation rules can apply when the counter's value is one, is even or
3915: odd, is equal, greater than or less than a given value or falls in a range of
1.37 cvs 3916: values. This is particularly useful for creating header and footer boxes.
1.18 cvs 3917: These conditions can be associated only with <a href="#sectc4232">creation
3918: rules</a>.</p>
1.30 cvs 3919:
3920: <p>To compare the value of a counter to a given value, a comparison is given
1.1 cvs 3921: between parentheses. The comparison is composed of the counter name followed
3922: by an equals, greater than, or less than sign and the value to which the
1.37 cvs 3923: counter will be compared. A test for whether or not a counter's value falls
3924: in a range also appears within parentheses. In this case, the counter name is
1.18 cvs 3925: followed by the <tt>IN</tt> keyword and the range definition within brackets.
3926: The <tt>Even</tt>, <tt>Odd</tt> and <tt>One</tt> are used to test a counter's
3927: value and are followed by the counter name between parentheses.</p>
1.30 cvs 3928:
3929: <p>The list of possible conditions on counters is:</p>
1.18 cvs 3930: <dl>
1.30 cvs 3931: <dt><tt>Even (Counter)</tt></dt>
3932: <dd>the box is created only if the counter has an even value.</dd>
3933: <dt><tt>Odd (Counter)</tt></dt>
3934: <dd>the box is created only if the counter has an odd value.</dd>
3935: <dt><tt>One (Counter)</tt></dt>
3936: <dd>the box is created only the counter's value is 1.</dd>
3937: <dt><tt>NOT One (Counter)</tt></dt>
3938: <dd>the box is created, unless the counter's value is 1.</dd>
3939: <dt><tt>(Counter < Value)</tt></dt>
3940: <dd>the box is created only if the counter's value is less than
3941: Value.</dd>
3942: <dt><tt>(Counter > Value)</tt></dt>
3943: <dd>the box is created only if the counter's value is greater than
3944: Value.</dd>
3945: <dt><tt>(Counter = Value)</tt></dt>
3946: <dd>the box is created only if the counter's value is equal to Value.</dd>
3947: <dt><tt>NOT (Counter = Value)</tt></dt>
3948: <dd>the is created only if the counter's value is different than
3949: Value.</dd>
3950: <dt><tt>(Counter IN [MinValue..MaxValue])</tt></dt>
3951: <dd>the box is created only if the counter's value falls in the range
3952: bounded by MinValue and MaxValue (inclusive).</dd>
3953: <dt><tt>NOT (Counter IN [MinValue..MaxValue])</tt></dt>
3954: <dd>the box is created only if the value of the counter does not fall in
3955: the range bounded by MinValue and MaxValue (inclusive).</dd>
1.18 cvs 3956: </dl>
1.30 cvs 3957:
3958: <p><strong>Note:</strong> the <tt>NOT Even</tt> and <tt>NOT Odd</tt>
3959: conditions are syntactically correct but can be expressed more simply by
3960: <tt>Odd</tt> and <tt>Even</tt>, respectively.</p>
1.18 cvs 3961: </div>
3962: </div>
1.1 cvs 3963:
1.18 cvs 3964: <div class="subsection">
1.37 cvs 3965: <h3><a name="sectc4215" id="sectc4215">A presentation rule</a></h3>
1.1 cvs 3966:
1.34 cvs 3967: <p>A presentation rule defines either a presentation property or presentation
1.37 cvs 3968: function. The properties are:</p>
1.18 cvs 3969: <ul>
1.30 cvs 3970: <li>the position of the vertical and horizontal reference axes of the
3971: box,</li>
3972: <li>the position of the box in relation to other boxes,</li>
3973: <li>the height or width of the box, with overflow exceptions,</li>
3974: <li>the margins, padding and borders of the box,</li>
3975: <li>the characteristics of the lines contained in the box: linespacing,
1.35 cvs 3976: indentation of the first line, hyphenation,</li>
1.30 cvs 3977: <li>the conditions for breaking the box across pages,</li>
3978: <li>the characteristics of the characters contained in the box: size, font,
3979: style, underlining,</li>
3980: <li>the depth of the box among overlapping boxes (often called stacking
3981: order),</li>
3982: <li>the characteristics of graphic elements contained in the box: style and
3983: thickness of lines, fill pattern for closed objects,</li>
1.37 cvs 3984: <li>the colors in text, graphics, pictures, and symbols contained in the
3985: box are displayed or printed,</li>
1.30 cvs 3986: <li>for presentation boxes only, the contents of the box.</li>
3987: </ul>
3988:
1.37 cvs 3989: <p>The <a name="presfunct" id="presfunct">presentation functions</a> are:</p>
1.30 cvs 3990: <ul>
3991: <li>the creation of a presentation box</li>
3992: <li>the line-breaking or page-breaking style,</li>
3993: <li>the copying of another box,</li>
3994: <li>the display of the box background and border,</li>
3995: <li>the display of a background picture and its aspect.</li>
3996: </ul>
3997:
1.37 cvs 3998: <p>For each box and each view, every presentation property is defined once
3999: and only once, either explicitly or by the <a href="#sectc427">default
4000: rules</a>. In contrast, presentation functions are not obligatory and can
4001: appear many times for the same element. for example an element can create
4002: many presentation boxes. Another element may not use any presentation
1.18 cvs 4003: functions.</p>
1.30 cvs 4004:
1.34 cvs 4005: <p>Each rule defining a presentation property begins with a keyword followed
1.37 cvs 4006: by a colon. The keyword indicates the property which is the subject of the
4007: rule. After the keyword and the colon, the remainder of the rule varies. All
1.18 cvs 4008: rules are terminated by a semicolon.</p>
1.34 cvs 4009: <pre> Rule = Property ';' / PresFunc ';' .
4010: Property ='VertRef' ':' PositionHoriz /
1.6 cvs 4011: 'HorizRef' ':' PositionVert /
4012: 'VertPos' ':' VPos /
4013: 'HorizPos' ':' HPos /
4014: 'Height' ':' Dimension /
4015: 'Width' ':' Dimension /
4016: 'VertOverflow' ':' Boolean /
1.1 cvs 4017: 'HorizOverflow' ':' Boolean /
1.26 cvs 4018: 'MarginTop' ':' MarginWidth /
4019: 'MarginRight' ':' MarginWidth /
4020: 'MarginBottom' ':' MarginWidth /
4021: 'MarginLeft' ':' MarginWidth /
4022: 'PaddingTop' ':' PaddingWidth /
4023: 'PaddingRight' ':' PaddingWidth /
4024: 'PaddingBottom' ':' PaddingWidth /
4025: 'PaddingLeft' ':' PaddingWidth /
4026: 'BorderTopWidth' ':' BorderWidth /
4027: 'BorderRightWidth' ':' BorderWidth /
4028: 'BorderBottomWidth' ':' BorderWidth /
4029: 'BorderLeftWidth' ':' BorderWidth /
4030: 'BorderTopColor' ':' BorderColor /
4031: 'BorderRightColor' ':' BorderColor /
4032: 'BorderBottomColor' ':' BorderColor /
4033: 'BorderLeftColor' ':' BorderColor /
4034: 'BorderTopStyle' ':' BorderStyle /
4035: 'BorderRightStyle' ':' BorderStyle /
4036: 'BorderBottomStyle' ':' BorderStyle /
4037: 'BorderLeftStyle' ':' BorderStyle .
1.6 cvs 4038: 'LineSpacing' ':' DistanceInherit /
4039: 'Indent' ':' DistanceInherit /
4040: 'Adjust' ':' AdjustInherit /
4041: 'Hyphenate' ':' BoolInherit /
4042: 'PageBreak' ':' Boolean /
4043: 'LineBreak' ':' Boolean /
4044: 'InLine' ':' Boolean /
4045: 'NoBreak1' ':' AbsDist /
4046: 'NoBreak2' ':' AbsDist /
4047: 'Gather' ':' Boolean /
4048: 'Visibility' ':' NumberInherit /
4049: 'Size' ':' SizeInherit /
4050: 'Font' ':' NameInherit /
4051: 'Style' ':' StyleInherit /
1.23 cvs 4052: 'Weight' ':' WeightInherit /
1.6 cvs 4053: 'Underline' ':' UnderLineInherit /
4054: 'Thickness' ':' ThicknessInherit /
4055: 'Depth' ':' NumberInherit /
4056: 'LineStyle' ':' LineStyleInherit /
4057: 'LineWeight' ':' DistanceInherit /
4058: 'FillPattern' ':' NameInherit /
4059: 'Background' ':' NameInherit /
1.13 cvs 4060: 'Foreground' ':' NameInherit /
1.6 cvs 4061: 'Content' ':' VarConst .
1.1 cvs 4062: PresFunc = Creation '(' BoxID ')' /
4063: 'Line' /
4064: 'NoLine' /
4065: 'Page' '(' BoxID ')' /
1.13 cvs 4066: 'Copy' '(' BoxTypeToCopy ')' /
4067: 'ShowBox' /
1.18 cvs 4068: 'BackgroundPicture' ':' FileName /
4069: 'PictureMode' ':' PictMode /</pre>
4070: </div>
4071:
4072: <div class="subsection">
1.37 cvs 4073: <h3><a name="sectc4216" id="sectc4216">Box axes</a></h3>
1.18 cvs 4074:
1.30 cvs 4075: <p>The position of the middle axes <tt>VMiddle</tt> and <tt>HMiddle</tt> in
1.1 cvs 4076: relation to their box is always calculated automatically as a function of the
1.37 cvs 4077: height and width of the box and is not specified by the presentation rules.
4078: In the presentation schema, these middle axes are used only to position their
4079: box with respect to another by specifying the distance between the middle
4080: axis and an axis or a side of another box (see the <a
4081: href="#sectc4218">relative position</a>).</p>
4082:
4083: <p>The reference axes of a box are also used to position their box in
4084: relation to another, but in contrast to the middle axes, the presentation
4085: schema must make their position explicit, either in relation to a side or the
4086: middle axis of the box itself, or in relation to an axis of an enclosed
4087: box.</p>
1.30 cvs 4088:
1.37 cvs 4089: <p>Only boxes of base elements have predefined reference axes. For character
1.1 cvs 4090: string boxes, the horizontal reference axis is the baseline of the characters
4091: (the line which passes immediately under the upper-case letters, ignoring the
4092: letter Q) and the vertical reference axis is at the left edge of the first
1.18 cvs 4093: character of the string.</p>
1.30 cvs 4094:
1.37 cvs 4095: <p>The positions of a box's reference axes are defined by the
4096: <tt>VertRef</tt> and <tt>HorizRef</tt> rules which specify the <a
4097: href="#distance">distance</a> between the reference axis and an axis or
4098: parallel side of the same box or of an enclosed box.</p>
1.18 cvs 4099: <pre> 'VertRef' ':' PositionHoriz
4100: 'HorizRef' ':' PositionVert</pre>
1.30 cvs 4101:
1.18 cvs 4102: <blockquote class="example">
1.30 cvs 4103: <p><strong>Example:</strong></p>
4104:
4105: <p>If, in the structure schema for mathematical formulas, the fraction
4106: element is defined by</p>
4107: <pre>Fraction = BEGIN
1.1 cvs 4108: Numerator = Expression;
4109: Denominator = Expression;
1.18 cvs 4110: END;</pre>
1.30 cvs 4111:
4112: <p>then the horizontal reference axis of the fraction can be positioned on
4113: top of the denominator by the rule:</p>
4114: <pre>Fraction :
1.1 cvs 4115: BEGIN
4116: HorizRef : Enclosed Denominator . Top;
4117: ...
1.18 cvs 4118: END;</pre>
1.30 cvs 4119:
4120: <p>To put the horizontal reference axis of a column at its middle:</p>
4121: <pre>Column :
1.1 cvs 4122: BEGIN
4123: HorizRef : * . HMiddle;
4124: ...
1.18 cvs 4125: END;</pre>
4126: </blockquote>
4127: </div>
1.1 cvs 4128:
1.18 cvs 4129: <div class="subsection">
1.37 cvs 4130: <h3><a name="sectc4217" id="sectc4217">Distance units</a></h3>
1.1 cvs 4131:
1.30 cvs 4132: <p>Some distances and dimensions appear in many rules of a presentation
4133: schema, especially in position rules (<tt>VertPos, HorizPos</tt>), in extent
4134: rules for boxes (<tt>Height, Width</tt>), in rules defining lines
1.37 cvs 4135: (<tt>LineSpacing, Indent</tt>), in rules controlling pagination
4136: (<tt>NoBreak1, NoBreak2</tt>) and in rules specifying the thickness of
4137: strokes (<tt>LineWeight</tt>).</p>
1.30 cvs 4138:
4139: <p>In all these rules, the distance or extent can be expressed</p>
4140: <ul>
4141: <li>either in relative units, which depend on the size of the characters in
4142: the current font: height of the element's font or height of the letter
4143: 'x',</li>
1.37 cvs 4144: <li>or in absolute units: centimeter, millimeter, inch, typographer's
4145: point, pica or pixel.</li>
1.30 cvs 4146: </ul>
4147:
1.37 cvs 4148: <p>Units can be chosen freely. Thus, it is possible to use relative units in
1.30 cvs 4149: one rule, centimeters in the next rule, and typographer's points in
4150: another.</p>
4151:
1.37 cvs 4152: <p>Absolute units are used to set rigid rules for the appearance of
4153: documents. In contrast, relative units allow changes of scale. The editor
4154: lets the value of relative units be changed dynamically. Such changes affect
4155: every box using relative units simultaneously and in the same proportion.
4156: Changing the value of the relative units affects the size of the characters
4157: and graphical elements, and the size of the boxes and the distances between
4158: them.</p>
4159:
4160: <p>A <a name="distance" id="distance">distance</a> or extent is specified by
4161: a number, which may be followed by one or more spaces and a units keyword.
4162: When there is no units keyword, the number specifies the number of relative
4163: units, where a relative unit is the height of a character in the current font
4164: (an em). When the number is followed by a units keyword, the keyword
4165: indicates the type of absolute units:</p>
1.18 cvs 4166: <ul>
1.39 ! cvs 4167: <li><tt>em</tt>
! 4168: : height of the element's font,</li>
! 4169: <li><tt>ex</tt>
! 4170: : height of the letter 'x',</li>
! 4171: <li><tt>cm</tt>
! 4172: : centimeter,</li>
! 4173: <li><tt>mm</tt>
! 4174: : millimeter,</li>
! 4175: <li><tt>in</tt>
! 4176: : inch (1 in = 2.54 cm),</li>
! 4177: <li><tt>pt</tt>
! 4178: : point (1 pt = 1/72 in),</li>
! 4179: <li><tt>pc</tt>
! 4180: : pica (1 pc = 12 pt),</li>
! 4181: <li><tt>px</tt>
! 4182: : pixel.</li>
1.18 cvs 4183: </ul>
1.30 cvs 4184:
4185: <p>Whatever the chosen unit, relative or absolute, the number is not
1.37 cvs 4186: necessarily an integer and may be expressed in fixed point notation (using
4187: the American convention of a period to express the decimal point).</p>
1.30 cvs 4188:
1.37 cvs 4189: <p>If the distance appears in a presentation rule for a numeric attribute,
4190: the number can be replaced by the name of an attribute. In this case, the
4191: value of the attribute is used. Obviously, the attribute name cannot be
4192: followed by a decimal point and a fractional part, but it can be followed a
4193: units keyword. However, the choice of units is limited to em, ex, pt and
4194: px.</p>
1.18 cvs 4195: <pre> Distance = [ Sign ] AbsDist .
1.1 cvs 4196: Sign ='+' / '-' .
4197: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
4198: [ Unit ].
4199: IntegerOrAttr = IntegerPart / AttrID .
4200: IntegerPart = NUMBER .
4201: DecimalPart = NUMBER .
4202: Unit ='em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
1.18 cvs 4203: 'pc' / 'px' / '%' .</pre>
1.30 cvs 4204:
1.18 cvs 4205: <blockquote class="example">
1.30 cvs 4206: <p><strong>Example:</strong></p>
4207:
4208: <p>The following rules specify that a box has a height of 10.5 centimeters
4209: and a width of 5.3 ems:</p>
4210: <pre>Height : 10.5 cm;
1.18 cvs 4211: Width : 5.3;</pre>
4212: </blockquote>
4213: </div>
1.1 cvs 4214:
1.18 cvs 4215: <div class="subsection">
1.37 cvs 4216: <h3><a name="sectc4218" id="sectc4218">Relative positions</a></h3>
1.1 cvs 4217:
1.37 cvs 4218: <p>The positioning of boxes uses the eight axes and sides, the sides
4219: generally being used to define the juxtapositioning (vertical or horizontal)
4220: of boxes, the middle axes being used to define centering, and the reference
4221: axes being used for alignment.</p>
4222:
4223: <p>Two rules allow a box to be placed relative to other boxes. The
4224: <tt>VertPos</tt> rule positions the box vertically. The <tt>HorizPos</tt>
4225: rule positions the box horizontally. It is possible that a box's position
4226: could be entirely determined by other boxes positioned relative to it. In
4227: this case, the position is implicit and the word <tt>nil</tt> can be used to
4228: specify that no position rule is needed. Otherwise, an explicit rule must be
1.18 cvs 4229: given by indicating the axis or side which defines the position of the box,
4230: followed by an equals sign and the distance between between this axis or side
1.37 cvs 4231: and a parallel axis or side of another box, called the reference box. The box
1.18 cvs 4232: for which the rule is written will be positioned relative to the reference
4233: box.</p>
4234: <pre> 'VertPos' ':' VPos
1.6 cvs 4235: 'HorizPos' ':' HPos
4236: HPos = 'nil' / VertAxis '=' HorizPosition
4237: [ 'UserSpecified' ].
4238: VPos = 'nil' / HorizAxis '=' VertPosition
4239: [ 'UserSpecified' ].
1.1 cvs 4240: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
1.18 cvs 4241: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .</pre>
1.30 cvs 4242:
1.37 cvs 4243: <p>The reference box is an adjacent box: enclosing, enclosed or adjacent.
4244: When a rule is associated with a reference type attribute (and only in this
4245: case), it can be a box of the element designated by the attribute. The
4246: reference box can be either a presentation box previously defined in the
4247: <tt>BOXES</tt> section of the schema and created by a creation function, or
4248: the box associated with a structured element.</p>
4249:
4250: <p>The structural position of the reference box (relative to the box for
4251: which the rule is being written) is indicated by a keyword:
4252: <tt>Enclosing</tt>, <tt>Enclosed</tt>, or, for sibling boxes,
4253: <tt>Previous</tt> or <tt>Next</tt>. The reference attributes, or presentation
4254: boxes created by a reference attribute, the <tt>Referred</tt> keyword may be
4255: used to designate the element which the reference points to. The keyword
4256: <tt>Creator</tt> can be used in rules for presentation boxes to designate the
4257: box of the element which created the presentation box. Finally, the
4258: <tt>Root</tt> keyword can be used to designate the root of the document.</p>
1.30 cvs 4259:
4260: <p>When the keyword is ambiguous, it is followed by the name of an element
4261: type or presentation box which resolves the ambiguity (the <tt>Creator</tt>
1.37 cvs 4262: and <tt>Root</tt> keywords are never ambiguous). If this name is not given,
1.30 cvs 4263: then the first box encountered is used as the reference box. It is also
4264: possible to use just the name of an element type or presentation box without
1.37 cvs 4265: an initial keyword. In this case, a sibling having that name will be used. If
1.30 cvs 4266: the name is preceded by the keyword <tt>NOT</tt>, then the reference box will
4267: be the first box whose type is not the named one.</p>
4268:
4269: <p>In place of the box or type name, the keywords <tt>AnyElem</tt>,
1.18 cvs 4270: <tt>AnyBox</tt> and <tt>ElemWithAttr</tt> can be used, representing
1.17 cvs 4271: respectively, any structured element box, any presentation box, and the box
4272: corresponding to any structured element having a particular attribute,
4273: whatever its value; the name of this attribute must follow the keyword
1.18 cvs 4274: <tt>ElemWithAttr</tt>.</p>
1.30 cvs 4275:
4276: <p>A type name may be preceded by a star in order to resolve the ambiguity in
4277: the special case where the structure schema defines an <a
1.18 cvs 4278: href="#sectd3284">inclusion</a> without expansion (or with partial expansion)
1.37 cvs 4279: of the same type as an element of the scheme. For mark pairs (and only for <a
1.18 cvs 4280: href="#sectd3285">mark pairs</a>) the type name <em>must</em> be preceded by
4281: the <tt>First</tt> or <tt>Second</tt> keyword, which indicates which of the
1.37 cvs 4282: two marks of the pair should be used as the reference box.</p>
1.30 cvs 4283:
4284: <p>The star character ('<tt>*</tt>') used alone designates the box to which
1.37 cvs 4285: the rule applies (in this case, it is obviously useless to specify the type
4286: of the reference box).</p>
1.30 cvs 4287:
1.37 cvs 4288: <p>The keywords <tt>Enclosing</tt> and <tt>Enclosed</tt> can be used no
4289: matter what constructor defines the type to which the rule applies. When
4290: applied to the element which represents the entire document,
4291: <tt>Enclosing</tt> designates the window or page in which the document's
4292: image is displayed for the view to which the rule applies. A box or type name
4293: without a keyword is used for aggregate elements and designates another
4294: element of the same aggregate. It can also be used to designate a
4295: presentation or page layout box. The keywords <tt>Previous</tt> and
4296: <tt>Next</tt> are primarily used to denote list elements, but can also be
4297: used to denote elements of an aggregate.</p>
4298:
4299: <p>In the position rule, the structural position relative to the reference
4300: box is followed, after a period, by the name of an axis or side. The rule
4301: specifies its node's position as being some distance from this axis or side
4302: of the reference box. If this distance is zero, then the distance does not
4303: appear in the rule. Otherwise, it does appear as a positive or negative
1.30 cvs 4304: number (the sign is required for negative numbers). The sign takes into
4305: account the orientation of the coordinate axes: for top to bottom for the
1.37 cvs 4306: vertical axis and from left to right for the horizontal axis. Thus, a
1.30 cvs 4307: negative distance in a vertical position indicates that the side or axis
4308: specified in the rule is above the side or axis of the reference box.</p>
4309:
1.37 cvs 4310: <p>The distance can be followed by the <tt>UserSpecified</tt> keyword (even
4311: if the distance is nil and does not appear, the <tt>UserSpecified</tt>
4312: keyword can be used). It indicates that when the element to which the rule
4313: applies is being created, the editor will ask the user to specify the
4314: distance himself, using the mouse. In this case, the distance specified in
4315: the rule is a default distance which is suggested to the user but can be
4316: modified. The <tt>UserSpecified</tt> keyword can be used either in the
4317: vertical position rule, the horizontal position rule, or both.</p>
1.18 cvs 4318: <pre> VertPosition = Reference '.' HorizAxis [ Distance ] .
1.1 cvs 4319: HorizPosition = Reference '.' VertAxis [ Distance ] .
4320: Reference ='Enclosing' [ BoxTypeNot ] /
4321: 'Enclosed' [ BoxTypeNot ] /
4322: 'Previous' [ BoxTypeNot ] /
4323: 'Next' [ BoxTypeNot ] /
4324: 'Referred' [ BoxTypeNot ] /
4325: 'Creator' /
4326: 'Root' /
4327: '*' /
4328: BoxOrType .
4329: BoxOrType = BoxID /
4330: [ '*' ] [ FirstSec ] ElemID /
1.17 cvs 4331: 'AnyElem' / 'AnyBox' /
4332: 'ElemWithAttr' AttrID .
1.18 cvs 4333: BoxTypeNot = [ 'NOT' ] BoxOrType .</pre>
1.30 cvs 4334:
1.18 cvs 4335: <blockquote class="example">
1.30 cvs 4336: <p><strong>Example:</strong></p>
4337:
1.37 cvs 4338: <p>If a <a name="expos1" id="expos1">report</a> is defined by the following
4339: structure schema:</p>
1.30 cvs 4340: <pre>Report = BEGIN
1.6 cvs 4341: Title = Text;
4342: Summary = Text;
4343: Keywords = Text;
4344: ...
1.18 cvs 4345: END;</pre>
1.30 cvs 4346:
4347: <p>then the presentation schema could contain the rules:</p>
4348: <pre>Report : BEGIN
1.6 cvs 4349: VertPos : Top = Enclosing . Top;
4350: HorizPos : Left = Enclosing . Left;
4351: ...
1.18 cvs 4352: END;</pre>
1.30 cvs 4353:
1.37 cvs 4354: <p>These rules place the <a name="reportexample"
4355: id="reportexample">report</a> in the upper left corner of the enclosing
4356: box, which is the window in which the document is being edited.</p>
1.30 cvs 4357: <pre>Title : BEGIN
1.6 cvs 4358: VertPos : Top = Enclosing . Top + 1;
4359: HorizPos : VMiddle = Enclosing . VMiddle;
4360: ...
1.18 cvs 4361: END;</pre>
1.30 cvs 4362:
1.37 cvs 4363: <p>The top of the title is one line (a line has the height of the
4364: characters of the title) from the top of the report, which is also the top
4365: of the editing window. The title is centered horizontally in the window
4366: (see <a href="#posdim">figure</a>).</p>
1.30 cvs 4367: <pre>Summary : BEGIN
1.1 cvs 4368: VertPos : Top = Title . Bottom + 1.5;
4369: HorizPos : Left = Enclosing . Left + 2 cm;
4370: ...
1.18 cvs 4371: END;</pre>
1.30 cvs 4372:
1.37 cvs 4373: <p>The top of the summary is place a line and a half below the bottom of
4374: the title and is shifted two centimeters from the side of the window.</p>
1.18 cvs 4375: </blockquote>
1.30 cvs 4376:
1.18 cvs 4377: <blockquote class="example">
1.30 cvs 4378: <p><strong>Example:</strong></p>
4379:
1.37 cvs 4380: <p>Suppose there is a <a name="expos2" id="expos2">Design</a> logical
4381: structure which contains graphical elements:</p>
1.30 cvs 4382: <pre>Design = LIST OF (ElemGraph = GRAPHICS);</pre>
4383:
4384: <p>The following rules allow the user to freely choose the position of each
4385: element when it is created:</p>
4386: <pre>ElemGraph =
1.1 cvs 4387: BEGIN
4388: VertPos : Top = Enclosing . Top + 1 cm UserSpecified;
4389: HorizPos: Left = Enclosing . Left UserSpecified;
4390: ...
1.18 cvs 4391: END;</pre>
1.30 cvs 4392:
4393: <p>Thus, when a graphical element is created, its default placement is at
4394: the left of the window and 1 cm from the top, but the user can move it
4395: immediately, simply by moving the mouse.</p>
1.18 cvs 4396: </blockquote>
4397: </div>
1.1 cvs 4398:
1.18 cvs 4399: <div class="subsection">
1.37 cvs 4400: <h3><a name="sectc4219" id="sectc4219">Box extents</a></h3>
1.1 cvs 4401:
1.30 cvs 4402: <p>The extents (height and width) of each box are defined by the two rules
1.37 cvs 4403: <tt>Height</tt> and <tt>Width</tt>. There are three types of extents: fixed,
1.18 cvs 4404: relative, and elastic.</p>
1.1 cvs 4405:
1.18 cvs 4406: <div class="subsubsection">
1.37 cvs 4407: <h4><a name="sectd42191" id="sectd42191">Fixed extents</a></h4>
1.1 cvs 4408:
1.30 cvs 4409: <p>A fixed dimension sets the height or width of the box independently of all
1.37 cvs 4410: other boxes. It is expressed in <a href="#sectc4217">distance units</a>. The
1.18 cvs 4411: extent can be followed by the <tt>UserSpecified</tt> keyword which indicates
1.1 cvs 4412: that when the element to which the rule applies is being created, the editor
1.37 cvs 4413: will ask the user to specify the extent himself, using the mouse. In this
1.1 cvs 4414: case, the extent specified in the rule is a default extent which is suggested
1.37 cvs 4415: to the user but can be modified. The <tt>UserSpecified</tt> keyword can be
1.18 cvs 4416: used either in the <tt>Height</tt> rule, the <tt>Width</tt> rule, or both.</p>
1.30 cvs 4417:
4418: <p>A fixed extent rule can be ended by the <tt>Min</tt> keyword, which
4419: signifies that the indicated value is a minimum, and that, if the contents of
4420: the box require it, a larger extent is possible.</p>
1.18 cvs 4421: <pre> 'Height' ':' Dimension
1.1 cvs 4422: 'Width' ':' Dimension
4423: Dimension = AbsDist [ 'UserSpecified' ] [ 'Min' ] /
1.18 cvs 4424: ...</pre>
1.30 cvs 4425:
1.18 cvs 4426: <blockquote class="example">
1.30 cvs 4427: <p><strong>Example:</strong></p>
4428:
4429: <p>Continuing with the <a href="#expos2">previous example</a>, it is
4430: possible to allow the user to choose the size of each graphical element as
4431: it is created:</p>
4432: <pre>ElemGraph : BEGIN
1.6 cvs 4433: Width : 2 cm UserSpecified;
1.1 cvs 4434: Height : 1 cm UserSpecified;
4435: ...
1.18 cvs 4436: END;</pre>
1.30 cvs 4437:
4438: <p>Thus, when a graphical element is create, it is drawn by default with a
4439: width of 2 cm and a height of 1 cm, but the user is free to resize it
4440: immediately with the mouse.</p>
4441: <pre>Summary : BEGIN
1.1 cvs 4442: Height : 5 cm Min;
4443: ...
4444: END;
4445: Keywords : BEGIN
4446: VertPos : Top = Summary . Bottom;
4447: ...
1.18 cvs 4448: END;</pre>
4449: </blockquote>
4450: </div>
1.1 cvs 4451:
1.18 cvs 4452: <div class="subsubsection">
1.37 cvs 4453: <h4><a name="sectd42192" id="sectd42192">Relative extents</a></h4>
1.30 cvs 4454:
4455: <p>A relative extent determines the extent as a function of the extent of
4456: another box, just as a relative position places a box in relation to another.
4457: The reference box in an extent rule is designated using the same syntax as is
1.37 cvs 4458: used in a relative position rule. It is followed by a period and a
1.30 cvs 4459: <tt>Height</tt> or <tt>Width</tt> keyword, depending on the extent being
1.37 cvs 4460: referred to. Next comes the relation between the extent being defined and the
4461: extent of the reference box. This relation can be either a percentage or a
1.30 cvs 4462: difference.</p>
1.1 cvs 4463:
1.37 cvs 4464: <p>A percentage is indicated by a star (the multiplication symbol) followed
4465: by the numeric percentage value (which may be greater than or less than 100)
4466: and the percent (`%') character. A difference is simply indicated by a signed
1.18 cvs 4467: difference.</p>
1.30 cvs 4468:
4469: <p>If the rule appears in the presentation rules of a numeric attribute, the
1.1 cvs 4470: percentage value can be replaced by the name of the attribute. This attribute
1.37 cvs 4471: is then used as a percentage. The attribute can also be used as part of a <a
1.18 cvs 4472: href="#distance">difference</a>.</p>
1.30 cvs 4473:
4474: <p>Just as with a fixed extent, a relative extent rule can end with the
1.18 cvs 4475: <tt>Min</tt> keyword, which signifies that the extent is a minimum and that,
4476: if the contents of the box require it, a larger extent is possible.</p>
1.30 cvs 4477:
4478: <p>A special case of relative extent rules is:</p>
1.18 cvs 4479: <pre>Height : Enclosed . Height;</pre>
1.30 cvs 4480:
4481: <p>or</p>
1.18 cvs 4482: <pre>Width : Enclosed . Width;</pre>
1.30 cvs 4483:
4484: <p>which specifies that the box has a height (or width) such that it encloses
4485: all the boxes which it contains, excluding boxes having a rule
4486: <tt>VertOverflow: Yes;</tt> or <tt>HorizOverflow: Yes;</tt>.</p>
4487:
4488: <p><strong>Note:</strong> character strings (type <tt>TEXT_UNIT</tt>)
4489: generally must use the sum of the widths of the characters which compose them
4490: as their width, which is expressed by the rule:</p>
1.18 cvs 4491: <pre>TEXT_UNIT :
4492: Width : Enclosed . Width;</pre>
1.30 cvs 4493:
4494: <p>If this rule is not the default <tt>Width</tt> rule, it must be given
1.18 cvs 4495: explicitly in the <tt>RULES</tt> section which defines the presentation rules
4496: of the logical elements.</p>
4497: <pre> 'Height' ':' Extent
1.1 cvs 4498: 'Width' ':' Extent
4499: Extent = Reference '.' HeightWidth [ Relation ]
4500: [ 'Min' ] / ...
4501: HeightWidth ='Height' / 'Width' .
4502: Relation ='*' ExtentAttr '%' / Distance .
4503: ExtentAttr = ExtentVal / AttrID .
1.18 cvs 4504: ExtentVal = NUMBER .</pre>
1.30 cvs 4505:
1.18 cvs 4506: <blockquote class="example">
1.30 cvs 4507: <p><strong>Example:</strong></p>
4508:
4509: <p>Completing the <a href="#expos1">above example</a>, it is possible to
4510: specify that the report takes its width from the editing window and its
4511: height from the size of its contents (this can obviously be greater than
4512: that of the window):</p>
4513: <pre>Report : BEGIN
1.1 cvs 4514: Width : Enclosing . Width;
4515: Height : Enclosed . Height;
4516: ...
1.18 cvs 4517: END;</pre>
1.30 cvs 4518:
4519: <p>Then, the following rules make the title occupy 60% of the width of the
4520: report (which is that of the window) and is broken into centered lines of
4521: this width (see the <a href="#sectc4222"><tt>Line</tt> rule</a>).</p>
4522: <pre>Title : BEGIN
1.1 cvs 4523: Width : Enclosing . Width * 60%;
4524: Height : Enclosed . Height;
4525: Line;
4526: Adjust : VMiddle;
4527: ...
1.18 cvs 4528: END;</pre>
1.30 cvs 4529:
4530: <p>The summary occupy the entire width of the window, with the exception of
4531: a 2 cm margin reserved by the horizontal position rule:</p>
4532: <pre>Summary : BEGIN
1.1 cvs 4533: Width : Enclosing . Width - 2 cm;
4534: Height : Enclosed . Height;
4535: ...
1.18 cvs 4536: END;</pre>
4537:
1.37 cvs 4538: <p>This set of rules, plus the <a href="#reportexample">position rules
4539: given above</a>, produce the layout of boxes shown in the following<a
1.30 cvs 4540: href="#posdim">figure</a>.</p>
4541:
4542: <div class="figure">
1.37 cvs 4543: <hr />
1.30 cvs 4544: <pre>-------------------------------------------------------------
1.1 cvs 4545: | Window and Report ^ |
4546: | | 1 line |
4547: | v |
4548: | ------------------------------------- |
4549: | | | |
4550: : 20% : Title : 20% :
1.30 cvs 4551: :<--------->: :<--------->:
1.1 cvs 4552: : : 60% : :
1.30 cvs 4553: : :<--------------------------------->: :
1.1 cvs 4554: | | | |
4555: | ------------------------------------- |
4556: | ^ |
4557: | | 1.5 line |
4558: | | |
4559: | v |
4560: | ---------------------------------------------------|
4561: | 2 cm | |
1.30 cvs 4562: |<------>| Summary |
1.18 cvs 4563: : : :</pre>
1.19 cvs 4564:
1.37 cvs 4565: <p align="center"><em><a name="posdim" id="posdim">Box position and
1.30 cvs 4566: extent</a><em></em></em></p>
1.37 cvs 4567: <hr />
1.30 cvs 4568: </div>
1.18 cvs 4569: </blockquote>
4570: </div>
1.1 cvs 4571:
1.18 cvs 4572: <div class="subsubsection">
1.37 cvs 4573: <h4><a name="sectd42193" id="sectd42193">Elastic extents</a></h4>
1.1 cvs 4574:
1.37 cvs 4575: <p>The last type of extent is the elastic extent. Either one or both extents
4576: can be elastic. A box has an elastic extent when two opposite sides are
1.30 cvs 4577: linked by distance constraints to two sides or axes of other boxes.</p>
4578:
4579: <p>One of the sides of the elastic box is linked by a position rule
1.37 cvs 4580: (<tt>VertPos</tt> or <tt>HorizPos</tt>) to a neighboring box. The other side
1.18 cvs 4581: is link to another box by a <tt>Height</tt> or <tt>Width</tt> rule, which
1.37 cvs 4582: takes the same form as the position rule. For the elastic box itself, the
1.1 cvs 4583: notions of sides (left or right, top or bottom) are fuzzy, since the movement
4584: of either one of the two reference boxes can, for example, make the left side
1.37 cvs 4585: of the elastic box move to the right of its right side. This is not
4586: important. The only requirement is that the two sides of the elastic box used
1.18 cvs 4587: in the position and extent rule are opposite sides of the box.</p>
4588: <pre> 'Height' ':' Extent
1.6 cvs 4589: 'Width' ':' Extent
1.18 cvs 4590: Extent = HPos / VPos / ...</pre>
1.30 cvs 4591:
1.18 cvs 4592: <blockquote class="example">
1.30 cvs 4593: <p><strong>Example:</strong></p>
4594:
4595: <p>Suppose we want to draw an elastic arrow or line between the middle of
1.37 cvs 4596: the bottom side of box A and the upper left corner of box B. To do this, we
1.30 cvs 4597: would define a graphics box whose upper left corner coincides with the
4598: middle of the bottom side of A (a position rule) and whose lower right
4599: corner coincides with with the upper left corner of B (dimension rules):</p>
4600: <pre>LinkedBox :
1.1 cvs 4601: BEGIN
1.6 cvs 4602: VertPos : Top = A .Bottom;
1.1 cvs 4603: HorizPos : Left = A . VMiddle;
1.6 cvs 4604: Height : Bottom = B . Top;
4605: Width : Right = B . Left;
1.18 cvs 4606: END;</pre>
4607: </blockquote>
1.30 cvs 4608:
1.18 cvs 4609: <blockquote class="example">
1.30 cvs 4610: <p><strong>Example:</strong></p>
4611:
4612: <p>The element SectionTitle creates a presentation box called SectionNum
1.37 cvs 4613: which contains the number of the section. Suppose we want to align the
4614: SectionNum and SectionTitle horizontally, have the SectionNum take its
4615: width from its contents (the section number), have the SectionTitle box
4616: begin 0.5 cm to the right of the SectionNum box and end at the right edge
4617: of its enclosing box. This would make the SectionTitle box elastic, since
4618: its width is defined by the position of its left and right sides. The
4619: following rules produce this effect:</p>
1.30 cvs 4620: <pre>SectionNum :
1.1 cvs 4621: BEGIN
4622: HorizPos : Left = Enclosing . Left;
4623: Width : Enclosed . Width;
4624: ...
4625: END;
4626:
4627: SectionTitle :
4628: BEGIN
4629: HorizPos : Left = SectionNum . Right + 0.5 cm;
4630: Width : Right = Enclosing . Right;
4631: ...
1.18 cvs 4632: END;</pre>
4633: </blockquote>
4634: </div>
4635: </div>
1.1 cvs 4636:
1.18 cvs 4637: <div class="subsection">
1.37 cvs 4638: <h3><a name="sectc4220" id="sectc4220">Overflow</a></h3>
1.1 cvs 4639:
1.30 cvs 4640: <p>A boxes corresponding to a structural element normally contain all boxes
1.37 cvs 4641: corresponding to the elements of its subtree. However, in some cases, it
1.1 cvs 4642: could be necessary to allow a box to jut out from its parent box. Two
4643: presentation rules indicate that such an overflow is allowed, one for
1.18 cvs 4644: horizontal overflow, one for vertical overflow.</p>
1.30 cvs 4645:
4646: <p>Each of these rules is expressed by a keyword followed by a colon and the
1.18 cvs 4647: keyword <tt>Yes</tt> or <tt>No</tt>.</p>
4648: <pre> 'VertOverflow' ':' Boolean /
1.1 cvs 4649: 'HorizOverflow' ':' Boolean .
1.18 cvs 4650: Boolean = 'Yes' / 'No' .</pre>
4651: </div>
1.1 cvs 4652:
1.30 cvs 4653: <p>@@@@@ ******</p>
4654:
1.26 cvs 4655: <p>Explain Margin, Padding and Border. Refer to CSS2.</p>
4656: <pre> 'MarginTop' ':' MarginWidth /
4657: 'MarginRight' ':' MarginWidth /
4658: 'MarginBottom' ':' MarginWidth /
4659: 'MarginLeft' ':' MarginWidth /
4660: 'PaddingTop' ':' PaddingWidth /
4661: 'PaddingRight' ':' PaddingWidth /
4662: 'PaddingBottom' ':' PaddingWidth /
4663: 'PaddingLeft' ':' PaddingWidth /
4664: 'BorderTopWidth' ':' BorderWidth /
4665: 'BorderRightWidth' ':' BorderWidth /
4666: 'BorderBottomWidth' ':' BorderWidth /
4667: 'BorderLeftWidth' ':' BorderWidth /
4668: 'BorderTopColor' ':' BorderColor /
4669: 'BorderRightColor' ':' BorderColor /
4670: 'BorderBottomColor' ':' BorderColor /
4671: 'BorderLeftColor' ':' BorderColor /
4672: 'BorderTopStyle' ':' BorderStyle /
4673: 'BorderRightStyle' ':' BorderStyle /
4674: 'BorderBottomStyle' ':' BorderStyle /
4675: 'BorderLeftStyle' ':' BorderStyle .
4676:
4677: MarginWidth = InheritParent / 'Auto' / Distance .
4678: PaddingWidth = InheritParent / Distance .
4679: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance .
4680: BorderColor = InheritParent / 'Transparent' / 'Foreground' /
4681: ColorName .
4682: BorderStyle = InheritParent /
4683: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' /
4684: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' .
1.27 cvs 4685: InheritParent = 'Enclosing' '=' / 'Creator' '=' .
1.26 cvs 4686: ColorName = NAME .</pre>
1.30 cvs 4687:
4688: <p>@@@@@ ******</p>
1.26 cvs 4689:
1.18 cvs 4690: <div class="subsection">
1.37 cvs 4691: <h3><a name="sectc4221" id="sectc4221">Inheritance</a></h3>
1.1 cvs 4692:
1.37 cvs 4693: <p>A presentation property can be defined by reference to the same property
4694: of another box in the tree of boxes. These structural links are expressed by
4695: kinship. The reference box can be that of the element immediately above in
1.18 cvs 4696: the structure (<tt>Enclosing</tt>), two levels above (<tt>GrandFather</tt>),
4697: immediately below (<tt>Enclosed</tt>) or immediately before
1.37 cvs 4698: (<tt>Previous</tt>). In the case of a presentation box, and only in that
1.1 cvs 4699: case, the reference box may be the element which created the presentation box
1.18 cvs 4700: (<tt>Creator</tt>).</p>
1.30 cvs 4701:
4702: <p>Kinship is expressed in terms of the logical structure of the document and
1.37 cvs 4703: not in terms of the tree of boxes. The presentation box cannot transmit any
1.34 cvs 4704: of their properties by inheritance; only structured element boxes can do so.
1.37 cvs 4705: As an example, consider an element B which follows an element A in the
4706: logical structure. The element B creates a presentation box P in front of
4707: itself, using the <tt>CreateBefore</tt> rule (see the <a
4708: href="#sectc4232">creation rules</a>). If element B's box inherits its
4709: character style using the <tt>Previous</tt> kinship operation, it gets its
4710: character style from A's box, not from P's box. Inheritance works differently
4711: for positions and extents, which can refer to presentation boxes.</p>
1.30 cvs 4712:
1.34 cvs 4713: <p>The inherited property value can be the same as that of the reference box.
1.37 cvs 4714: This is indicated by an equals sign. However, for numeric properties, a
1.1 cvs 4715: different value can be obtained by adding or subtracting a number from the
1.37 cvs 4716: reference box's property value. Addition is indicated by a plus sign before
4717: the number, while subtraction is specified with a minus sign. The value of a
1.34 cvs 4718: property can also be given a maximum (if the sign is a plus) or minimum (if
1.18 cvs 4719: the sign is a minus).</p>
1.30 cvs 4720:
4721: <p>If the rule is being applied to a numeric attribute, the number to add or
1.37 cvs 4722: subtract can be replaced by the attribute name. The value of a maximum or
4723: minimum may also be replaced by an attribute name. In these cases, the value
1.18 cvs 4724: of the attribute is used.</p>
4725: <pre> Inheritance = Kinship InheritedValue .
1.6 cvs 4726: Kinship ='Enclosing' / 'GrandFather' / 'Enclosed' /
4727: 'Previous' / 'Creator' .
1.1 cvs 4728: InheritedValue ='+' PosIntAttr [ 'Max' maximumA ] /
1.6 cvs 4729: '-' NegIntAttr [ 'Min' minimumA ] /
4730: '=' .
4731: PosIntAttr = PosInt / AttrID .
4732: PosInt = NUMBER .
4733: NegIntAttr = NegInt / AttrID .
4734: NegInt = NUMBER .
4735: maximumA = maximum / AttrID .
4736: maximum = NUMBER .
4737: minimumA = minimum / AttrID .
1.18 cvs 4738: minimum = NUMBER .</pre>
1.30 cvs 4739:
1.36 cvs 4740: <p>The properties which can be obtained by inheritance are hyphenation,
4741: interline spacing, character font (font family), font style, font size,
4742: visibility, indentation, underlining, alignment of text, stacking order of
4743: objects, the style and thickness of lines, fill pattern and the colors of
1.18 cvs 4744: lines and characters.</p>
4745: </div>
1.1 cvs 4746:
1.18 cvs 4747: <div class="subsection">
1.37 cvs 4748: <h3><a name="sectc4222" id="sectc4222">Line breaking</a></h3>
1.1 cvs 4749:
1.30 cvs 4750: <p>The <tt>Line</tt> rule specifies that the contents of the box should be
4751: broken into lines: the boxes included in the box to which this rule is
4752: attached are displayed one after the other, from left to right, with their
1.37 cvs 4753: horizontal reference axes aligned so that they form a series of lines. The
1.30 cvs 4754: length of these lines is equal to the width of the box to which the
4755: <tt>Line</tt> rule is attached.</p>
4756:
4757: <p>When an included box overflows the current line, it is either carried
1.37 cvs 4758: forward to the next line, cur, or left the way it is. The <a
1.18 cvs 4759: href="#sectc4223"><tt>LineBreak</tt> rule</a> is used to allow or prevent the
1.37 cvs 4760: breaking of included boxes. If the included box is not breakable but is
4761: longer than the space remaining on the line, it is left as is. When a
1.1 cvs 4762: character string box is breakable, the line is broken between words or, if
1.37 cvs 4763: necessary, by <a href="#sectd42225">hyphenating a word</a>. When a compound
4764: box is breakable, the box is transparent in regard to line breaking. The
4765: boxes included in the compound box are treated just like included boxes which
4766: have the <tt>LineBreak</tt> rule. Thus, it is possible to traverse a complete
1.18 cvs 4767: subtree of boxes to line break the text leaves of a complex structure.</p>
1.30 cvs 4768:
4769: <p>The relative position rules of the included boxes are ignored, since the
4770: boxes will be placed according to the line breaking rules.</p>
4771:
1.37 cvs 4772: <p>The <tt>Line</tt> rule does not have a parameter. The characteristics of
4773: the lines that will be constructed are determined by the
4774: <tt>LineSpacing</tt>, <tt>Indent</tt>, <tt>Adjust</tt>, and
4775: <tt>Hyphenate</tt> rules. Moreover, the <a
4776: href="#insectd42226"><tt>Inline</tt> rule</a> permits the exclusion of
1.36 cvs 4777: certain elements from the line breaking process.</p>
1.30 cvs 4778:
4779: <p>When the <tt>Line</tt> rule appears in the rules sequence of a non-primary
1.37 cvs 4780: view, it applies only to that view, but when the <tt>Line</tt> rule appears
4781: in the rules sequence of the primary view, it also applies to the other views
4782: by default, except for those views which explicitly invoke the
4783: <tt>NoLine</tt> rule. Thus, the <tt>NoLine</tt> rule can be used in a
4784: non-primary view to override the primary view's <tt>Line</tt> rule. The
4785: <tt>NoLine</tt> rule must not be used with the primary view because the
4786: absence of the <tt>Line</tt> rule has the same effect. Like the <tt>Line</tt>
4787: rule, the <tt>NoLine</tt> rule does not take any parameters.</p>
1.18 cvs 4788: <pre> 'Line'
4789: 'NoLine'</pre>
4790:
4791: <div class="subsubsection">
1.37 cvs 4792: <h4><a name="sectd42221" id="sectd42221">Line spacing</a></h4>
1.18 cvs 4793:
1.30 cvs 4794: <p>The <tt>LineSpacing</tt> rule defines the line spacing to be used in the
1.37 cvs 4795: line breaking process. The line spacing is the distance between the baselines
1.1 cvs 4796: (horizontal reference axis) of the successive lines produced by the
1.37 cvs 4797: <tt>Line</tt> rule. The value of the line spacing can be specified as a
4798: constant or by inheritance. It is expressed in any of the available <a
1.18 cvs 4799: href="#sectc4217">distance units</a>.</p>
1.30 cvs 4800:
4801: <p>Inheritance allows the value to be obtained from a relative in the
4802: structure tree, either without change (an equals sign appears after the
4803: inheritance keyword), with a positive difference (a plus sign), or a negative
1.37 cvs 4804: difference (a minus sign). When the rule uses a difference, the value of the
1.30 cvs 4805: difference follows the sign and is expressed as a <a
4806: href="#sectc4217">distance</a>.</p>
1.18 cvs 4807: <pre> 'LineSpacing' ':' DistOrInherit
1.6 cvs 4808: DistOrInherit = Kinship InheritedDist / Distance .
1.18 cvs 4809: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .</pre>
1.30 cvs 4810:
4811: <p>When the line spacing value (or its difference from another element) is
1.37 cvs 4812: expressed in relative units, it changes with the size of the characters.
4813: Thus, when a larger font is chosen for a part of the document, the line
4814: spacing of that part expands proportionally. In contrast, when the line
4815: spacing value is expressed in absolute units (centimeters, inches,
4816: typographer's points), it is independent of the characters, which permits the
4817: maintenance of a consistent line spacing, whatever the character font. Either
4818: approach can be taken, depending on the desired effect.</p>
1.18 cvs 4819: </div>
1.1 cvs 4820:
1.18 cvs 4821: <div class="subsubsection">
1.37 cvs 4822: <h4><a name="sectd42222" id="sectd42222">First line indentation</a></h4>
1.1 cvs 4823:
1.30 cvs 4824: <p>The <tt>Indent</tt> rule is used to specify the indentation of the first
4825: line of the elements broken into lines by the <tt>Line</tt> function. The
1.1 cvs 4826: indentation determines how far the first line of the element is shifted with
1.37 cvs 4827: respect to the other lines of the same element. It can be specified as a
4828: constant or by inheritance. The constant value is a positive integer (shifted
1.1 cvs 4829: to the right; the sign is optional), a negative integer (shifted to the left)
1.37 cvs 4830: or zero (no shift). All available <a href="#sectc4217">units</a> can be
1.18 cvs 4831: used.</p>
1.30 cvs 4832:
4833: <p>Indentation can be defined for any box, regardless of whether the box is
4834: line broken, and transmitted by inheritance to elements that are line broken.
4835: The size of the indentation is specified in the same manner as the <a
1.18 cvs 4836: href="#sectd42221">line spacing</a>.</p>
4837: <pre> 'Indent' ':' DistOrInherit</pre>
4838: </div>
1.1 cvs 4839:
1.18 cvs 4840: <div class="subsubsection">
1.37 cvs 4841: <h4><a name="sectd42223" id="sectd42223">Alignment</a></h4>
1.1 cvs 4842:
1.30 cvs 4843: <p>The alignment style of the lines constructed during line breaking is
1.37 cvs 4844: defined by the <tt>Adjust</tt> rule. The alignment value can be a constant or
4845: inherited. A constant value is specified by a keyword:</p>
1.18 cvs 4846: <ul>
1.39 ! cvs 4847: <li><tt>Left</tt>
! 4848: : at the left edge,</li>
! 4849: <li><tt>Right</tt>
! 4850: : at the right edge,</li>
! 4851: <li><tt>VMiddle</tt>
! 4852: : centered</li>
! 4853: <li><tt>Justify</tt>
! 4854: : justified</li>
! 4855: <li><tt>LeftWithDots</tt>
! 4856: : at the left edge with a dotted line filling out the last line up to the
! 4857: right edge of the line breaking box.</li>
1.18 cvs 4858: </ul>
1.30 cvs 4859:
1.37 cvs 4860: <p>An inherited value can only be the same as that of the reference box and
4861: is specified by a kinship keyword followed by an equals sign.</p>
1.18 cvs 4862: <pre> 'Adjust' ':' AlignOrInherit
1.1 cvs 4863: AlignOrInherit = Kinship '=' / Alignment .
1.35 cvs 4864: Alignment = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.18 cvs 4865: 'LeftWithDots' .</pre>
4866: </div>
1.1 cvs 4867:
1.18 cvs 4868: <div class="subsubsection">
1.37 cvs 4869: <h4><a name="sectd42225" id="sectd42225">Hyphenation</a></h4>
1.18 cvs 4870:
1.37 cvs 4871: <p>The <tt>Hyphenate</tt> rule indicates whether or not words should be
4872: broken by hyphenation at the end of lines. It affects the lines produced by
4873: the <tt>Line</tt> rule and contained in the box carrying the
4874: <tt>Hyphenate</tt> rule.</p>
1.30 cvs 4875:
1.34 cvs 4876: <p>The hyphenation property takes a boolean value, which can be either
1.37 cvs 4877: constant or inherited. A constant boolean value is expressed by either the
4878: <tt>Yes</tt> or the <tt>No</tt> keyword. An inherited value can only be the
1.1 cvs 4879: same as that of the reference box and is specified by a kinship keyword
1.18 cvs 4880: followed by an equals sign.</p>
4881: <pre> 'Hyphenate' ':' BoolInherit
1.1 cvs 4882: BoolInherit = Boolean / Kinship '=' .
1.18 cvs 4883: Boolean = 'Yes' / 'No' .</pre>
4884: </div>
4885:
4886: <div class="subsubsection">
1.37 cvs 4887: <h4><a name="sectd42226" id="sectd42226">Avoiding line breaking</a></h4>
1.18 cvs 4888:
1.37 cvs 4889: <p>The <tt>InLine</tt> rule is used to specify that a box that would
4890: otherwise participate in line breaking asked for by the <tt>Line</tt> rule of
4891: an enclosing box, instead avoids the line breaking process and positions
4892: itself according to the <tt>HorizPos</tt> and <tt>VertPos</tt> rules that
4893: apply to it. When the <tt>InLine</tt> rule applies to a box which would not
4894: be line broken, it has no effect.</p>
1.30 cvs 4895:
4896: <p>The rule is expressed by the <tt>InLine</tt> keyword followed by a colon
4897: and the keyword <tt>Yes</tt>, if the box should participate in line breaking,
1.37 cvs 4898: or the keyword <tt>No</tt>, if it should not. This is the only form possible:
4899: this rule cannot be inherited. Moreover, it can only appear in the rules of
1.1 cvs 4900: the primary view and applies to all views defined in the presentation
1.18 cvs 4901: schema.</p>
4902: <pre> 'InLine' ':' Boolean .
4903: Boolean = 'Yes' / 'No' .</pre>
1.30 cvs 4904:
1.18 cvs 4905: <blockquote class="example">
1.30 cvs 4906: <p><strong>Example:</strong></p>
4907:
4908: <p>Suppose the structure schema defines a logical attribute called
1.37 cvs 4909: <tt>New</tt> which is used to identify the passages in a document which
4910: were recently modified. It would be nice to have the presentation schema
4911: make a bar appear in the left margin next to each passage having the
4912: <tt>New</tt> attribute. A new passage can be an entire element, such as a
4913: paragraph or section, or it can be some words in the middle of a paragraph.
4914: To produce the desired effect, the <tt>New</tt> attribute is given a
4915: creation rule which generates a <tt>VerticalBar</tt> presentation box.</p>
1.30 cvs 4916:
4917: <p>When the <tt>New</tt> attribute is attached to a character string which
4918: is inside a line broken element (inside a paragraph, for example), the bar
4919: is one of the elements which participates in line breaking and it is placed
4920: normally in the current line, at the end of the character string which has
1.37 cvs 4921: the attribute. To avoid this, the <tt>InLine</tt> rule is used in the
1.30 cvs 4922: following way:</p>
4923: <pre>BOXES
1.1 cvs 4924: VerticalBar:
4925: BEGIN
4926: Content: Graphics 'l';
4927: HorizPos: Left = Root . Left;
4928: VertPos: Top = Creator . Top;
4929: Height: Bottom = Creator . Bottom;
4930: Width: 1 pt;
4931: InLine: No;
4932: ...
4933: END;
4934: ...
4935: ATTRIBUTES
4936: Nouveau:
4937: BEGIN
4938: CreateAfter(VerticalBar);
1.18 cvs 4939: END;</pre>
4940: </blockquote>
4941: </div>
4942: </div>
1.1 cvs 4943:
1.18 cvs 4944: <div class="subsection">
1.37 cvs 4945: <h3><a name="sectc4223" id="sectc4223">Page breaking and line breaking
4946: conditions</a></h3>
1.1 cvs 4947:
1.30 cvs 4948: <p>Pages are constructed by the editor in accordance with the model specified
1.37 cvs 4949: by a <a href="#sectc4233"><tt>Page</tt> rule</a>. The page model describes
1.30 cvs 4950: only the composition of the pages but does not give any rules for breaking
1.37 cvs 4951: different element types across pages. Now, it is possible that certain
4952: elements must not be cut by page breaks, while others can be cut anywhere.
4953: The <tt>PageBreak</tt>, <tt>NoBreak1</tt>, and <tt>NoBreak2</tt> rules are
4954: used to specify the conditions under which each element type can be cut.</p>
1.30 cvs 4955:
4956: <p>The <tt>PageBreak</tt> rule is used to indicate whether or not the box can
1.37 cvs 4957: be cut during the construction of pages. If cutting is authorized, the box
4958: can be cut, with one part appearing at the bottom of a page and the other
4959: part appearing at the top of the next page. The rule is formed by the
1.18 cvs 4960: <tt>PageBreak</tt> keyword followed by a colon and a constant boolean value
1.37 cvs 4961: (<tt>Yes</tt> or <tt>No</tt>). This is the only form possible: this rule
4962: cannot be inherited. Moreover, it can only appear in the rules of the primary
1.18 cvs 4963: view and applies to all views defined in the presentation schema.</p>
1.30 cvs 4964:
4965: <p>Whether objects can be cut by line breaks can be controlled in a similar
1.37 cvs 4966: way using the <tt>LineBreak</tt> rule. This rule allows the specification of
4967: whether or not the box can be cut during the construction of lines. If
1.1 cvs 4968: cutting is authorized, the box can be cut, with one part appearing at the end
1.37 cvs 4969: of a line and the other part appearing at the beginning of the next line. The
1.18 cvs 4970: rule is formed by the <tt>LineBreak</tt> keyword followed by a colon and a
1.37 cvs 4971: constant boolean value (<tt>Yes</tt> or <tt>No</tt>). This is the only form
4972: possible: this rule cannot be inherited. Moreover, it can only appear in the
4973: rules of the primary view and applies to all views defined in the
4974: presentation schema.</p>
1.18 cvs 4975: <pre> 'PageBreak' ':' Boolean .
1.1 cvs 4976: 'LineBreak' ':' Boolean .
1.18 cvs 4977: Boolean = 'Yes' / 'No' .</pre>
1.30 cvs 4978:
4979: <p>When a box can be cut by a page break, it is possible that a page break
4980: will fall an inappropriate spot, creating, for example, a widow or orphan, or
1.37 cvs 4981: separating the title of a section from the first paragraph of the section.
4982: The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules are used to avoid this.
4983: They specify that the box of the element to which they apply cannot be cut
4984: within a certain zone at the top (<tt>NoBreak1</tt> rule) or at the bottom
4985: (<tt>NoBreak2</tt> rule). These two rules specify the height of the zones in
1.18 cvs 4986: which page breaks are prohibited.</p>
1.30 cvs 4987:
4988: <p>The <tt>NoBreak1</tt> and <tt>NoBreak2</tt> rules give the height of the
1.37 cvs 4989: zone in which page breaking is prohibited. The height is given as a constant
1.30 cvs 4990: value using any of the <a href="#sectc4217">available units</a>, absolute or
1.37 cvs 4991: relative. The value may not be inherited.</p>
1.18 cvs 4992: <pre> 'NoBreak1' ':' AbsDist .
4993: 'NoBreak2' ':' AbsDist .</pre>
1.30 cvs 4994:
1.18 cvs 4995: <blockquote class="example">
1.30 cvs 4996: <p><strong>Example:</strong></p>
4997:
4998: <p>The following rules prevent widows and orphans in a paragraph:</p>
4999: <pre>Paragraph :
1.1 cvs 5000: BEGIN
5001: NoBreak1 : 2;
5002: NoBreak2 : 2;
1.18 cvs 5003: END;</pre>
1.30 cvs 5004:
1.37 cvs 5005: <p>This rule prevents a section title from becoming separated from the
5006: first paragraph of the section by prohibiting page breaks at the beginning
5007: of the section rule:</p>
1.30 cvs 5008: <pre>Section :
1.18 cvs 5009: NoBreak1 : 1.5 cm;</pre>
1.30 cvs 5010:
5011: <p>Finally, this rule prevents a figure from being page broken in any
5012: way:</p>
5013: <pre>Figure :
1.18 cvs 5014: PageBreak : No;</pre>
5015: </blockquote>
1.30 cvs 5016:
5017: <p>The Thot editor constructs the document images displayed on the screen
1.37 cvs 5018: dynamically. As the user moves in the document or makes the document scroll
1.1 cvs 5019: in a window, the editor constructs the image to be displayed in little bits,
1.37 cvs 5020: filling the gaps which are produced in the course of these operations. It
1.1 cvs 5021: stops filling in the image when an element reaches the edge of the window in
1.37 cvs 5022: which the gap appears. If the appearance of the document is complex, it is
1.1 cvs 5023: possible that the image in incomplete, even though the edge of the window was
1.37 cvs 5024: reached. For example, an element might need to be presented to the side of
5025: the last element displayed, but its image was not constructed. The user will
1.1 cvs 5026: not know whether the element is really absent or if its image has simply not
1.18 cvs 5027: been constructed.</p>
1.30 cvs 5028:
1.37 cvs 5029: <p>The <tt>Gather</tt> rule is used to remedy this problem. When the rule
1.18 cvs 5030: <tt>Gather : Yes;</tt> is associated with an element type, the image of such
5031: elements is constructed as a block by the editor: it is never split up.</p>
1.30 cvs 5032:
5033: <p>The <tt>Gather</tt> rule may not appear in the <a href="#sectc427">default
1.37 cvs 5034: rules</a>. Elements which do not have the <tt>Gather</tt> rule are considered
5035: susceptible to being split up during display. Thus, it is not necessary to
1.18 cvs 5036: use the <tt>Gather : No;</tt> form. This rule must be used prudently and only
1.37 cvs 5037: for those elements which truly need it. If used incorrectly, it can
1.18 cvs 5038: pointlessly increase the size of the image constructed by the editor and lead
5039: to excessive memory consumption by the editor.</p>
1.30 cvs 5040:
5041: <p>Like the <tt>PageBreak</tt> and <tt>LineBreak</tt> rules, the
5042: <tt>Gather</tt> rule can only appear in rules of the primary view and applies
5043: to all views defined in the presentation schema.</p>
1.18 cvs 5044: <pre> 'Gather' ':' Boolean .</pre>
5045: </div>
1.1 cvs 5046:
1.18 cvs 5047: <div class="subsection">
1.37 cvs 5048: <h3><a name="sectc4224" id="sectc4224">Visibility</a></h3>
1.1 cvs 5049:
1.34 cvs 5050: <p>The visibility property is used to control which elements should or should
1.37 cvs 5051: not be displayed, based on context. An element can have different
5052: visibilities in different views. If an element's visibility is zero for a
5053: view, that element is not displayed in that view and does not occupy any
5054: space (its extents are zero).</p>
1.30 cvs 5055:
1.37 cvs 5056: <p>Visibility takes non-negative integer values (positive or zero). If values
1.1 cvs 5057: greater than 1 are used, they allow the user to choose a degree of visibility
1.37 cvs 5058: and, thus, to see only those boxes whose visibility property exceeds a
5059: certain threshold. This gives the user control over the granularity of the
5060: displayed pictures.</p>
1.30 cvs 5061:
1.34 cvs 5062: <p>The visibility property can be defined as a constant or by inheritance. If
1.1 cvs 5063: defined by inheritance, it cannot be based on the value of the next or
1.37 cvs 5064: previous box. Visibility can only be inherited from above.</p>
1.30 cvs 5065:
5066: <p>If it is a numeric attribute's presentation rule, the visibility can be
1.37 cvs 5067: specified by the attribute's name, in which case the value of the attribute
5068: is used.</p>
1.18 cvs 5069: <pre> 'Visibility' ':' NumberInherit
1.1 cvs 5070: NumberInherit = Integer / AttrID / Inheritance .
1.18 cvs 5071: Integer = NUMBER .</pre>
1.30 cvs 5072:
1.18 cvs 5073: <blockquote class="example">
1.30 cvs 5074: <p><strong>Example:</strong></p>
5075:
5076: <p>Suppose that only <tt>Formula</tt> elements should be displayed in the
1.37 cvs 5077: <tt>MathView</tt> view. Then, the default rules should include:</p>
1.30 cvs 5078: <pre>DEFAULT
1.18 cvs 5079: IN MathView Visibility:0;</pre>
1.30 cvs 5080:
1.31 cvs 5081: <p>which makes all elements invisible in the <tt>MathView</tt> view.
1.30 cvs 5082: However, the <tt>Formula</tt> element also has a <tt>Visibility</tt>
5083: rule:</p>
5084: <pre>Formula :
1.18 cvs 5085: IN MathView Visibility:5;</pre>
1.30 cvs 5086:
5087: <p>which makes formulas, and only formulas, visible.</p>
1.18 cvs 5088: </blockquote>
5089: </div>
1.1 cvs 5090:
1.18 cvs 5091: <div class="subsection">
1.37 cvs 5092: <h3><a name="sectc4225" id="sectc4225">Character style properties</a></h3>
1.1 cvs 5093:
1.34 cvs 5094: <p>Four properties are used to determine which characters are used to display
1.37 cvs 5095: text. They are size, font, style, and underlining.</p>
1.1 cvs 5096:
1.18 cvs 5097: <div class="subsubsection">
1.37 cvs 5098: <h4><a name="sectd42251" id="sectd42251">Character size</a></h4>
1.30 cvs 5099:
1.37 cvs 5100: <p>The size property has two effects. First, it is used to specify the actual
1.34 cvs 5101: size and distance units for boxes defined in <a href="#sectc4217">relative
1.37 cvs 5102: units</a>. Second, it defines the size of the characters contained in the
1.34 cvs 5103: box.</p>
1.1 cvs 5104:
1.30 cvs 5105: <p>As a distance or length, the size can be expressed in abstract or absolute
1.37 cvs 5106: units. It can also be inherited. If it is not inherited, it is expressed
5107: simply as an integer followed by the <tt>pt</tt> keyword, which indicates
5108: that the size is expressed in typographer's points. The absence of the
5109: <tt>pt</tt> keyword indicates that it is in abstract units in which the value
5110: 1 represents the smallest size while the value 16 is the largest size. The
5111: relationship between these abstract sizes and the real character sizes is
5112: controlled by a table which can be modified statically or even dynamically
5113: during the execution of the Thot editor.</p>
1.30 cvs 5114:
5115: <p>If the <tt>Size</tt> rule is a numeric attribute's presentation rule, the
1.34 cvs 5116: value of the size property can be specified by the attribute's name, in which
1.30 cvs 5117: case the value of the attribute is used.</p>
5118:
1.37 cvs 5119: <p><strong>Note:</strong> the only unit available for defining an absolute
5120: size is the typographer's point. Centimeters and inches may not be used.</p>
1.30 cvs 5121:
5122: <p>If the size is inherited, the rule must specify the relative from which to
5123: inherit and any percentage or difference from that relative's value. A
5124: percentage is indicated by a <tt>*</tt> followed by the value of the
5125: percentage and a <tt>%</tt>. A difference can be expressed in either
5126: typographer's points or in abstract units and the maximum or minimum size can
1.37 cvs 5127: be specified, but without specifying the unit: it is the same as was
5128: specified for the difference.</p>
1.30 cvs 5129:
5130: <p>In a numeric attribute's presentation rule, the difference in size or the
1.22 cvs 5131: percentage can be indicated by the attribute's name instead of the numeric
1.37 cvs 5132: value, which means that the attribute's value should be used as the
5133: difference or percentage. The attribute can also be used as the minimum or
5134: maximum size for a difference.</p>
1.22 cvs 5135: <pre> 'Size' ':' SizeInherit
5136: SizeInherit = SizeAttr [ 'pt' ] /
5137: Kinship InheritedSize .
5138: InheritedSize ='+' SizeAttr [ 'pt' ]
5139: [ 'Max' MaxSizeAttr ] /
5140: '-' SizeAttr [ 'pt' ]
5141: [ 'Min' MinSizeAttr ] /
5142: '*' PercentSizeAttr '%' /
5143: '=' .
5144: SizeAttr = Size / AttrID .
5145: Size = NUMBER .
5146: MaxSizeAttr = MaxSize / AttrID .
5147: MaxSize = NUMBER .
5148: MinSizeAttr = MinSize / AttrID .
5149: MinSize = NUMBER .
5150: PercentSizeAttr = PercentSize / AttrID .
5151: PercentSize = NUMBER .</pre>
1.30 cvs 5152:
1.18 cvs 5153: <blockquote class="example">
1.30 cvs 5154: <p><strong>Example:</strong></p>
5155:
5156: <p>The rule</p>
5157: <pre>Size : Enclosing - 2 pt Min 7;</pre>
5158:
5159: <p>states that the character size is 2 points less than that of the
5160: enclosing box, but that it may not be less than 7 points, whatever the
5161: enclosing box's value.</p>
5162:
5163: <p>The following rules make the text of a report be displayed with
5164: medium-sized characters (for example, size 5), while the title is displayed
5165: with larger characters and the summary is displayed with smaller
5166: characters:</p>
5167: <pre>Report :
1.1 cvs 5168: Size : 5;
5169: Title :
5170: Size : Enclosing + 2;
5171: Summary :
1.18 cvs 5172: Size : Enclosing - 1;</pre>
1.30 cvs 5173:
5174: <p>Thus, the character sizes in the entire document can be changed by
1.34 cvs 5175: changing the size property of the Report element, while preserving the
1.30 cvs 5176: relationships between the sizes of the different elements.</p>
1.18 cvs 5177: </blockquote>
5178: </div>
5179:
5180: <div class="subsubsection">
1.37 cvs 5181: <h4><a name="sectd42252" id="sectd42252">Font and character style</a></h4>
1.18 cvs 5182:
1.37 cvs 5183: <p>The <tt>Font</tt> rule determines the font family to be used to display
5184: the characters contained in the box, while the <tt>Style</tt> rule determines
5185: their style and the <tt>Weight</tt> rule determines their weight. Thot
1.23 cvs 5186: recognizes three character fonts (Times, Helvetica, and Courier), three
5187: styles: Roman, Italics, and Oblique, and two weights: Normal and Bold.</p>
1.30 cvs 5188:
5189: <p>The font family, style and weight can be specified by a named constant or
1.37 cvs 5190: can be inherited. For the name of the font family only the first character is
1.30 cvs 5191: used.</p>
5192:
5193: <p>Only identical inheritance is allowed: the box takes the same font, style
1.37 cvs 5194: or weight as the box from which it inherits. This is indicated by an equals
1.23 cvs 5195: sign after the kinship specification.</p>
5196: <pre> 'Font' ':' NameInherit /
5197: 'Style' ':' StyleInherit /
5198: 'Weight' ':' WeightInherit /
5199:
5200: NameInherit = Kinship '=' / FontName .
5201: FontName = NAME .
5202: StyleInherit = Kinship '=' /
5203: 'Roman' / 'Italics' / 'Oblique' .
5204: WeightInherit = Kinship '=' /
5205: 'Normal' / 'Bold' .</pre>
1.30 cvs 5206:
1.18 cvs 5207: <blockquote class="example">
1.30 cvs 5208: <p><strong>Example:</strong></p>
5209:
5210: <p>To specify that the summary uses the font family of the rest of the
5211: document, but in the italic style, the following rules are used:</p>
5212: <pre>Summary :
1.1 cvs 5213: BEGIN
5214: Font : Enclosing =;
5215: Style : Italics;
1.18 cvs 5216: END;</pre>
5217: </blockquote>
5218: </div>
5219:
5220: <div class="subsubsection">
1.37 cvs 5221: <h4><a name="sectd42253" id="sectd42253">Underlining</a></h4>
1.18 cvs 5222:
1.30 cvs 5223: <p>The <tt>Underline</tt> rule is used to specify if the characters contained
1.37 cvs 5224: in a box should have lines drawn on or near them. There are four underlining
1.18 cvs 5225: styles: <tt>Underlined</tt>, <tt>Overlined</tt>, <tt>CrossedOut</tt>, and
1.37 cvs 5226: <tt>NoUnderline</tt>. The <tt>Thickness</tt> rule specifies the thickness of
1.18 cvs 5227: the line, <tt>Thin</tt> or <tt>Thick</tt>.</p>
1.30 cvs 5228:
5229: <p>As with font family and style, only identical inheritance is allowed: the
1.37 cvs 5230: box has the same underlining type as the box from which it inherits the
5231: value. This is indicated by an equals sign after the kinship
5232: specification.</p>
1.18 cvs 5233: <pre> 'Underline' ':' UnderLineInherit /
1.1 cvs 5234: 'Thickness' ':' ThicknessInherit /
5235:
5236: UnderLineInherit = Kinship '=' / 'NoUnderline' /
5237: 'Underlined' /
5238: 'Overlined' / 'CrossedOut' .
1.18 cvs 5239: ThicknessInherit = Kinship '=' / 'Thick' / 'Thin' .</pre>
5240: </div>
5241: </div>
5242:
5243: <div class="subsection">
1.37 cvs 5244: <h3><a name="sectc4226" id="sectc4226">Stacking order</a></h3>
1.18 cvs 5245:
1.30 cvs 5246: <p>The <tt>Depth</tt> rule is used to define the stacking order of terminal
1.37 cvs 5247: boxes when multiple boxes at least partially overlap. This rule defines how
5248: the depth property, which is zero or a positive integer, is calculated. The
5249: depth property has a value for all boxes. For terminal boxes in the structure
1.34 cvs 5250: and for presentation boxes, the depth value is used during display and
5251: printing: the boxes with the lowest value overlap those with higher depths.
1.37 cvs 5252: For non-terminal boxes, the depth is not interpreted during display, but it
5253: is used to calculate the depth of terminal boxes by inheritance.</p>
1.30 cvs 5254:
5255: <p>Like most other rules, the depth rule is defined in the <a
1.37 cvs 5256: href="#sectc427">default rules</a> of each presentation schema. Thus, there
1.18 cvs 5257: is always a depth value, even when it is not necessary because there is no
1.37 cvs 5258: overlapping. To avoid useless operations, a zero value can be given to the
1.34 cvs 5259: depth property, which signifies that overlapping is never a problem.</p>
1.30 cvs 5260:
5261: <p>The depth rule has the same form as the <a href="#sectc4224">visibility
1.18 cvs 5262: rule</a>. It can be defined by inheritance or by a constant numeric value.
5263: When the rule is attached to a numeric attribute, it can take the value of
5264: that attribute.</p>
5265: <pre> 'Depth' ':' NumberInherit</pre>
1.30 cvs 5266:
1.18 cvs 5267: <blockquote class="example">
1.30 cvs 5268: <p><strong>Example:</strong></p>
5269:
5270: <p>For a purely textual document, in which overlapping never poses a
5271: problem, a single default <tt>Depth</tt> rule in the presentation schema is
5272: sufficient:</p>
5273: <pre>DEFAULT
1.1 cvs 5274: Depth : 0;
1.18 cvs 5275: ...</pre>
1.30 cvs 5276:
5277: <p>To make the text of examples appear on a light blue background, a
5278: presentation box is defined:</p>
5279: <pre>BOXES
1.1 cvs 5280: BlueBG :
5281: BEGIN
5282: Content : Graphics 'R';
5283: Background : LightBlue3;
5284: FillPattern: backgroundcolor;
5285: Depth : 2;
5286: ...
1.18 cvs 5287: END;</pre>
1.30 cvs 5288:
5289: <p>and is created by the <tt>Example</tt> element, which has the rules:</p>
5290: <pre>RULES
1.1 cvs 5291: Example :
5292: BEGIN
5293: CreateFirst (BlueBG);
5294: Depth : 1;
5295: ...
1.18 cvs 5296: END;</pre>
1.30 cvs 5297:
5298: <p>In this way, the text of an example (if it inherits its depth from its
5299: ancestor) will be superimposed on a light blue background, and not the
5300: reverse).</p>
1.18 cvs 5301: </blockquote>
5302: </div>
5303:
5304: <div class="subsection">
1.37 cvs 5305: <h3><a name="sectc4227" id="sectc4227">Line style</a></h3>
1.18 cvs 5306:
1.30 cvs 5307: <p>The <tt>LineStyle</tt> rule determines the style of line which should be
5308: used to draw all the elements contained in the box and the box itself, if it
1.37 cvs 5309: has a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. The line style can be
1.18 cvs 5310: indicated by a name (<tt>Solid</tt>, <tt>Dashed</tt>, <tt>Dotted</tt>) or it
1.37 cvs 5311: can be inherited. All elements of the graphic base type are affected by this
1.1 cvs 5312: rule, but it can be attached to any box and transmitted by inheritance to the
1.37 cvs 5313: graphic elements. The border of elements having a <a
1.18 cvs 5314: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is drawn according to the line
5315: style specified by this rule.</p>
1.30 cvs 5316:
1.37 cvs 5317: <p>Only identical inheritance is allowed: the box takes the same line style
5318: as the box from which it inherits. This is indicated by an equals sign after
5319: the kinship specification.</p>
1.18 cvs 5320: <pre> 'LineStyle' ':' LineStyleInherit
1.1 cvs 5321: LineStyleInherit = Kinship '=' /
1.18 cvs 5322: 'Solid' / 'Dashed' / 'Dotted' .</pre>
1.30 cvs 5323:
1.18 cvs 5324: <blockquote class="example">
1.30 cvs 5325: <p><strong>Example:</strong></p>
5326:
1.37 cvs 5327: <p>To specify that, in Figures, the graphical parts should be drawn in
5328: solid lines, the Figure element is given a rule using the <tt>Solid</tt>
5329: name:</p>
1.30 cvs 5330: <pre>Figure :
1.18 cvs 5331: LineStyle : Solid;</pre>
1.30 cvs 5332:
5333: <p>and the elements composing figures are given an inheritance rule:</p>
5334: <pre> LineStyle : Enclosing =;</pre>
1.18 cvs 5335: </blockquote>
5336: </div>
5337:
5338: <div class="subsection">
1.37 cvs 5339: <h3><a name="sectc4228" id="sectc4228">Line thickness</a></h3>
1.18 cvs 5340:
1.37 cvs 5341: <p>The <tt>LineWeight</tt> rule determines the thickness of the lines of all
1.1 cvs 5342: graphical elements which appear in the box, no matter what their line style.
1.37 cvs 5343: Line thickness can be specified by a constant value or by inheritance. A
5344: constant value is a positive number followed by an optional unit
5345: specification (which is absent when using relative units). All available <a
5346: href="#sectc4217">distance units</a> can be used. Line thickness is expressed
1.18 cvs 5347: in the same way as <a href="#sectd42221">line spacing</a>.</p>
5348: <pre> 'LineWeight' ':' DistOrInherit</pre>
1.30 cvs 5349:
1.37 cvs 5350: <p>All elements of the graphic base type are affected by this rule, but it
5351: can be attached to any box and transmitted by inheritance to the graphic
5352: elements. The border of element having a <a
5353: href="#sectc4230a"><tt>ShowBox</tt> rule</a> is also drawn according to the
5354: thickness specified by this rule.</p>
1.30 cvs 5355:
1.18 cvs 5356: <blockquote class="example">
1.30 cvs 5357: <p><strong>Example:</strong></p>
5358:
5359: <p>To specify that, in Figures, the graphical parts should be drawn with
5360: lines 0.3 pt thick, the Figure element is given this rule:</p>
5361: <pre>Figure :
1.18 cvs 5362: LineWeight : 0.3 pt;</pre>
1.30 cvs 5363:
5364: <p>and the elements composing figures are given an inheritance rule:</p>
5365: <pre> LineWeight : Enclosing =;</pre>
1.18 cvs 5366: </blockquote>
5367: </div>
5368:
5369: <div class="subsection">
1.37 cvs 5370: <h3><a name="sectc4229" id="sectc4229">Fill pattern</a></h3>
1.18 cvs 5371:
1.30 cvs 5372: <p>The <tt>FillPattern</tt> rule determines the pattern used to fill closed
1.37 cvs 5373: graphical elements (circles, rectangles, etc.) which appear in the box. This
1.18 cvs 5374: rule also specifies the pattern used to fill the box associated with elements
1.37 cvs 5375: having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a><a>. This pattern can
5376: be indicated by a named constant or by inheritance. The named constant
5377: identifies one of the patterns available in Thot. The names of the available
1.18 cvs 5378: patterns are: nopattern, foregroundcolor, backgroundcolor, gray1, gray2,
5379: gray3, gray4, gray5, gray6, gray7, horiz1, horiz2, horiz3, vert1, vert2,
1.37 cvs 5380: vert3, left1, left2, left3, right1, right2, right3, square1, square2,
5381: square3, lozenge, brick, tile, sea, basket.</a></p>
1.30 cvs 5382:
5383: <p>Like the other rules peculiar to graphics, <tt>LineStyle</tt> and
1.18 cvs 5384: <tt>LineWeight</tt>, only elements of the graphic base type are affected by
5385: the <tt>FillPattern</tt> rule, but the rule can be attached to any box and
1.37 cvs 5386: transmitted by inheritance to the graphic elements. As with the other rules
1.18 cvs 5387: specific to graphics, only identical inheritance is allowed.</p>
1.30 cvs 5388:
5389: <p>The <tt>FillPattern</tt> rule can also be used to determine whether or not
1.37 cvs 5390: text characters, symbols and pictures should be colored. For these element
1.12 cvs 5391: types (text, symbols, and pictures), the only valid values are
1.18 cvs 5392: <tt>nopattern</tt>, <tt>foregroundcolor</tt>, and <tt>backgroundcolor</tt>.
5393: When <tt>FillPattern</tt> has the value <tt>backgroundcolor</tt>, text
5394: characters, symbols, and bitmaps are given the color specified by the <a
5395: href="#sectc4230"><tt>Background</tt> rule</a> which applies to these
1.37 cvs 5396: elements. When <tt>FillPattern</tt> has the value <tt>foregroundcolor</tt>,
1.18 cvs 5397: these same elements are given the color specified by the <a
5398: href="#sectc4230"><tt>Foreground</tt> rule</a> which applies to these
1.37 cvs 5399: elements. In all other case, text characters are not colored.</p>
1.18 cvs 5400: <pre> 'FillPattern' ':' NameInherit</pre>
1.30 cvs 5401:
1.18 cvs 5402: <blockquote class="example">
1.30 cvs 5403: <p><strong>Example:</strong></p>
5404:
5405: <p>To specify that, in Figures, the closed graphical elements should be
5406: filled with a pattern resembling a brick wall, the Figure element is given
5407: this rule:</p>
5408: <pre>Figure :
1.18 cvs 5409: FillPattern : brick;</pre>
1.30 cvs 5410:
5411: <p>and the elements composing figures are given an inheritance rule:</p>
5412: <pre> FillPattern : Enclosing =;</pre>
1.18 cvs 5413: </blockquote>
5414: </div>
5415:
5416: <div class="subsection">
1.37 cvs 5417: <h3><a name="sectc4230" id="sectc4230">Colors</a></h3>
1.18 cvs 5418:
1.30 cvs 5419: <p>The <tt>Foreground</tt> and <tt>Background</tt> rules determine the
1.37 cvs 5420: foreground and background colors of the base elements which appear in the
5421: box. They also control the color of boxes associated with elements having a
5422: <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. These colors can be
5423: specified with a named constant or by inheritance. The named constants
5424: specify one of the available colors in Thot. The available color names can be
5425: found in the file <tt>thot.color</tt>. In addition to those names, you can
5426: use the keyword <code>Transparent</code>, to not draw anything.</p>
5427:
5428: <p>The color rules affect the same way all base elements and elements having
5429: a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>, no matter what their type
5430: (text, graphics, pictures, symbols). The color rules can be associated with
1.30 cvs 5431: any box and can be transmitted by inheritance to the base elements or the
1.37 cvs 5432: elements having a <a href="#sectc4230a"><tt>ShowBox</tt> rule</a>. Like the
1.30 cvs 5433: preceding rules, only inheritance of the same value is allowed.</p>
5434: <pre> 'Foreground' ':' Color
5435: 'Background' ':' Color
5436: Color = 'Transparent' / Link '=' / FontColorName .</pre>
5437:
5438: <p><strong>Note:</strong> text colors only appear for text elements whose <a
1.18 cvs 5439: href="#sectc4229">fill pattern</a> does not prevent the use of color.</p>
1.30 cvs 5440:
1.18 cvs 5441: <blockquote class="example">
1.30 cvs 5442: <p><strong>Example:</strong></p>
5443:
5444: <p>To specify that, in Figures, everything must be drawn in blue on a
5445: background of yellow, the Figure element is given these rules:</p>
5446: <pre>Figure :
1.1 cvs 5447: BEGIN
5448: Foreground : Blue;
5449: Background : Yellow;
5450: Fillpattern : backgroundcolor;
1.18 cvs 5451: END;</pre>
1.30 cvs 5452:
5453: <p>and the elements composing figures are given inheritance rules:</p>
5454: <pre> Foreground : Enclosing =;
1.1 cvs 5455: Background : Enclosing =;
1.18 cvs 5456: FillPattern : Enclosing =;</pre>
5457: </blockquote>
5458: </div>
5459:
5460: <div class="subsection">
1.37 cvs 5461: <h3><a name="sectc4230a" id="sectc4230a">Background color and border</a></h3>
1.18 cvs 5462:
1.30 cvs 5463: <p>Boxes associated with structural elements are normally not visible, but it
1.37 cvs 5464: is possible to draw their border and/or to paint their area when it is
5465: needed. This is achieved by associating the <tt>ShowBox</tt> rule with the
5466: concerned element. This rule has no parameter and no value. It is simply
5467: written <tt>Showbox;</tt>. It is not inherited nor transmitted to any other
5468: element. It applies only to the element with which it is associated.</p>
1.18 cvs 5469: <pre> 'ShowBox'</pre>
1.30 cvs 5470:
5471: <p>When an element has a <tt>ShowBox</tt> rule, the border is drawn only if
1.37 cvs 5472: the <tt>LineWeight</tt> rule that applies to that element has a non-zero
5473: value (this value can be inherited). The color, style and thickness of the
5474: border are defined by the <tt>Foreground</tt>, <tt>LineStyle</tt>, and
1.18 cvs 5475: <tt>LineWeight</tt> rules that apply to the element.</p>
1.30 cvs 5476:
1.37 cvs 5477: <p>When an element has a <tt>ShowBox</tt> rule, the background of this
5478: element is paint only if the value of the <tt>FillPattern</tt> rule that
5479: applies to that element is not <tt>nopattern</tt>. The pattern and color(s)
5480: of the background are defined by the <tt>FillPattern</tt>,
5481: <tt>Background</tt>, and <tt>Foreground</tt> rules that apply to the
5482: element.</p>
1.18 cvs 5483: </div>
5484:
5485: <div class="subsection">
1.37 cvs 5486: <h3><a name="sectc4230b" id="sectc4230b">Background pictures</a></h3>
1.18 cvs 5487:
1.30 cvs 5488: <p>The <tt>BackgroundPicture</tt> rule allows to display a picture as the
1.37 cvs 5489: background of an element. It has a single parameter, the file name of the
5490: picture. This is a string delimited by single quotes. If the first character
1.18 cvs 5491: in this string is '/', it is considered as an absolute path, otherwise the
1.37 cvs 5492: file is searched for along the schema directory path. This file may contain a
1.18 cvs 5493: picture in any format accepted by Thot (xbm, xpm, gif, jpeg, png, etc.)</p>
1.30 cvs 5494:
1.37 cvs 5495: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only
5496: to the element with which they are associated. They are not inherited nor
1.18 cvs 5497: transmitted to children elements.</p>
1.30 cvs 5498:
5499: <p>The background picture has not always the same size as the element's box.
1.37 cvs 5500: There are diffrent ways to fill the element box with the picture. This is
1.18 cvs 5501: specified by the <tt>PictureMode</tt> rule, which should be associated to the
1.37 cvs 5502: same element. This rule may take one of the following values:</p>
1.18 cvs 5503: <dl>
1.30 cvs 5504: <dt><tt>NormalSize</tt></dt>
5505: <dd>The picture is centered in the box, and clipped if it is too
5506: large.</dd>
5507: <dt><tt>Scale</tt></dt>
5508: <dd>The picture is zoomed to fit the box size.</dd>
5509: <dt><tt>RepeatX</tt></dt>
5510: <dd>The picture is repeated horizontally to fit the box width.</dd>
5511: <dt><tt>RepeatY</tt></dt>
5512: <dd>The picture is repeated vertically to fit the box height.</dd>
5513: <dt><tt>RepeatXY</tt></dt>
5514: <dd>The picture is repeated both horizontally and vertically to fill the
5515: box.</dd>
1.18 cvs 5516: </dl>
1.30 cvs 5517:
5518: <p>If an element has a <tt>BackgroundPicture</tt> rule and no
1.18 cvs 5519: <tt>PictureMode</tt> rule, the <tt>NormalSize</tt> value is assumed.</p>
5520: <pre> 'BackgroundPicture' ':' FileName /
1.13 cvs 5521: 'PictureMode' ':' PictMode .
5522:
5523: FileName = STRING .
1.18 cvs 5524: PictMode = 'NormalSize' / 'Scale' / 'RepeatXY' / 'RepeatX' / 'RepeatY' .</pre>
1.30 cvs 5525:
1.37 cvs 5526: <p>The <tt>BackgroundPicture</tt> and <tt>PictureMode</tt> rules apply only
5527: to the element with which they are associated. They are not inherited nor
1.18 cvs 5528: transmitted to children elements.</p>
5529: </div>
1.13 cvs 5530:
1.18 cvs 5531: <div class="subsection">
1.37 cvs 5532: <h3><a name="sectc4231" id="sectc4231">Presentation box content</a></h3>
1.1 cvs 5533:
1.37 cvs 5534: <p>The <tt>Content</tt> rule applies to presentation boxes. It indicates the
5535: content given to a box. This content is either a variable's value or a
5536: constant value.</p>
1.30 cvs 5537:
5538: <p>If the content is a constant, it can be specified, as in a variable
1.18 cvs 5539: declaration, either by the name of a constant declared in the <tt>CONST</tt>
1.1 cvs 5540: section or by direct specification of the type and value of the box's
1.18 cvs 5541: content.</p>
1.30 cvs 5542:
5543: <p>Similarly, if it is a variable, the name of a variable declared in
1.18 cvs 5544: <tt>VAR</tt> section can be given or the variable may be defined within
1.37 cvs 5545: parentheses. The content inside the parentheses has the same syntax as a <a
1.18 cvs 5546: href="#sectc426">variable declaration</a>.</p>
5547: <pre> 'Content' ':' VarConst
1.1 cvs 5548: VarConst = ConstID / ConstType ConstValue /
1.38 cvs 5549: VarID / '(' FunctionSeq ')' .</pre>
1.30 cvs 5550:
5551: <p>A presentation box can have only one <tt>Content</tt> rule, which means
1.37 cvs 5552: that the content of a presentation box cannot vary from view to view.
5553: However, such an effect can be achieved by creating several presentation
5554: boxes, each with different content and visible in different views.</p>
5555:
5556: <p>The <tt>Content</tt> rule also applies to elements defined as references
5557: in the structure schema. In this case, the content defined by the rule must
5558: be a constant. It is this content which appears on the screen or paper to
5559: represent references of the type to which the rule applies. A reference can
1.18 cvs 5560: have a <tt>Content</tt> rule or a <a href="#sectc4234"><tt>Copy</tt> rule</a>
1.37 cvs 5561: for each view. If neither of these rules appears, the reference is displayed
1.18 cvs 5562: as <tt>[*]</tt>, which is equivalent to the rule:</p>
5563: <pre> Content: Text '[*]';</pre>
1.30 cvs 5564:
1.18 cvs 5565: <blockquote class="example">
1.30 cvs 5566: <p><strong>Example:</strong></p>
5567:
5568: <p>The content of the presentation box created to make the chapter number
5569: and section number appear before each section title can be defined by:</p>
5570: <pre>BOXES
1.1 cvs 5571: SectionNumBox :
5572: BEGIN
5573: Content : NumSection;
5574: ...
1.18 cvs 5575: END;</pre>
1.30 cvs 5576:
5577: <p>if the <tt>NumSection</tt> variable has been defined in the variable
1.37 cvs 5578: definition section of the presentation schema. Otherwise the
1.30 cvs 5579: <tt>Content</tt> would be written:</p>
5580: <pre>BOXES
1.1 cvs 5581: SectionNumBox :
5582: BEGIN
5583: Content : (VALUE (ChapterCtr, Roman) TEXT '.'
5584: VALUE (SectionCtr, Arabic));
5585: ...
1.18 cvs 5586: END;</pre>
5587: </blockquote>
5588: </div>
1.1 cvs 5589:
1.18 cvs 5590: <div class="subsection">
1.37 cvs 5591: <h3><a name="sectc4232" id="sectc4232">Presentation box creation</a></h3>
1.1 cvs 5592:
1.37 cvs 5593: <p>A creation rule specifies that a presentation box should be created when
5594: an element of the type to which the rule is attached appears in the
5595: document.</p>
1.30 cvs 5596:
5597: <p>A keyword specifies the position, relative to the creating box, at which
5598: the created box will be placed in the structure:</p>
1.18 cvs 5599: <dl>
1.30 cvs 5600: <dt><tt>CreateFirst</tt></dt>
5601: <dd>specifies that the box should be created as the first box of the next
5602: lower level, before any already existing boxes, and only if the
5603: beginning of the creating element is visible;</dd>
5604: <dt><tt>CreateLast</tt></dt>
5605: <dd>specifies that the box should be created as the last box of the next
5606: lower level, after any existing boxes, and only if the end of the
5607: creating element is visible;</dd>
5608: <dt><tt>CreateBefore</tt></dt>
5609: <dd>specifies that the box should be created before the creating box, on
5610: the same level as the creating box, and only if the beginning of the
5611: creating element is visible;</dd>
5612: <dt><tt>CreateAfter</tt></dt>
5613: <dd>specifies that the box should be created after the creating box, on
5614: the same level as the creating box, and only if the beginning of the
5615: creating element is visible;</dd>
5616: <dt><tt>CreateEnclosing</tt></dt>
1.37 cvs 5617: <dd>specifies that the box should be created at the upper level
5618: relatively to the creating box, and that it must contain that creating
5619: box and all presentation boxes created by the same creating box.</dd>
1.18 cvs 5620: </dl>
1.30 cvs 5621:
5622: <p>This keyword can be followed by the <tt>Repeated</tt> keyword to indicate
5623: that the box must be created for each part of the creating element. These
5624: parts result from the division of the element by page breaks or column
1.37 cvs 5625: changes. If the <tt>Repeated</tt> keyword is missing, the box is only created
1.30 cvs 5626: for the first part of the creating element (<tt>CreateFirst</tt> and
1.18 cvs 5627: <tt>CreateBefore</tt> rules) or for the last part (<tt>CreateLast</tt> and
5628: <tt>CreateAfter</tt> rules).</p>
1.30 cvs 5629:
5630: <p>The type of presentation to be created is specified at the end of the rule
1.18 cvs 5631: between parentheses.</p>
1.30 cvs 5632:
5633: <p>Creation rules cannot appear in the <a href="#sectc427">default
1.37 cvs 5634: presentation rules</a>. The boxes being created should have a
1.30 cvs 5635: <tt>Content</tt> rule which indicates their <a
5636: href="#sectc4231">content</a>.</p>
5637:
5638: <p>Creation rules can only appear in the block of rules for the primary view;
1.1 cvs 5639: creation is provoked by a document element for all views. However, for each
1.37 cvs 5640: view, the presentation box is only created if the creating element is itself
5641: a box in the view. Moreover, the visibility property of the presentation box
5642: can be adjusted to control the creation of the box on a view-by-view
5643: basis.</p>
1.18 cvs 5644: <pre> Creation '(' BoxID ')'
1.1 cvs 5645: Creation = Create [ 'Repeated' ] .
5646: Create ='CreateFirst' / 'CreateLast' /
5647: 'CreateBefore' / 'CreateAfter' /
1.18 cvs 5648: 'CreateEnclosing' .</pre>
1.30 cvs 5649:
1.18 cvs 5650: <blockquote class="example">
1.30 cvs 5651: <p><strong>Example:</strong></p>
5652:
5653: <p>Let us define an object type, called Table, which is composed of a
5654: sequence of columns, all having the same fixed width, where the columns are
1.37 cvs 5655: separated by vertical lines. There is a line to the left of the first
5656: column and one to the right of the last. Each column has a variable number
1.31 cvs 5657: of cells, placed one on top of the other and separated by horizontal lines.
5658: There are no horizontal lines above the first cell or below the last cell.
1.37 cvs 5659: The text contained in each cell is broken into lines and these lines are
1.30 cvs 5660: centered horizontally in the cell. The logical structure of this object is
5661: defined by:</p>
5662: <pre>Table = LIST OF (Column);
1.18 cvs 5663: Column = LIST OF (Cell = Text);</pre>
5664:
1.30 cvs 5665: <div class="figure">
1.37 cvs 5666: <hr />
1.30 cvs 5667: <pre>| | | |
1.1 cvs 5668: | xx xxxx xxxx |x xxxx xxx xxxxx| x xxx x xxx |
5669: | xxx xxx xxxx x | x xx x xxx | xxxxx xxxx xx |
5670: | xxxxx xxxx |----------------| xxx xxxxx x |
5671: | xxxxx xxx xxxx | xxxx xx xx xxx | xx xx |
5672: | xxx xxxx x xxx | xxxx x xxx x |---------------|
5673: |----------------| xxx xxxx xxxxx | xxxxx xxxxx |
5674: | xxx xxx xxxxxx |----------------| xxx xxxx xxxx |
5675: | xxxx xxxx xx | xxxx xx x xx | xxx xx x xx |
5676: |----------------| xxx xxxxx xxxx | xxxx xxxx xxx |
5677: | xxxxx xxx xxxx | xxxx xx x xx | xxxxx xxx |
1.18 cvs 5678: |xxxx xx x xxxxxx| xxxx xx xxxxxx | xxxxx xxxxx |</pre>
1.19 cvs 5679:
1.37 cvs 5680: <p align="center"><em><a name="table" id="table">The design of a
5681: table</a></em></p>
5682: <hr />
1.30 cvs 5683: </div>
5684:
5685: <p>The presentation of the table should resemble the design of the above <a
1.37 cvs 5686: href="#table">figure</a>. It is defined by the following presentation
1.30 cvs 5687: schema fragment:</p>
5688: <pre>BOXES
1.1 cvs 5689: VertLine : BEGIN
5690: Width : 0.3 cm;
5691: Height : Enclosing . Height;
5692: VertPos : Top = Enclosing . Top;
5693: HorizPos : Left = Previous . Right;
5694: Content : Graphics 'v';
5695: END;
5696:
5697: HorizLine: BEGIN
5698: Width : Enclosing . Width;
5699: Height : 0.3 cm;
5700: VertPos : Top = Previous . Bottom;
5701: HorizPos : Left = Enclosing . Left;
5702: Content : Graphics 'h';
5703: END;
5704:
5705: RULES
1.6 cvs 5706: Column : BEGIN
5707: CreateBefore (VertLine);
5708: IF LAST CreateAfter (VertLine);
5709: Width : 2.8 cm;
5710: Height : Enclosed . Height;
5711: VertPos : Top = Enclosing . Top;
5712: HorizPos : Left = Previous . Right;
5713: END;
5714:
5715: Cell : BEGIN
5716: IF NOT FIRST CreateBefore (HorizLine);
5717: Width : Enclosing . Width;
5718: Height : Enclosed . Height;
5719: VertPos : Top = Previous . Bottom;
5720: HorizPos : Left = Enclosing . Left;
5721: Line;
5722: Adjust : VMiddle;
1.18 cvs 5723: END;</pre>
1.30 cvs 5724:
5725: <p>It is useful to note that the horizontal position rule of the first
5726: vertical line will not be applied, since there is no preceding box. In this
5727: case, the box is simply placed on the left side of the enclosing box.</p>
1.18 cvs 5728: </blockquote>
5729: </div>
5730:
5731: <div class="subsection">
1.37 cvs 5732: <h3><a name="sectc4233" id="sectc4233">Page layout</a></h3>
1.18 cvs 5733:
1.30 cvs 5734: <p>The page models specified in the <tt>Page</tt> rule are defined by boxes
1.37 cvs 5735: declared in the <tt>BOXES</tt> section of the presentation schema. Pages are
1.1 cvs 5736: not described as frames which will be filled by the document's text, but as
5737: element are inserted in the flow of the document and which mark the page
1.37 cvs 5738: breaks. Each of these page break elements contains presentation boxes which
1.1 cvs 5739: represent the footer boxes of a page followed by header boxes of the next
1.37 cvs 5740: page. The page box itself is the simple line which separates two pages on the
5741: screen. Both the footer and header boxes placed themselves with respect to
1.1 cvs 5742: this page box, with the footer being placed above it and the header boxes
1.18 cvs 5743: being placed above it.</p>
1.30 cvs 5744:
5745: <p>The boxes created by a page box are headers and footers and can only place
1.1 cvs 5746: themselves vertically with respect to the page box itself (which is in fact
1.37 cvs 5747: the separation between two pages). Besides, it is their vertical position
5748: rule which determines whether they are header or footer boxes. Header and
1.1 cvs 5749: footer boxes must have an explicit vertical position rule (they must not use
1.18 cvs 5750: the default rule).</p>
1.30 cvs 5751:
5752: <p>Footer boxes must have an absolute height or inherit the height of their
1.18 cvs 5753: contents:</p>
5754: <pre>Height : Enclosed . Height;</pre>
1.30 cvs 5755:
5756: <p>A page box must have height and width rules and these two rules must be
1.1 cvs 5757: specified with constant values, expressed in centimeters, inches, or
1.37 cvs 5758: typographer's points. These two rules are interpreted in a special way for
5759: page boxes: they determine the width of the page and the vertical distance
1.1 cvs 5760: between two page separators, which is the height of the page and its header
1.18 cvs 5761: and footer together.</p>
1.30 cvs 5762:
5763: <p>A page box should also have vertical and horizontal position rules and
5764: these two rules should specify the position on the sheet of paper of the
1.37 cvs 5765: rectangle enclosing the page's contents. These two rules must position the
1.30 cvs 5766: upper left corner of the enclosing rectangle in relation to the upper left
1.37 cvs 5767: corner of the sheet of paper, considered to be the enclosing element. In both
1.30 cvs 5768: rules, distances must be expressed in fixed units: centimeters (<tt>cm</tt>),
1.37 cvs 5769: inches (<tt>in</tt>), or typographer's points (<tt>pt</tt>). Thus, rules
1.30 cvs 5770: similar to the following should be found in the rules for a page box:</p>
1.18 cvs 5771: <pre>BOXES
1.1 cvs 5772: ThePage :
5773: BEGIN
5774: VertPos : Top = Enclosing . Top + 3 cm;
5775: HorizPos : Left = Enclosing . Left + 2.5 cm;
5776: Width : 16 cm;
5777: Height : 22.5 cm;
1.18 cvs 5778: END;</pre>
1.30 cvs 5779:
5780: <p>When a document must be page broken, the page models to be constructed are
1.18 cvs 5781: defined in the <tt>BOXES</tt> section of the presentation schema by declaring
1.37 cvs 5782: page boxes and header and footer boxes. Also, the <tt>Page</tt> rule is used
5783: to specify to which parts of the document and to which views each model
5784: should be applied.</p>
1.30 cvs 5785:
5786: <p>The <tt>Page</tt> rule has only one parameter, given between parentheses
1.37 cvs 5787: after the <tt>Page</tt> keyword. This parameter is the name of the box which
5788: must serve as the model for page construction. When a <tt>Page</tt> rule is
1.1 cvs 5789: attached to an element type, each time such an element appears in a document,
5790: a page break takes place and the page model indicated in the rule is applied
5791: to all following pages, until reaching the next element which has a
1.18 cvs 5792: <tt>Page</tt> rule.</p>
1.30 cvs 5793:
5794: <p>The <tt>Page</tt> rule applies to only one view; if it appears in the
1.37 cvs 5795: primary view's block of rules, a <tt>Page</tt> rule applies only to that
5796: view. Thus, different page models can be defined for the full document and
5797: for its table of contents, which is another view of the same document. Some
5798: views can be specified with pages, and other views of the same document can
5799: be specified without pages.</p>
1.18 cvs 5800: <pre> 'Page' '(' BoxID ')'</pre>
5801: </div>
5802:
5803: <div class="subsection">
1.37 cvs 5804: <h3><a name="sectc4234" id="sectc4234">Box copies</a></h3>
1.18 cvs 5805:
1.30 cvs 5806: <p>The <tt>Copy</tt> rule can be used for an element which is defined as a
1.37 cvs 5807: reference in the structure schema. In this case, the rule specifies, between
1.18 cvs 5808: parenthesis, the name of the box (declared in the <tt>BOXES</tt> section)
1.1 cvs 5809: which must be produced when this reference appears in the structure of a
1.37 cvs 5810: document. The box produced is a copy (same contents, but possible different
1.1 cvs 5811: presentation) of the box type indicated by the parameter between parentheses,
1.37 cvs 5812: and which is in the element designated by the reference. The name of a box
1.1 cvs 5813: can be replaced by type name. Then what is copied is the contents of the
1.18 cvs 5814: element of this type which is inside the referenced element.</p>
1.30 cvs 5815:
1.37 cvs 5816: <p>Whether a box name or type name is given, it may be followed by the name
5817: of a structure schema between parentheses. This signifies that the box or
5818: type is defined in the indicated structure schema and not in the structure
5819: schema with which the rule's presentation schema is associated.</p>
1.30 cvs 5820:
1.37 cvs 5821: <p>The <tt>Copy</tt> rule can also be applied to a presentation box. If the
1.1 cvs 5822: presentation box was created by a reference attribute, the rule is applied as
5823: in the case of a reference element: the contents of the box having the
1.18 cvs 5824: <tt>Copy</tt> rule are based on the element designated by the reference
1.37 cvs 5825: attribute. For other presentation boxes, the <tt>Copy</tt> rule takes a type
1.1 cvs 5826: name parameter which can be followed, between parentheses, by the name of the
5827: structure schema in which the type is defined, if it is not defined in the
1.37 cvs 5828: same schema. The contents of the box which has this rule are a copy of the
5829: element of this type which is in the element creating the presentation box,
5830: or by default, the box of this type which precedes the presentation box. This
5831: last facility is used, for example, to define the running titles in headers
5832: or footers.</p>
1.18 cvs 5833: <pre> 'Copy' '(' BoxTypeToCopy ')' .
1.1 cvs 5834: BoxTypeToCopy = BoxID [ ExtStruct ] /
1.6 cvs 5835: ElemID [ ExtStruct ] .
1.18 cvs 5836: ExtStruct = '(' ElemID ')' .</pre>
1.30 cvs 5837:
5838: <p>Like the creation rules, the <tt>Copy</tt> rule cannot appear in the <a
1.37 cvs 5839: href="#sectc427">default presentation rules</a>. Moreover, this rule can only
1.18 cvs 5840: appear in the primary view's block of rules; the copy rule is applied to all
5841: views.</p>
1.30 cvs 5842:
1.18 cvs 5843: <blockquote class="example">
1.30 cvs 5844: <p><strong>Example:</strong></p>
5845:
5846: <p>If the following definitions are in the structure schema:</p>
5847: <pre>Body = LIST OF (Chapter =
1.1 cvs 5848: BEGIN
5849: ChapterTitle = Text;
5850: ChapterBody = SectionSeq;
5851: END);
1.18 cvs 5852: RefChapter = REFERENCE (Chapter);</pre>
1.30 cvs 5853:
5854: <p>then the following presentation rules (among many other rules in the
5855: presentation schema) can be specified:</p>
5856: <pre>COUNTERS
1.1 cvs 5857: ChapterCtr : RANK OF Chapter;
5858: BOXES
5859: ChapterNumber :
5860: BEGIN
5861: Content : (VALUE (ChapterCtr, URoman));
5862: ...
5863: END;
5864: RULES
5865: Chapter :
5866: BEGIN
5867: CreateFirst (ChapterNumber);
5868: ...
5869: END;
5870: RefChapter :
5871: BEGIN
5872: Copy (ChapterNumber);
5873: ...
1.18 cvs 5874: END;</pre>
1.30 cvs 5875:
5876: <p>which makes the number of the chapter designated by the reference appear
5877: in uppercase roman numerals, in place of the reference to a chapter itself.
5878: Alternatively, the chapter title can be made to appear in place of the
5879: reference by writing this <tt>Copy</tt>rule:</p>
5880: <pre> Copy (ChapterTitle);</pre>
5881:
5882: <p>To define a header box, named <tt>RunningTitle</tt>, which contains the
5883: title of the current chapter, the box's contents are defined in this
5884: way:</p>
5885: <pre>BOXES
1.1 cvs 5886: RunningTitle :
1.18 cvs 5887: Copy (ChapterTitle);</pre>
5888: </blockquote>
5889: </div>
5890: </div>
1.37 cvs 5891: <hr />
1.18 cvs 5892: </div>
1.1 cvs 5893:
1.18 cvs 5894: <div class="chapter">
1.37 cvs 5895: <h1><a name="sect5" id="sect5">The T language</a></h1>
1.1 cvs 5896:
1.18 cvs 5897: <div class="section">
1.37 cvs 5898: <h2><a name="sectb51" id="sectb51">Document translation</a></h2>
1.1 cvs 5899:
1.30 cvs 5900: <p>Because of its document model, Thot can produce documents in a high-level
1.37 cvs 5901: abstract form. This form, called the <em>canonical form</em> is specific to
1.1 cvs 5902: Thot; it is well suited to the editor's manipulations, but it does not
1.37 cvs 5903: necessarily suit other operations which might be applied to documents.
5904: Because of this, the Thot editor offers the choice of saving documents in its
5905: own form (the canonical form) or a format defined by the user. In the latter
5906: case, the Thot document is transformed by the translation program. This
5907: facility can also be used to export documents from Thot to systems using
5908: other formalisms.</p>
1.1 cvs 5909:
1.18 cvs 5910: <div class="subsection">
1.37 cvs 5911: <h3><a name="sectc511" id="sectc511">Translation principles</a></h3>
1.1 cvs 5912:
1.30 cvs 5913: <p>Document translation allows the export of documents to other systems which
1.37 cvs 5914: do not accept Thot's canonical form. Translation can be used to export
1.30 cvs 5915: document to source-based formatters like T<sub><big>E</big></sub>X,
1.37 cvs 5916: L<sup>A</sup>T<sub><big>E</big></sub>X, and <tt>troff</tt>. It can also be
5917: used to translate documents into interchange formats like SGML or HTML. To
1.1 cvs 5918: allow the widest range of possible exports, Thot does not limit the choice of
5919: translations, but rather allows the user to define the formalisms into which
1.18 cvs 5920: documents can be translated.</p>
1.30 cvs 5921:
5922: <p>For each document or object class, a set of translation rules can be
5923: defined, specifying how the canonical form should be transformed into a given
1.37 cvs 5924: formalism. These translation rules are grouped into <em>translation
1.18 cvs 5925: schemas</em>, each schema containing the rules necessary to translate a
1.1 cvs 5926: generic logical structure (document or object structure) into a particular
1.37 cvs 5927: formalism. The same generic logical structure can have several different
1.1 cvs 5928: translation schemas, each defining translation rules for a different
1.18 cvs 5929: formalism.</p>
1.30 cvs 5930:
1.37 cvs 5931: <p>Like presentation schemas, translation schemas are generic. Thus, they
1.30 cvs 5932: apply to an entire object or document class and permit translation of all
5933: documents or objects of that class.</p>
1.18 cvs 5934: </div>
1.1 cvs 5935:
1.18 cvs 5936: <div class="subsection">
1.37 cvs 5937: <h3><a name="sectc512" id="sectc512">Translation procedure</a></h3>
1.1 cvs 5938:
1.30 cvs 5939: <p>The translator works on the specific logical structure of the document
1.37 cvs 5940: being translated. It traverses the primary tree of this logical structure in
1.1 cvs 5941: pre-order and, at each node encountered, it applies the corresponding
5942: translation rules defined in the translation schema. Translation can be
1.18 cvs 5943: associated:</p>
5944: <ul>
1.30 cvs 5945: <li>with element types defined in the structure schema,</li>
5946: <li>with global or local attributes defined in the structure schema,</li>
5947: <li>with specific presentation rules,</li>
1.37 cvs 5948: <li>with the content of the leaves of the structure (characters, symbols
1.30 cvs 5949: and graphical elements)</li>
1.18 cvs 5950: </ul>
1.30 cvs 5951:
5952: <p>Thus, for each node, the translator applies all rules associated with the
1.1 cvs 5953: element type, all rules associated with each attribute (local or global)
5954: carried by the element, and if the element is a leaf of the tree, it also
1.10 cvs 5955: applies translation rules for characters, symbols, or graphical elements,
1.18 cvs 5956: depending on the type of the leaf.</p>
1.30 cvs 5957:
5958: <p>Rules associated with the content of leaves are different from all other
1.1 cvs 5959: rules: they specify only how to translate character strings, symbols, and
1.37 cvs 5960: graphical elements. All other rules, whether associated with element types,
1.1 cvs 5961: with specific presentation rules or with attributes, are treated similarly.
1.18 cvs 5962: These rules primarily allow:</p>
5963: <ul>
1.30 cvs 5964: <li>generation of a text constant or variable before or after the contents
5965: of an element,</li>
5966: <li>modification of the order in which elements appear after
5967: translation,</li>
5968: <li>removal of an element in the translated document,</li>
5969: <li>and writing messages on the user's terminal during translation.</li>
1.18 cvs 5970: </ul>
5971: </div>
5972: </div>
1.1 cvs 5973:
1.18 cvs 5974: <div class="section">
1.37 cvs 5975: <h2><a name="sectb52" id="sectb52">Translation definition language</a></h2>
1.1 cvs 5976:
1.30 cvs 5977: <p>Translation schemas are written in a custom language, called T, which is
1.37 cvs 5978: described in the rest of this chapter. The grammar of T is specified using
1.18 cvs 5979: the same <a href="#sectc321">meta-language</a> as was used for the S and P
1.1 cvs 5980: languages and the translation schemas are written using the same conventions
1.37 cvs 5981: as the structure and presentation schemas. In particular, the keywords of the
1.1 cvs 5982: T language (the stings between apostrophes in the following syntax rules) can
5983: be written in any combination of upper-case and lower-case letters, but
5984: identifiers created by the programmer must always be written in the same
1.18 cvs 5985: way.</p>
1.1 cvs 5986:
1.18 cvs 5987: <div class="subsection">
1.37 cvs 5988: <h3><a name="sectc521" id="sectc521">Organization of a translation
5989: schema</a></h3>
1.1 cvs 5990:
1.30 cvs 5991: <p>A translation schema is begun by the <tt>TRANSLATION</tt> keyword and is
1.37 cvs 5992: terminated by the <tt>END</tt> keyword. The <tt>TRANSLATION</tt> keyword is
5993: followed by the name of the generic structure for which a translation is
5994: being defined and a semicolon. This name must be identical to the name which
1.18 cvs 5995: appears after the <tt>STRUCTURE</tt> keyword in the corresponding structure
5996: schema.</p>
1.30 cvs 5997:
5998: <p>After this declaration of the structure, the following material appears in
1.18 cvs 5999: order:</p>
6000: <ul>
1.30 cvs 6001: <li>the length of lines produced by the translation,</li>
6002: <li>the character delimiting the end of the line,</li>
6003: <li>the character string which the translator will insert if it must
6004: line-break the translated text,</li>
1.37 cvs 6005: <li>declarations of
1.30 cvs 6006: <ul>
6007: <li>buffers,</li>
6008: <li>counters,</li>
6009: <li>constants,</li>
6010: <li>variables,</li>
6011: </ul>
6012: </li>
6013: <li>translation rules associated with element types,</li>
6014: <li>translation rules associated with attributes,</li>
6015: <li>translation rules associated with specific presentation rules,</li>
6016: <li>translation rules associated with characters strings, symbols and
6017: graphical elements.</li>
1.18 cvs 6018: </ul>
1.30 cvs 6019:
1.37 cvs 6020: <p>Each of these sections is introduced by a keyword followed by a sequence
6021: of declarations. All of these sections are optional, expect for the
6022: translation rules associated with element types. Many <tt>TEXTTRANSLATE</tt>
6023: sections can appear, each defining the rules for translating character
6024: strings of a particular alphabet.</p>
1.18 cvs 6025: <pre> TransSchema ='TRANSLATION' ElemID ';'
1.1 cvs 6026: [ 'LINELENGTH' LineLength ';' ]
6027: [ 'LINEEND' CHARACTER ';' ]
6028: [ 'LINEENDINSERT' STRING ';' ]
6029: [ 'BUFFERS' BufferSeq ]
6030: [ 'COUNTERS' CounterSeq ]
6031: [ 'CONST' ConstSeq ]
6032: [ 'VAR' VariableSeq ]
6033: 'RULES' ElemSeq
6034: [ 'ATTRIBUTES' AttrSeq ]
6035: [ 'PRESENTATION' PresSeq ]
1.30 cvs 6036: < 'TEXTTRANSLATE' TextTransSeq >
1.1 cvs 6037: [ 'SYMBTRANSLATE' TransSeq ]
6038: [ 'GRAPHTRANSLATE' TransSeq ]
1.18 cvs 6039: 'END' .</pre>
6040: </div>
1.1 cvs 6041:
1.18 cvs 6042: <div class="subsection">
1.37 cvs 6043: <h3><a name="sectc522" id="sectc522">Line length</a></h3>
1.1 cvs 6044:
1.30 cvs 6045: <p>If a <tt>LINELENGTH</tt> instruction is present after the structure
1.37 cvs 6046: declaration, the translator divides the text it produces into lines, each
6047: line having a length less than or equal to the integer which follows the
6048: <tt>LINELENGTH</tt> keyword. This maximum line length is expressed as a
6049: number of characters. The end of the line is marked by the character defined
6050: by the <tt>LINEEND</tt> instruction. When the translator breaks the lines on
1.1 cvs 6051: a space character in generated text, this space will be replaced by the
1.18 cvs 6052: character string defined by the <tt>LINEENDINSERT</tt> instruction.</p>
1.30 cvs 6053:
6054: <p>If the <tt>LINEEND</tt> instruction is not defined then the linefeed
6055: character (octal code 12) is used as the default line end character. If the
1.18 cvs 6056: <tt>LINEENDINSERT</tt> instruction is not defined, the linefeed character is
1.37 cvs 6057: inserted at the end of the produced lines. If there is no <tt>LINELENGTH</tt>
6058: instruction, the translated text is not divided into lines. Otherwise, if the
1.1 cvs 6059: translation rules generate line end marks, these marks remain in the
6060: translated text, but the length of the lines is not controlled by the
1.18 cvs 6061: translator.</p>
6062: <pre> LineLength = NUMBER .</pre>
1.30 cvs 6063:
1.18 cvs 6064: <blockquote class="example">
1.30 cvs 6065: <p><strong>Example:</strong></p>
6066:
6067: <p>To limit the lines produced by the translator to a length of 80
6068: characters, the following rule is written at the beginning of the
6069: translation schema.</p>
6070: <pre>LineLength 80;</pre>
1.18 cvs 6071: </blockquote>
6072: </div>
1.1 cvs 6073:
1.18 cvs 6074: <div class="subsection">
1.37 cvs 6075: <h3><a name="sectc523" id="sectc523">Buffers</a></h3>
1.1 cvs 6076:
1.37 cvs 6077: <p>A buffer is a unit of memory managed by the translator, which can either
1.18 cvs 6078: contain text read from the terminal during the translation (see the <a
6079: href="#sectc5212"><tt>Read</tt> rule</a>), or the name of the last picture
1.1 cvs 6080: (bit-map) encountered by the translator in its traversal of the document.
1.2 cvs 6081: Remember the pictures are stored in files that are separate for the document
1.1 cvs 6082: files and that the canonical form contains only the names of the files in
1.18 cvs 6083: which the pictures are found.</p>
1.30 cvs 6084:
1.37 cvs 6085: <p>Thus, there are two types of buffers: buffers for reading from the
1.30 cvs 6086: terminal (filled by the <tt>Read</tt> rule) and the buffer of picture names
1.37 cvs 6087: (containing the name of the last picture encountered). A translation schema
1.30 cvs 6088: can use either type, one or several read buffers and one (and only one)
6089: picture name buffer.</p>
6090:
6091: <p>If any buffers are used, the <tt>BUFFERS</tt> keyword must be present,
1.37 cvs 6092: followed by declarations of every buffer used in the translation schema. Each
6093: buffer declaration is composed only of the name of the buffer, chosen freely
6094: by the programmer. The picture name buffer is identified by the
6095: <tt>Picture</tt> keyword, between parentheses, following the buffer name. The
6096: <tt>Picture</tt> keyword may only appear once. Each buffer declaration is
1.18 cvs 6097: terminated by a semicolon.</p>
1.30 cvs 6098: <pre> BufferSeq = Buffer < Buffer > .
1.1 cvs 6099: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
1.18 cvs 6100: BufferID = NAME .</pre>
1.30 cvs 6101:
1.18 cvs 6102: <blockquote class="example">
1.30 cvs 6103: <p><strong>Example:</strong></p>
6104:
6105: <p>The following buffer declarations create a picture name buffer named
1.37 cvs 6106: <tt>pictureName</tt> and a read buffer named <a name="destname"
6107: id="destname"><tt>DestName</tt></a>:</p>
1.30 cvs 6108: <pre>BUFFERS
1.18 cvs 6109: pictureName (Picture); DestName;</pre>
6110: </blockquote>
6111: </div>
1.1 cvs 6112:
1.18 cvs 6113: <div class="subsection">
1.37 cvs 6114: <h3><a name="sectc524" id="sectc524">Counters</a></h3>
1.30 cvs 6115:
6116: <p>Certain translation rules generate text that varies according to the
1.37 cvs 6117: context of the element to which the rules apply. Variable text is defined
1.30 cvs 6118: either in the <a href="#sectc526"><tt>VAR</tt> section</a> of the translation
6119: schema or in the rule itself (see the <tt>Create</tt> and <tt>Write</tt>
1.37 cvs 6120: rules). Both types of definition rely on counters for the calculation of
1.30 cvs 6121: variable material.</p>
6122:
6123: <p>There are two types of counter: counters whose value is explicitely
6124: computed by applying <a href="#sectc5221"><tt>Set</tt> and <tt>Add</tt>
6125: rules</a>, and counters whose value is computed by a function associated with
6126: the counter. Those functions allow the same calculations as can be used in
1.37 cvs 6127: presentation schemas. As in a presentation schema, counters must be defined
6128: in the <tt>COUNTERS</tt> section of the translation schema before they are
1.30 cvs 6129: used.</p>
6130:
6131: <p>When counters are used in a translation schema, the <tt>COUNTERS</tt>
1.37 cvs 6132: keyword is followed by the declarations of every counter used. Each
6133: declaration is composed of the counter's name possibly followed by a colon
6134: and the counting function to be used for the counter. The declaration is
1.30 cvs 6135: terminated by a semi-colon. If the counter is explicitely computed by
6136: <tt>Set</tt> and <tt>Add</tt> rules, no counting function is indicated. If a
6137: counting function is indicated, <tt>Set</tt> and <tt>Add</tt> rules cannot be
6138: applied to that counter.</p>
1.1 cvs 6139:
1.30 cvs 6140: <p>The counting function indicates how the counter's value will be computed.
1.18 cvs 6141: Three functions are available: <tt>Rank</tt>, <tt>Rlevel</tt>, and
6142: <tt>Set</tt>.</p>
6143: <ul>
1.39 ! cvs 6144: <li><tt>Rank of ElemID</tt>
! 6145: indicates that the counter's value is the rank of the element of type
! 6146: <tt>ElemID</tt> which encloses the element for which the counter is being
! 6147: evaluated. For the purposes of this function, an element of type
! 6148: <tt>ElemID</tt> is considered to enclose itself. This function is
! 6149: primarily used when the element of type <tt>ElemID</tt> is part of an
! 6150: aggregate or list, in which case the counter's value is the element's
! 6151: rank in its list or aggregate. Note that, unlike the <tt>Rank</tt>
! 6152: function for presentation schemas, the <tt>Page</tt> keyword cannot be
! 6153: used in place of the <tt>ElemID</tt>.
1.37 cvs 6154: <p>The type name <tt>ElemID</tt> can be followed by an integer. That
6155: number represents the relative level, among the ancestors of the
6156: concerned element, of the element whose rank is asked. If that relative
6157: level <i>n</i> is unsigned, the <i>n<sup>th</sup></i> element of type
6158: <tt>ElemID</tt> encountered when travelling the logical structure from
6159: the root to the concerned element is taken into account. If the relative
1.30 cvs 6160: level is negative, the logical structure is travelled in the other
6161: direction, from the concerned element to the root.</p>
6162: </li>
1.39 ! cvs 6163: <li><tt>Rlevel of ElemID</tt>
! 6164: indicates that the counter's values is the relative level in the tree of
! 6165: the element for which the counter is being evaluated. The counter counts
! 6166: the number of elements of type <tt>ElemID</tt> which are found on the
! 6167: path between the root of the document's logical structure tree and the
! 6168: element (inclusive).</li>
! 6169: <li><tt>Set n on Type1 Add m on Type2</tt>
! 6170: indicates that the counter's value is calculated as follows: in
! 6171: traversing the document from the beginning to the element for which the
! 6172: counter is being evaluated, the counter is set to the value <tt>n</tt>
! 6173: each time a <tt>Type1</tt> element is encountered and is incremented by
! 6174: the amount <tt>m</tt> each time a <tt>Type2</tt> element is encountered.
! 6175: The initial value <tt>n</tt> and the increment <tt>m</tt> are
! 6176: integers.</li>
1.30 cvs 6177: </ul>
6178:
6179: <p>As in a presentation schema, the <tt>Rank</tt> and <tt>Set</tt> functions
1.37 cvs 6180: can be modified by a numeric attribute which changes their initial value.
6181: This is indicated by the <tt>Init</tt> keyword followed by the numeric
6182: attribute's name. The <tt>Set</tt> function takes the value of the attribute
6183: instead of the <tt>InitValue</tt> (<tt>n</tt>). For the <tt>Rank</tt>
6184: function, the value of the attribute is considered to be the rank of the
6185: first element of the list (rather than the normal value of 1). Subsequent
6186: items in the list have their ranks shifted accordingly. In both cases, the
6187: attribute must be numeric and must be a local attribute of the root of the
6188: document itself.</p>
1.30 cvs 6189: <pre> CounterSeq = Counter < Counter > .
1.1 cvs 6190: Counter = CounterID [ ':' CounterFunc ] ';' .
6191: CounterID = NAME .
6192: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
6193: [ 'Init' AttrID ] /
6194: 'Rlevel' 'of' ElemID /
6195: 'Set' InitValue 'On' ElemID
6196: 'Add' Increment 'On' ElemID
6197: [ 'Init' AttrID ] .
6198: SLevelAsc = [ '-' ] LevelAsc .
6199: LevelAsc = NUMBER .
6200: InitValue = NUMBER .
6201: Increment = NUMBER .
6202: ElemID = NAME .
1.18 cvs 6203: AttrID = NAME .</pre>
1.30 cvs 6204:
1.18 cvs 6205: <blockquote class="example">
1.30 cvs 6206: <p><strong>Example:</strong></p>
6207:
6208: <p>If the body of a chapter is defined in the structure schema by:</p>
6209: <pre>Chapter_Body = LIST OF
1.1 cvs 6210: (Section = BEGIN
6211: Section_Title = Text;
6212: Section_Body = BEGIN
6213: Paragraphs;
6214: Section;
6215: END;
6216: END
1.18 cvs 6217: );</pre>
1.30 cvs 6218:
6219: <p>(sections are defined recursively), a counter can be defined giving the
1.37 cvs 6220: <a name="sectnum" id="sectnum">number of a section</a> within its level in
6221: the hierarchy:</p>
1.30 cvs 6222: <pre>COUNTERS
1.18 cvs 6223: SectionNumber : Rank of Section;</pre>
1.30 cvs 6224:
6225: <p>A counter holding the hierarchic level of a section:</p>
6226: <pre> SectionLevel : Rlevel of Section;</pre>
6227:
1.37 cvs 6228: <p>A <a name="uniquenum" id="uniquenum">counter</a> which sequentially
6229: numbers all the document's sections, whatever their hierarchic level:</p>
1.30 cvs 6230: <pre> UniqueSectNum : Set 0 on Document Add 1 on Section;</pre>
1.18 cvs 6231: </blockquote>
6232: </div>
1.1 cvs 6233:
1.18 cvs 6234: <div class="subsection">
1.37 cvs 6235: <h3><a name="sectc525" id="sectc525">Constants</a></h3>
1.1 cvs 6236:
1.30 cvs 6237: <p>A common feature of translation rules is the generation of constant text.
1.37 cvs 6238: This text can be defined in the rule that generates it (see for example the
6239: <a href="#sectc5210"><tt>Create</tt></a> and <a
1.18 cvs 6240: href="#sectc5211"><tt>Write</tt></a> rules); but it can also be defined once
6241: in the constant declaration section and used many times in different rules.
1.37 cvs 6242: The latter option is preferable when the same text is used in several rules
6243: or several <a href="#sectc526">variables</a>.</p>
1.30 cvs 6244:
6245: <p>The <tt>CONST</tt> keyword begins the constant declaration section of the
1.37 cvs 6246: translation schema. It must be omitted if no constants are declared. Each
6247: constant declaration is composed of the constant name, an equals sign, and
6248: the constant's value, which is a character string between apostrophes. A
6249: constant declaration is terminated by a semicolon.</p>
1.30 cvs 6250: <pre> ConstSeq = Const < Const > .
1.1 cvs 6251: Const = ConstID '=' ConstValue ';' .
6252: ConstID = NAME .
1.18 cvs 6253: ConstValue = STRING .</pre>
1.30 cvs 6254:
1.18 cvs 6255: <blockquote class="example">
1.37 cvs 6256: <p><strong><a name="levelexample"
6257: id="levelexample">Example:</a></strong></p>
1.30 cvs 6258:
6259: <p>The following rule assigns the name <tt>TxtLevel</tt> to the character
6260: string ``Level'':</p>
6261: <pre>CONST
1.18 cvs 6262: TxtLevel = 'Level';</pre>
6263: </blockquote>
6264: </div>
1.1 cvs 6265:
1.18 cvs 6266: <div class="subsection">
1.37 cvs 6267: <h3><a name="sectc526" id="sectc526">Variables</a></h3>
1.1 cvs 6268:
1.30 cvs 6269: <p>Variables allow to define variable text which is generated by the
1.37 cvs 6270: <tt>Create</tt> and <tt>Write</tt> rules. They are also used to define file
1.18 cvs 6271: names which are used in the <tt>Create</tt>, <tt>ChangeMainFile</tt>,
1.37 cvs 6272: <tt>RemoveFile</tt>, and <tt>Indent</tt> rules. Variables can be defined
1.18 cvs 6273: either in the <tt>VAR</tt> section of the translation schema or directly in
1.37 cvs 6274: the rules which use them. Variables that define file names must be declared
1.18 cvs 6275: in the <tt>VAR</tt> section, and when the same variable is used several times
6276: in the translation schema, it makes sense to define it globally in the
1.37 cvs 6277: <tt>VAR</tt> section. This section is only present if at least one variable
1.18 cvs 6278: is defined globally.</p>
1.30 cvs 6279:
6280: <p>After the <tt>VAR</tt> keyword, each global variable is defined by its
6281: name, a colon separator and a sequence of functions (at least one function).
1.37 cvs 6282: Each variable definition is terminated by a semicolon. Functions determine
6283: the different parts which together give the value of the variable. The value
6284: is obtained by concatenating the strings produced by each of the functions.
6285: Seven types of functions are available. Each variable definition may use any
6286: number of functions of each type.</p>
1.18 cvs 6287: <ul>
1.30 cvs 6288: <li>The function <tt>Value(Counter)</tt>returns a string representing the
6289: value taken by the counter when it is evaluated for the element in whose
1.37 cvs 6290: rule the variable is used. The counter must have been declared in the
6291: <tt>COUNTERS</tt> section of the translation schema. When the counter is
1.30 cvs 6292: expressed in arabic numerals, the counter name can be followed by a colon
6293: and an integer indicating a minimum length (number of characters) for the
1.37 cvs 6294: string; if the counter's value is normally expressed with fewer
6295: characters than the required minimum, zeroes are added to the front of
6296: the string to achieve the minimum length.
1.30 cvs 6297: <p>By default, the counter value is written in arabic digits. If another
6298: representation of that value is needed, the counter name must be followed
6299: by a comma and one of the following keywords:</p>
6300: <ul>
1.39 ! cvs 6301: <li><tt>Arabic</tt>
! 6302: : arabic numerals (default value),</li>
! 6303: <li><tt>LRoman</tt>
! 6304: : lower-case roman numerals,</li>
! 6305: <li><tt>URoman</tt>
! 6306: : upper-case roman numerals,</li>
! 6307: <li><tt>Uppercase</tt>
! 6308: : upper-case letter,</li>
! 6309: <li><tt>Lowercase</tt>
! 6310: : lower-case letter.</li>
1.30 cvs 6311: </ul>
6312: </li>
6313: <li>The function <tt>FileDir</tt>, without parameter, returns a string
6314: representing the name of the directory of the output file that has been
6315: given as a parameter to the translation program. The string includes a
6316: character '/' at the end.</li>
6317: <li>The function <tt>FileName</tt>, without parameter, returns a string
6318: representing the name of the output file that has been given as a
6319: parameter to the translation program. The file extension (the character
6320: string that terminate the file name, after a dot) is not part of that
6321: string.</li>
6322: <li>The function <tt>Extension</tt>, without parameter, returns a string
6323: representing the extension of the file name. That string is empty if the
6324: file name that has been given as a parameter to the translation program
6325: has no extension. If there is an extension, its first character is a
6326: dot.</li>
6327: <li>The function <tt>DocumentName</tt>, without parameter, returns a string
6328: representing the name of the document being translated.</li>
6329: <li>The function <tt>DocumentDir</tt>, without parameter, returns a string
6330: representing the directory containing the document being translated.</li>
6331: <li>The function formed by the name of a constant returns that constant's
6332: value.</li>
6333: <li>The function formed by a character string between apostrophes returns
6334: that string.</li>
1.37 cvs 6335: <li>The function formed by the name of a buffer returns the contents of
6336: that buffer. If the named buffer is the picture buffer, then the name of
6337: the last picture encountered is returned. Otherwise, the buffer is a read
1.31 cvs 6338: buffer and the value returned is text previously read from the terminal.
1.30 cvs 6339: If the buffer is empty (no picture has been encountered or the
6340: <tt>Read</tt> rule has not been executed for the buffer), then the empty
6341: string is returned.</li>
6342: <li>The function formed by an attribute name takes the value of the
1.37 cvs 6343: indicated attribute for the element to which the variable applies. If the
1.30 cvs 6344: element does not have that attribute, then the element's ancestor are
1.37 cvs 6345: searched toward the root of the tree. If one of the ancestors does have
6346: the attribute then its value is used. If no ancestors have the attribute,
1.30 cvs 6347: then the value of the function is the empty string.</li>
1.18 cvs 6348: </ul>
1.30 cvs 6349: <pre> VariableSeq = Variable < Variable > .
6350: Variable = VarID ':' Function < Function > ';' .
1.1 cvs 6351: VarID = NAME .
6352: Function ='Value' '(' CounterID [ ':' Length ]
6353: [ ',' CounterStyle ] ')' /
6354: 'FileDir' / 'FileName' / 'Extension' /
6355: 'DocumentName' / 'DocumentDir' /
6356: ConstID / CharString /
6357: BufferID / AttrID .
6358: Length = NUMBER .
6359: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
6360: 'Uppercase' / 'Lowercase' .
1.18 cvs 6361: CharString = STRING .</pre>
1.30 cvs 6362:
1.18 cvs 6363: <blockquote class="example">
1.30 cvs 6364: <p><strong>Example:</strong></p>
6365:
6366: <p>To create, at the beginning of each section of the translated document,
6367: text composed of the string ``Section'' followed by the section number, the
1.37 cvs 6368: following <a name="varsectexample" id="varsectexample">variable
6369: definition</a> might be used:</p>
1.30 cvs 6370: <pre>VAR
1.18 cvs 6371: SectionVar : 'Section' Value(SectionNumber);</pre>
1.30 cvs 6372:
6373: <p>(see the definition of <a
6374: href="#sectnum"><tt>SectionNumber</tt></a>).</p>
6375:
1.37 cvs 6376: <p>The following variable definition can be used to create, at the
6377: beginning of each section, the text ``Level'' followed by the hierarchical
6378: level of the section. It used the constant defined above.</p>
1.30 cvs 6379: <pre> LevelVar : TxtLevel Value(SectionLevel);</pre>
6380:
6381: <p>(see the definitions of <a href="#sectnum"><tt>SectionLevel</tt></a> and
6382: of <a href="#levelexample"><tt>TxtLevel</tt></a>).</p>
6383:
6384: <p>To generate the translation of each section in a different file (see <a
1.37 cvs 6385: href="#sectc5220">rule <tt>ChangeMainFile</tt></a>), the name of these
6386: files might be defined by the following variable:</p>
1.30 cvs 6387: <pre> VarOutpuFile : FileName Value(SectionNumber)
1.18 cvs 6388: Extension;</pre>
1.30 cvs 6389:
1.37 cvs 6390: <p>If <tt>output.txt</tt> is the name of the <a name="varoutputfile"
6391: id="varoutputfile">output file</a> specified when starting the translation
6392: program, translated sections are written in files <tt>output1.txt</tt>,
6393: <tt>output2.txt</tt>, etc.</p>
1.18 cvs 6394: </blockquote>
6395: </div>
6396:
6397: <div class="subsection">
1.37 cvs 6398: <h3><a name="sectc527" id="sectc527">Translating structure elements</a></h3>
1.18 cvs 6399:
1.30 cvs 6400: <p>The <tt>RULES</tt> keyword introduces the translation rules which will be
1.37 cvs 6401: applied to the various structured element types. Translation rules can be
6402: specified for each element type defined in the structure schema, including
6403: the base types defined implicitly, whose names are <tt>TEXT_UNIT</tt>,
1.18 cvs 6404: <tt>PICTURE_UNIT</tt>, <tt>SYMBOL_UNIT</tt>, <tt>GRAPHIC_UNIT</tt> and
1.37 cvs 6405: <tt>PAGE_UNIT</tt>. But it is not necessary to specify rules for every
1.18 cvs 6406: defined type.</p>
1.30 cvs 6407:
1.37 cvs 6408: <p>If there are no translation rules for an element type, the elements that
6409: it contains (and which may have rules themselves) will still be translated,
6410: but the translator will produce nothing for the element itself. To make the
1.18 cvs 6411: translator completely ignore the content of an element the <a
6412: href="#sectc5217"><tt>Remove</tt> rule</a> must be used.</p>
1.30 cvs 6413:
6414: <p>The translation rules for an element type defined in the structure schema
6415: are written using the name of the type followed by a colon and the list of
1.37 cvs 6416: applicable rules. When the element type is a <a href="#sectd3285">mark
1.18 cvs 6417: pair</a>, but only in this case, the type name must be preceded by the
1.37 cvs 6418: <tt>First</tt> or <tt>Second</tt> keyword. This keyword indicates whether the
1.18 cvs 6419: rules that follow apply to the first or second mark of the pair.</p>
1.30 cvs 6420:
1.37 cvs 6421: <p>The list of rules can take several forms. It may be a simple
6422: non-conditional rule. It can also be formed by a condition followed by one or
6423: more simple rules. Or it can be a block of rules beginning with the
1.30 cvs 6424: <tt>BEGIN</tt> keyword and ending with the <tt>END</tt> keyword and a
1.37 cvs 6425: semicolon. This block of rules can contain one or more simple rules and/or
1.30 cvs 6426: one or more conditions, each followed by one or more simple rules.</p>
6427: <pre> ElemSeq = TransType < TransType > .
1.1 cvs 6428: TransType = [ FirstSec ] ElemID ':' RuleSeq .
6429: FirstSec = 'First' / 'Second' .
1.30 cvs 6430: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
1.1 cvs 6431: Rule = SimpleRule / ConditionBlock .
6432: ConditionBlock = 'IF' ConditionSeq SimpleRuleSeq .
1.30 cvs 6433: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
1.18 cvs 6434: SimpleRule .</pre>
6435: </div>
1.1 cvs 6436:
1.18 cvs 6437: <div class="subsection">
1.37 cvs 6438: <h3><a name="sectc528" id="sectc528">Conditional rules</a></h3>
1.1 cvs 6439:
1.30 cvs 6440: <p>In a translation schema, the translation rules are either associated with
1.37 cvs 6441: element types or with attribute values or with a specific presentation. They
1.1 cvs 6442: are applied by the translator each time an element of the corresponding type
6443: is encountered in the translated document or each time the attribute value is
6444: carried by an element or also, each time the specific translation is attached
1.37 cvs 6445: to an element. This systematic application of the rules can be relaxed: it is
6446: possible to add a condition to one or more rules, so that these rules are
6447: only applied when the condition is true.</p>
1.30 cvs 6448:
6449: <p>A condition begins with the keyword <tt>IF</tt>, followed by a sequence of
1.37 cvs 6450: elementary conditions. Elementary conditions are separated from each other by
6451: the <tt>AND</tt> keyword. If there is only one elementary condition, this
6452: keyword is absent. The rules are only applied if all the elementary
6453: conditions are true. The elementary condition can be negative; it is then
1.18 cvs 6454: preceded by the <tt>NOT</tt> keyword.</p>
1.30 cvs 6455:
6456: <p>When the translation rule(s) controlled by the condition apply to a
6457: reference element or a reference attribute, an elementary condition can also
1.37 cvs 6458: apply to element referred by this reference. The <tt>Target</tt> keyword is
6459: used for that purpose. It must appear before the keyword defining the
1.30 cvs 6460: condition type.</p>
6461:
6462: <p>Depending on their type, some conditions may apply either to the element
1.37 cvs 6463: with which they are associated, or to one of its ancestor. In the case of an
1.18 cvs 6464: ancestor, the key word <tt>Ancestor</tt> must be used, followed by</p>
6465: <ul>
1.30 cvs 6466: <li>either an integer which represents the number of levels in the tree
6467: between the element and the ancestor of interest,</li>
1.37 cvs 6468: <li>or the type name of the ancestor of interest. If that type is defined
1.30 cvs 6469: in a separate structure schema, the name of that schema must follow
6470: between parentheses.</li>
1.18 cvs 6471: </ul>
1.30 cvs 6472:
1.37 cvs 6473: <p>There is a special case for the parent element, which can be simply
6474: written <tt>Parent</tt> instead of <tt>Ancestor 1</tt>.</p>
1.30 cvs 6475:
6476: <p>Only conditions <tt>First</tt>, <tt>Last</tt>, <tt>Referred</tt>,
1.34 cvs 6477: <tt>Within</tt>, <tt>Attributes</tt>, <tt>Presentation</tt>, and those
6478: concerning an attribute or a specific presentation can apply to an ancestor.
6479: Conditions <tt>FirstRef</tt>, <tt>LastRef</tt>, <tt>ExternalRef</tt>,
6480: <tt>Alphabet</tt>, <tt>FirstAttr</tt>, <tt>LastAttr</tt>,
6481: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>,
6482: <tt>ReminderPage</tt>, <tt>Empty</tt> cannot be preceded by keywords
6483: <tt>Parent</tt> or <tt>Ancestor</tt>.</p>
1.30 cvs 6484:
1.37 cvs 6485: <p>In condition <tt>Referred</tt> and in the condition that applies to a
6486: named attribute, a symbol '<tt>*</tt>' can indicate that the condition is
6487: related only to the element itself. If this symbol is not present, not only
6488: the element is considered, but also its ancestor, at any level.</p>
1.30 cvs 6489:
6490: <p>The form of an elementary condition varies according to the type of
1.18 cvs 6491: condition.</p>
1.1 cvs 6492:
1.18 cvs 6493: <div class="subsubsection">
1.37 cvs 6494: <h4><a name="sectd5281" id="sectd5281">Conditions based on the logical
6495: position of the element</a></h4>
1.30 cvs 6496:
6497: <p>The condition can be on the position of the element in the document's
1.37 cvs 6498: logical structure tree. It is possible to test whether the element is the
1.30 cvs 6499: first (<tt>First</tt>) or last (<tt>Last</tt>) among its siblings or if it is
6500: not the first (<tt>NOT First</tt>) or not the last (<tt>NOT Last</tt>).</p>
6501:
6502: <p>It is also possible to test if the element is contained in an element of a
1.18 cvs 6503: given type (<tt>Within</tt>) or if it is not (<tt>NOT Within</tt>). If that
1.1 cvs 6504: element type is defined in a structure schema which is not the one which
6505: corresponds to the translation schema, the type name of this element must be
6506: followed, between parentheses, by the name of the structure schema which
1.18 cvs 6507: defines it.</p>
1.30 cvs 6508:
6509: <p>If the keyword <tt>Within</tt> is preceded by <tt>Immediately</tt>, the
1.18 cvs 6510: condition is satisfied only if the <em>parent</em> element has the type
6511: indicated. If the word <tt>Immediately</tt> is missing, the condition is
6512: satisfied if any <em>ancestor</em> has the type indicated.</p>
1.30 cvs 6513:
6514: <p>An integer <i>n</i> can appear between the keyword <tt>Within</tt> and the
1.37 cvs 6515: type. It specifies the number of ancestors of the indicated type that must be
6516: present for the condition to be satisfied. If the keyword
1.18 cvs 6517: <tt>Immediately</tt> is also present, the <i>n</i> immediate ancestors of the
1.37 cvs 6518: element must have the indicated type. The integer <i>n</i> must be positive
6519: or zero. It can be preceded by <tt><</tt> or <tt>></tt> to indicate a
6520: maximum or minimum number of ancestors. If these symbols are missing, the
6521: condition is satisfied only if it exists exactly <i>n</i> ancestors. When
1.30 cvs 6522: this number is missing, it is equivalent to > 0.</p>
6523:
1.37 cvs 6524: <p>If the condition applies to translation rules associated with an
6525: attribute, i.e. if it is in the <tt>ATTRIBUTES</tt> section of the
6526: presentation schema, the condition can be simply an element name. Translation
6527: rules are then executed only if the attribute is attached to an element of
6528: that type. The keyword <tt>NOT</tt> before the element name indicates that
6529: the translation rules must be executed only if the element is not of the type
6530: indicated.</p>
1.18 cvs 6531: </div>
1.1 cvs 6532:
1.18 cvs 6533: <div class="subsubsection">
1.37 cvs 6534: <h4><a name="sectd5282" id="sectd5282">Conditions on references</a></h4>
1.1 cvs 6535:
1.30 cvs 6536: <p>References may be taken into account in conditions, which can be based on
6537: the fact that the element, or one of its ancestors (unless symbol <tt>*</tt>
6538: is present), is designated by a at least one reference (<tt>Referred</tt>) or
1.37 cvs 6539: by none (<tt>NOT Referred</tt>). If the element or attribute to which the
1.1 cvs 6540: condition is attached is a reference, the condition can be based on the fact
6541: that it acts as the first reference to the designated element
1.18 cvs 6542: (<tt>FirstRef</tt>), or as the last (<tt>LastRef</tt>), or as a reference to
1.37 cvs 6543: an element located in another document (<tt>ExternalRef</tt>). Like all
1.18 cvs 6544: conditions, conditions on references can be inverted by the <tt>NOT</tt>
6545: keyword.</p>
6546: </div>
6547:
6548: <div class="subsubsection">
1.37 cvs 6549: <h4><a name="sectd5284" id="sectd5284">Conditions on the alphabets</a></h4>
1.1 cvs 6550:
1.30 cvs 6551: <p>The character string base type (and only this type) can use the condition
1.37 cvs 6552: <tt>Alphabet = a</tt> which indicates that the translation rule(s) should
6553: only apply if the alphabet of the character string is the one whose name
6554: appears after the equals sign (or is not, if there is a preceding
6555: <tt>NOT</tt> keyword). This condition cannot be applied to translation rules
6556: of an attribute.</p>
1.30 cvs 6557:
6558: <p>In the current implementation of Thot, the available alphabets are the
1.18 cvs 6559: <tt>Latin</tt> alphabet and the <tt>Greek</tt> alphabet.</p>
6560: </div>
1.1 cvs 6561:
1.18 cvs 6562: <div class="subsubsection">
1.37 cvs 6563: <h4><a name="sectd5285" id="sectd5285">Conditions on page breaks</a></h4>
1.1 cvs 6564:
1.30 cvs 6565: <p>The page break base type (and only this type) can use the following
1.18 cvs 6566: conditions: <tt>ComputedPage</tt>, <tt>StartPage</tt>, <tt>UserPage</tt>, and
1.37 cvs 6567: <tt>ReminderPage</tt>. The <tt>ComputedPage</tt> condition indicates that the
1.1 cvs 6568: translation rule(s) should apply if the page break was created automatically
1.37 cvs 6569: by Thot; the <tt>StartPage</tt> condition is true if the page break is
1.18 cvs 6570: generated before the element by the <tt>Page</tt> rule of the P language; the
6571: <tt>UserPage</tt> condition applies if the page break was inserted by the
1.37 cvs 6572: user; and the <tt>ReminderPage</tt> is applied if the page break is a
6573: reminder of page breaking.</p>
1.18 cvs 6574: </div>
1.1 cvs 6575:
1.18 cvs 6576: <div class="subsubsection">
1.37 cvs 6577: <h4><a name="sectd5286" id="sectd5286">Conditions on the element's
6578: content</a></h4>
1.1 cvs 6579:
1.37 cvs 6580: <p>The condition can be based on whether or not the element is empty. An
1.30 cvs 6581: element which has no children or whose leaves are all empty is considered to
1.37 cvs 6582: be empty itself. This condition is expressed by the <tt>Empty</tt> keyword,
1.30 cvs 6583: optionally preceded by the <tt>NOT</tt> keyword.</p>
1.18 cvs 6584: </div>
1.1 cvs 6585:
1.18 cvs 6586: <div class="subsubsection">
1.37 cvs 6587: <h4><a name="sectd5288" id="sectd5288">Conditions on the presence of specific
6588: presentation rules</a></h4>
1.30 cvs 6589:
6590: <p>The condition can be based on the presence or absence of specific
1.37 cvs 6591: presentation rules associated with the translated element, whatever the
6592: rules, their value or their number. This condition is expressed by the
6593: keyword <tt>Presentation</tt>, optionally preceded by the <tt>NOT</tt>
6594: keyword.</p>
1.18 cvs 6595: </div>
1.1 cvs 6596:
1.18 cvs 6597: <div class="subsubsection">
1.37 cvs 6598: <h4><a name="sectd5289" id="sectd5289">Conditions on the presence of logical
1.18 cvs 6599: attributes</a></h4>
1.30 cvs 6600:
6601: <p>In the same way, the condition can be based on the presence or absence of
1.1 cvs 6602: attributes associated with the translated elements, no matter what the
1.37 cvs 6603: attributes or their values. The <tt>Attributes</tt> keyword expresses this
1.18 cvs 6604: condition.</p>
6605: </div>
1.1 cvs 6606:
1.18 cvs 6607: <div class="subsubsection">
1.37 cvs 6608: <h4><a name="sectd52810" id="sectd52810">Conditions on logical
6609: attributes</a></h4>
1.1 cvs 6610:
1.30 cvs 6611: <p>If the condition appears in the translation rules of an attribute, the
1.37 cvs 6612: <tt>FirstAttr</tt> and <tt>LastAttr</tt> keywords can be used to indicate
6613: that the rules must only be applied if this attribute is the first attribute
6614: for the translated element or if it is the last (respectively). These
6615: conditions can also be inverted by the <tt>NOT</tt> keyword.</p>
6616:
6617: <p>Another type of condition can only be applied to the translation rules
6618: when the element being processed (or one of its ancestors if symbol
6619: <tt>*</tt> is missing) has a certain attribute, perhaps with a certain value
6620: or, in contrast, when the element does not have this attribute with this
6621: value. The condition is specified by writing the name of the attribute after
6622: the keyword <tt>IF</tt> or <tt>AND</tt>. The <tt>NOT</tt> keyword can be used
6623: to invert the condition. If the translation rules must be applied to any
6624: element which has this attribute (or does not have it, if the condition is
6625: inverted) no matter what the attribute's value, the condition is complete.
6626: If, in contrast, the condition applies to one or more values of the
6627: attribute, these are indicated after the name of the attribute, except for
6628: reference attributes which do not have values.</p>
6629:
6630: <p>The representation of the values of an <a name="relattr"
6631: id="relattr">attribute</a> in a condition depends on the attribute's type.
6632: For attributes with enumerated or textual types, the value (a name or
6633: character string between apostrophes, respectively) is simply preceded by an
6634: equals sign. For numeric attributes, the condition can be based on a single
6635: value or on a range of values. In the case of a unique value, this value (an
6636: integer) is simply preceded by an equals sign. Conditions based on ranges of
6637: values have several forms:</p>
1.18 cvs 6638: <ul>
1.30 cvs 6639: <li>all values less than a given value (the value is preceded by a ``less
6640: than'' sign).</li>
6641: <li>all values greater than a given value (the value is preceded by a
6642: ``greater than'' sign).</li>
1.37 cvs 6643: <li>all values falling in an interval, bounds included. The range of values
6644: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>,
6645: where Minimum and Maximum are integers.</li>
1.18 cvs 6646: </ul>
1.30 cvs 6647:
1.37 cvs 6648: <p>All numeric values may be negative. The integer is simply preceded by a
1.30 cvs 6649: minus sign.</p>
6650:
6651: <p>Both local and global attributes can be used in conditions.</p>
1.18 cvs 6652: </div>
1.1 cvs 6653:
1.18 cvs 6654: <div class="subsubsection">
1.37 cvs 6655: <h4><a name="sectd52811" id="sectd52811">Conditions on specific presentation
6656: rules</a></h4>
1.1 cvs 6657:
1.30 cvs 6658: <p>It is possible to apply translation rules only when the element being
1.1 cvs 6659: processed has or does not have a specific presentation rule, possibly with a
1.37 cvs 6660: certain value. The condition is specified by writing the name of the
6661: presentation rule after the keyword <tt>IF</tt> or <tt>AND</tt>. The
6662: <tt>NOT</tt> keyword can be used to invert the condition. If the translation
6663: rules must be applied to any element which has this presentation rule (or
6664: does not have it, if the condition is inverted) no matter what the rule's
6665: value, the condition is complete. If, in contrast, the condition applies to
6666: one or more values of the rule, these are indicated after the name of the
1.18 cvs 6667: attribute.</p>
1.30 cvs 6668:
1.37 cvs 6669: <p>The representation of presentation rule values in a condition is similar
6670: to that for attribute values. The representation of these values depend on
6671: the type of the presentation rule. There are three categories of presentation
1.18 cvs 6672: rules:</p>
6673: <ul>
1.30 cvs 6674: <li>those taking numeric values (<tt>Size, Indent, LineSpacing,
6675: LineWeight</tt>),</li>
1.36 cvs 6676: <li>those with values taken from a predefined list (<tt>Adjust, Hyphenate,
6677: Style, Weight, Font, UnderLine, Thickness, LineStyle</tt>),</li>
1.30 cvs 6678: <li>those whose value is a name (<tt>FillPattern, Background,
6679: Foreground</tt>).</li>
1.18 cvs 6680: </ul>
1.30 cvs 6681:
6682: <p>For presentation rules which take numeric values, the condition can take a
1.37 cvs 6683: unique value or a range of values. In the case of a unique value, this value
1.1 cvs 6684: (an integer) is simply preceded by an equals sign. Conditions based on ranges
1.18 cvs 6685: of values have several forms:</p>
6686: <ul>
1.30 cvs 6687: <li>all values less than a given value (the value is preceded by a ``less
6688: than'' sign).</li>
6689: <li>all values greater than a given value (the value is preceded by a
6690: ``greater than'' sign).</li>
1.37 cvs 6691: <li>all values falling in an interval, bounds included. The range of values
6692: is then specified <tt>IN [</tt>Minimum <tt>..</tt>Maximum<tt>]</tt>,
6693: where Minimum and Maximum are integers.</li>
1.18 cvs 6694: </ul>
1.30 cvs 6695:
1.37 cvs 6696: <p>Values for the <tt>Indent</tt>rule may be negative. The integer is then
1.2 cvs 6697: simply preceded by a minus sign and represents how far the first line starts
1.18 cvs 6698: to the left of the other lines.</p>
1.30 cvs 6699:
6700: <p>For presentation rules whose values are taken from predefined lists, the
1.37 cvs 6701: value which satisfies the condition is indicated by an equals sign followed
6702: by the name of the value.</p>
1.30 cvs 6703:
1.37 cvs 6704: <p>For presentation rule whose values are names, the value which satisfies
6705: the condition is indicated by the equals sign followed by the value's name.
6706: The names of fill patterns (the <tt>FillPattern</tt> rule) and of colors (the
1.18 cvs 6707: <tt>Foreground</tt> and <tt>Background</tt> rules) known to Thot are the same
6708: as in the P language.</p>
1.30 cvs 6709:
6710: <p>The syntax of conditions based on the specific presentation is the same as
6711: the syntax used to express the <a href="#sectc5224">translation of specific
1.18 cvs 6712: presentation rules</a>.</p>
1.30 cvs 6713:
6714: <p>When a condition has only one rule, the condition is simply followed by
1.37 cvs 6715: that rule. If it has several rules, they are placed after the condition
1.30 cvs 6716: between the keywords <tt>BEGIN</tt> and <tt>END</tt>.</p>
1.18 cvs 6717: <pre> ConditionSeq = Condition [ 'AND' Condition ] .
1.1 cvs 6718: Condition = [ 'NOT' ] [ 'Target' ] Cond .
6719: Cond = CondElem / CondAscend .
6720: CondElem ='FirstRef' / 'LastRef' /
6721: 'ExternalRef' /
6722: 'Alphabet' '=' Alphabet /
6723: 'ComputedPage' / 'StartPage' /
6724: 'UserPage' / 'ReminderPage' /
6725: 'Empty' /
1.11 cvs 6726: ElemID /
1.1 cvs 6727: 'FirstAttr' / 'LastAttr' .
6728: CondAscend = [ Ascend ] CondOnAscend .
6729: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
6730: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
6731: CondRelLevel = NUMBER .
6732: CondOnAscend ='First' / 'Last' /
6733: 'Referred' /
6734: [ 'Immediately' ] 'Within' [ NumParent ]
6735: ElemID [ ExtStruct ] /
6736: 'Attributes' /
6737: AttrID [ RelatAttr ] /
6738: 'Presentation' /
1.34 cvs 6739: PresRule .
1.1 cvs 6740: NumParent = [ GreaterLess ] NParent .
1.30 cvs 6741: GreaterLess = '>' / '<' .
1.1 cvs 6742: NParent = NUMBER.
6743: ExtStruct = '(' ElemID ')' .
6744: Alphabet = NAME .
6745: RelatAttr ='=' Value /
1.30 cvs 6746: '>' [ '-' ] Minimum /
1.1 cvs 6747: '<' [ '-' ] Maximum /
6748: 'IN' '[' [ '-' ] MinInterval '..'
6749: [ '-' ] MaxInterval ']' .
6750: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
6751: Minimum = NUMBER .
6752: Maximum = NUMBER .
6753: MinInterval = NUMBER .
6754: MaxInterval = NUMBER .
6755: IntegerVal = NUMBER .
6756: TextVal = STRING .
1.18 cvs 6757: AttrValue = NAME .</pre>
1.30 cvs 6758:
1.18 cvs 6759: <blockquote class="example">
1.30 cvs 6760: <p><strong>Example:</strong></p>
6761:
6762: <p>Suppose that after each element of type Section_Title it is useful to
6763: produce the text <tt>\label{SectX}</tt> where <tt>X</tt> represents the
6764: section number, but only if the section is designated by one or more
1.37 cvs 6765: references in the document. The following conditional rule produces this
1.30 cvs 6766: effect:</p>
6767: <pre>RULES
1.1 cvs 6768: Section_Title :
6769: IF Referred
1.18 cvs 6770: Create ('\label{Sect' Value(UniqueSectNum) '}\12') After;</pre>
1.30 cvs 6771:
6772: <p>(the declaration of the <a href="#sectc5224"><tt>UniqueSectNum</tt>
1.37 cvs 6773: counter</a> is given above). The string <tt>\12</tt> represents a line
1.30 cvs 6774: break.</p>
1.18 cvs 6775: </blockquote>
1.30 cvs 6776:
1.18 cvs 6777: <blockquote class="example">
1.30 cvs 6778: <p><strong>Example:</strong></p>
6779:
1.37 cvs 6780: <p>Suppose that for elements of the Elmnt type it would be useful to
6781: produce a character indicating the value of the numeric attribute Level
6782: associated with the element: an ``A'' for all values of Level less than 3,
6783: a ``B'' for values between 3 and 10 and a ``C'' for values greater than 10.
6784: This can be achieved by writing the following rules for the Elmnt type:</p>
1.30 cvs 6785: <pre>RULES
1.1 cvs 6786: Elmnt :
6787: BEGIN
6788: IF Level < 3
6789: Create 'A';
6790: IF Level IN [3..10]
6791: Create 'B';
1.30 cvs 6792: IF Level > 10
1.1 cvs 6793: Create 'C';
1.18 cvs 6794: END;</pre>
6795: </blockquote>
6796: </div>
6797: </div>
1.1 cvs 6798:
1.18 cvs 6799: <div class="subsection">
1.37 cvs 6800: <h3><a name="sectc529" id="sectc529">Translation rules</a></h3>
1.1 cvs 6801:
1.37 cvs 6802: <p>Fifteen types of translation rules can be associated with element types
6803: and attribute values. They are the <tt>Create</tt>, <tt>Write</tt>,
1.18 cvs 6804: <tt>Read</tt>, <tt>Include</tt>, <tt>Get</tt>, <tt>Copy</tt>, <tt>Use</tt>,
1.31 cvs 6805: <tt>Remove</tt>, <tt>Ignore</tt>, <tt>NoTranslation</tt>,
6806: <tt>NoLineBreak</tt>, <tt>ChangeMainFile</tt>, <tt>RemoveFile</tt>,
1.37 cvs 6807: <tt>Set</tt>, <tt>Add</tt>, <tt>Indent</tt>, rules. Each rule has its own
1.31 cvs 6808: syntax, although they are all based on very similar models.</p>
1.18 cvs 6809: <pre> SimpleRule = 'Create' [ 'IN' VarID ] Object
1.1 cvs 6810: [ Position ] ';' /
6811: 'Write' Object [ Position ] ';' /
6812: 'Read' BufferID [ Position ] ';' /
6813: 'Include' File [ Position ] ';' /
6814: 'Get' [ RelPosition ] ElemID
6815: [ ExtStruct ]
6816: [ Position ] ';' /
6817: 'Copy' [ RelPosition ] ElemID
6818: [ ExtStruct ]
6819: [ Position ] ';' /
6820: 'Use' TrSchema [ 'For' ElemID ] ';' /
6821: 'Remove' ';' /
1.31 cvs 6822: 'Ignore' ';' /
1.1 cvs 6823: 'NoTranslation' ';' /
6824: 'NoLineBreak' ';' /
6825: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 cvs 6826: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 6827: 'Set' CounterID InitValue [ Position ] ';' /
6828: 'Add' CounterID Increment [ Position ] ';' /
1.25 cvs 6829: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .</pre>
1.18 cvs 6830: </div>
6831:
6832: <div class="subsection">
1.37 cvs 6833: <h3><a name="sectc5210" id="sectc5210">The <tt>Create</tt> rule</a></h3>
1.18 cvs 6834:
1.30 cvs 6835: <p>The most frequently used rule is undoubtedly the <tt>Create</tt> rule,
6836: which generates fixed or variable text (called an <em>object</em>) in the
1.37 cvs 6837: output file. The generated text can be made to appear either before or after
6838: the content of the element to which the rule applies. The rule begins with
6839: the <tt>Create</tt> keyword, followed by a specifier for the object and a
6840: keyword (<tt>Before</tt> or <tt>After</tt>) indicating the position of the
6841: generated text (<a href="#sectc5222">before or after</a> the element's
6842: content). If the position is not indicated, the object will be generated
6843: before the element's content. This rule, like all translation rules, is
6844: terminated by a semicolon.</p>
1.30 cvs 6845:
6846: <p>The <tt>Create</tt> keyword can be followed by the <tt>IN</tt> keyword and
1.37 cvs 6847: by the name of a variable. This means that the text generated by the rule
1.30 cvs 6848: must not be written in the main output file, but in the file whose name is
1.18 cvs 6849: specified by the variable.</p>
1.30 cvs 6850:
6851: <p>This allows the translation program to generate text in different files
6852: during the same run. These files do not need to be explicitely declared or
6853: opened. They do not need to be closed either, but if they contain temporary
6854: data, they can be removed (see the <a href="#sectc5220a"><tt>RemoveFile</tt>
6855: rule</a>). As soon as the translation program executes a <tt>Create</tt> rule
6856: for a file that is not yet open, it opens the file. These files are closed
6857: when the translation is finished.</p>
1.18 cvs 6858: <pre> 'Create' [ 'IN' VarID ] Object
1.1 cvs 6859: [ Position ] ';'
6860: Object = ConstID / CharString /
6861: BufferID /
6862: VarID /
1.30 cvs 6863: '(' Function < Function > ')' /
1.21 cvs 6864: [ 'Translated' ] AttrID /
1.1 cvs 6865: 'Value' /
6866: 'Content' /
6867: 'Attributes' /
6868: 'Presentation' /
6869: 'RefId' /
6870: 'PairId' /
6871: 'FileDir' /
6872: 'FileName' /
6873: 'Extension' /
6874: 'DocumentName' /
6875: 'DocumentDir' /
6876: [ 'Referred' ] ReferredObject .
6877: Position ='After' / 'Before' .
6878:
6879: ReferredObject = VarID /
6880: ElemID [ ExtStruct ] /
6881: 'RefId' /
6882: 'DocumentName' /
1.18 cvs 6883: 'DocumentDir' .</pre>
1.30 cvs 6884:
6885: <p>The object to be generated can be:</p>
1.18 cvs 6886: <ul>
1.30 cvs 6887: <li>a constant string, specified by its name if it is declared in the
6888: schema's <tt>CONST</tt> section, or given directly as a value between
6889: apostrophes;</li>
6890: <li>the contents of a buffer, designated by the name of the buffer;</li>
6891: <li>a variable, designated by its name if it is declared in the translation
1.37 cvs 6892: schema's <tt>VAR</tt> section, or given directly between parentheses. The
1.30 cvs 6893: text generated is the value of that variable evaluated for the element to
6894: which the rule applies.</li>
6895: <li>the value of an attribute, if the element being translated has this
6896: attribute. The attribute is specified by its name. If it's a text
6897: attribute, it can be preceded by the <code>Translated</code> keyword,
6898: which causes the attribute value to be recoded using the text translation
6899: table defined by section <code><a
6900: href="#sectc5225">TEXTTRANSLATE</a></code>;</li>
1.37 cvs 6901: <li>the value of a specific presentation rule. This object can only be
1.30 cvs 6902: generated if the translation rule is for a <a href="#prestransl">specific
1.37 cvs 6903: presentation rule</a>. It is specified by the <tt>Value</tt> keyword;</li>
6904: <li>the element's content. That is, the content of the leaves of the
6905: subtree of the translated element. This is specified by the
1.30 cvs 6906: <tt>Content</tt> keyword;</li>
6907: <li>the translation of all attributes of the element (which is primarily
6908: used to apply the attribute translation rules <a
1.37 cvs 6909: href="#sectc5222">before</a> those of the element type). This is
1.30 cvs 6910: specified by the <tt>Attributes</tt> keyword.</li>
6911: <li>the translation of all of the element's specific presentation rules
6912: (which is primarily used to apply the translation rules for the specific
1.37 cvs 6913: presentation rules <a href="#sectc5222">before</a> those of the element
6914: or its attributes). This option is specified by the <tt>Presentation</tt>
1.30 cvs 6915: keyword;</li>
1.37 cvs 6916: <li>The value of the reference's identifier.<br />
6917: Thot associates a unique identifier with each element in a document. This
6918: identifier (called <em>reference's identifier</em> or <em>label</em>) is
6919: a character string containing the letter `L' followed by digits. Thot
6920: uses it in references for identifying the referred element.<br />
1.30 cvs 6921: The <tt>RefId</tt> keyword produces the reference's identifier of the
6922: element to which the translation rule is applied, or the reference's
6923: identifier of its first ancestor that is referred by a reference or that
6924: can be referred by a reference.</li>
1.37 cvs 6925: <li>the value of a mark pair's unique identifier. This may only be used for
1.30 cvs 6926: <a href="#sectd3285">mark pairs</a> and is indicated by the
6927: <tt>PairId</tt> keyword.</li>
6928: <li>the directory containing the file being generated (this string includes
1.37 cvs 6929: an ending '/', if it is not empty). This is indicated by the
1.30 cvs 6930: <tt>FileDir</tt> keyword.</li>
6931: <li>the name of the file being generated (only the name, without the
6932: directory and without the extension). This is indicated by the
6933: <tt>FileName</tt> keyword.</li>
6934: <li>the extension of the file being generated (this string starts with a
1.37 cvs 6935: dot, if it is not empty). This is indicated by the <tt>Extension</tt>
1.30 cvs 6936: keyword.</li>
1.37 cvs 6937: <li>the name of the document being translated. This is indicated by the
1.30 cvs 6938: <tt>DocumentName</tt> keyword.</li>
1.37 cvs 6939: <li>the directory containing the document being translated. This is
1.30 cvs 6940: indicated by the <tt>DocumentDir</tt> keyword.</li>
1.18 cvs 6941: </ul>
1.30 cvs 6942:
1.37 cvs 6943: <p>When the rule applies to a reference (an element or an attribute defined
6944: as a reference in the structure schema), it can generate a text related to
6945: the element referred by that reference. The rule name is then followed by the
1.18 cvs 6946: <tt>Referred</tt> keyword and a specification of the object to be generated
1.37 cvs 6947: for the referred element. This specification can be:</p>
1.18 cvs 6948: <ul>
1.37 cvs 6949: <li>the name of a variable. The rule generates the value of that variable,
1.30 cvs 6950: computed for the referred element.</li>
1.37 cvs 6951: <li>an element type. The rule generates the translation of the element of
6952: that type, which is in the subtree of the referred element. If this
1.30 cvs 6953: element is not defined in the structure schema which corresponds to the
6954: translation schema (that is, an object defined in another schema), the
6955: element's type name must be followed by the name of its structure schema
6956: between parentheses.</li>
1.37 cvs 6957: <li>the <tt>RefId</tt> keyword. The rule generates the reference's
1.30 cvs 6958: identifier of the referred element.</li>
1.37 cvs 6959: <li>the <tt>DocumentName</tt> keyword. The rule generates the name of the
1.30 cvs 6960: document to which the referred element belongs.</li>
1.37 cvs 6961: <li>the <tt>DocumentDir</tt> keyword. The rule generates the name of the
1.30 cvs 6962: directory that contains the document of the referred element.</li>
1.18 cvs 6963: </ul>
6964: </div>
1.1 cvs 6965:
1.18 cvs 6966: <div class="subsection">
1.37 cvs 6967: <h3><a name="sectc5211" id="sectc5211">The <tt>Write</tt> rule</a></h3>
1.1 cvs 6968:
1.37 cvs 6969: <p>The <tt>Write</tt> has the same syntax as the <tt>Create</tt> rule. It
1.30 cvs 6970: also produces the same effect, but the generated text is displayed on the
6971: user's terminal during the translation of the document, instead of being
1.37 cvs 6972: produced in the translated document. This is useful for helping the user keep
1.30 cvs 6973: track of the progress of the translation and for prompting the user on the
6974: terminal for input required by the <tt>Read</tt> rule.</p>
1.18 cvs 6975: <pre> 'Write' Object [ Position ] ';'</pre>
1.30 cvs 6976:
6977: <p>Notice: if the translator is launched by the editor (by the ``Save as''
1.18 cvs 6978: command), messages produced by the <tt>Write</tt> rule are not displayed.</p>
1.30 cvs 6979:
1.18 cvs 6980: <blockquote class="example">
1.30 cvs 6981: <p><strong>Example:</strong></p>
6982:
6983: <p>To make the translator display the number of each section being
6984: translated on the user's terminal, the following rule is specified for the
6985: <tt>Section</tt> element type:</p>
6986: <pre>Section : BEGIN
1.1 cvs 6987: Write VarSection;
6988: ...
1.18 cvs 6989: END;</pre>
1.30 cvs 6990:
6991: <p>(see <a href="#varsectexample">above</a> for the definition of the
6992: <tt>VarSection</tt> variable).</p>
6993:
6994: <p>To display text on the terminal before issuing a read operation with the
6995: <tt>Read</tt> rule, the following rule is used:</p>
6996: <pre>BEGIN
1.1 cvs 6997: Write 'Enter the name of the destination: ';
6998: ...
1.18 cvs 6999: END;</pre>
7000: </blockquote>
7001: </div>
7002:
7003: <div class="subsection">
1.37 cvs 7004: <h3><a name="sectc5212" id="sectc5212">The <tt>Read</tt> rule</a></h3>
1.18 cvs 7005:
1.30 cvs 7006: <p>The <tt>Read</tt> rule reads text from the terminal during the translation
7007: of the document and saves the text read in one of the buffers declared in the
1.37 cvs 7008: <tt>BUFFERS</tt> section of the schema. The buffer to be used is indicated by
7009: its name, after the <tt>READ</tt> keyword. This name can be followed, as in
1.18 cvs 7010: the <tt>Create</tt> and <tt>Write</tt> rules, by a keyword indicating if the
7011: read operation must be performed <tt>Before</tt> or <tt>After</tt> the
1.37 cvs 7012: translation of the element's content. If this keyword is absent, the read
7013: operation is done beforehand. The text is read into the buffer and remains
1.5 cvs 7014: there until a rule using the same buffer - possibly the same rule - is
1.18 cvs 7015: applied.</p>
7016: <pre> 'Read' BufferID [ Position ] ';'</pre>
1.30 cvs 7017:
1.18 cvs 7018: <blockquote class="example">
1.30 cvs 7019: <p><strong>Example:</strong></p>
7020:
7021: <p>The following set of rules tells the user that the translator is waiting
7022: for the entry of some text, reads this text into a buffer and copies the
7023: text into the translated document.</p>
7024: <pre>BEGIN
1.1 cvs 7025: Write 'Enter the name of the destination: ';
7026: Read DestName;
7027: Create DestName;
7028: ...
1.18 cvs 7029: END;</pre>
1.30 cvs 7030:
7031: <p>(see <a href="#destname">above</a> the definition of
7032: <tt>DestName</tt>).</p>
1.18 cvs 7033: </blockquote>
7034: </div>
7035:
7036: <div class="subsection">
1.37 cvs 7037: <h3><a name="sectc5213" id="sectc5213">The <tt>Include</tt> rule</a></h3>
1.18 cvs 7038:
1.30 cvs 7039: <p>The <tt>Include</tt> rule, like the <tt>Create</tt> rule, is used to
1.37 cvs 7040: produce text in the translated document. It inserts constant text which is
7041: not defined in the translation schema, but is instead taken from a file. The
7042: file's name is specified after the <tt>Include</tt> keyword, either directly
7043: as a character string between apostrophes or as the name of one of the
7044: buffers declared in the <tt>BUFFERS</tt> section of the schema. In the latter
7045: case, the buffer is assumed to contain the file's name. This can be used when
7046: the included file's name is known only at the moment of translation. This
7047: only requires that the <tt>Include</tt> rule is preceded by a <tt>Read</tt>
7048: rule which puts the name of the file desired by the user into the buffer.</p>
1.30 cvs 7049:
7050: <p>Like the other rules, it is possible to specify whether the inclusion will
1.1 cvs 7051: occur before or after the element's content, with the default being before.
7052: The file inclusion is only done at the moment of translation, not during the
7053: compilation of the translation schema. Thus, the file to be included need not
7054: exist during the compilation, but it must be accessible at the time of
1.37 cvs 7055: translation. Its contents can also be modified between two translations, thus
1.1 cvs 7056: producing different results, even if neither the document or the translation
1.18 cvs 7057: schema are modified.</p>
1.30 cvs 7058:
7059: <p>During translation, the file to be included is searched for along the
7060: schema directory path (indicated by the environment variable
1.37 cvs 7061: <tt>THOTSCH</tt>). The file name is normally only composed of a simple name,
7062: without specification of a complete file path. However, if the filename
1.30 cvs 7063: starts with a '/', it is considered as an absolute path.</p>
1.18 cvs 7064: <pre> 'Include' File [ Position ] ';'
1.6 cvs 7065: File = FileName / BufferID .
1.18 cvs 7066: FileName = STRING .</pre>
1.30 cvs 7067:
1.18 cvs 7068: <blockquote class="example">
1.30 cvs 7069: <p><strong>Example:</strong></p>
7070:
1.37 cvs 7071: <p>Suppose that it is desirable to print documents of the Article class
7072: with a formatter which requires a number of declarations and definitions at
7073: the beginning of the file. The <tt>Include</tt>rule can be used to achieve
1.30 cvs 7074: this. All the declarations and definitions a replaced in a file called
7075: <tt>DeclarArt</tt> and then the <tt>Article</tt> element type is given the
7076: following rule:</p>
7077: <pre>Article : BEGIN
1.1 cvs 7078: Include 'DeclarArt' Before;
7079: ...
1.18 cvs 7080: END;</pre>
7081: </blockquote>
7082: </div>
7083:
7084: <div class="subsection">
1.37 cvs 7085: <h3><a name="sectc5214" id="sectc5214">The <tt>Get</tt> rule</a></h3>
1.18 cvs 7086:
1.30 cvs 7087: <p>The <tt>Get</tt> rule is used to change the order in which the elements
1.37 cvs 7088: appear in the translated document. More precisely, it produces the
1.30 cvs 7089: translation of a specified element before or after the translation of the
1.37 cvs 7090: content of the element to which the rule applies. The <tt>Before</tt> and
1.30 cvs 7091: <tt>After</tt> keywords are placed at the end of the rule to specify whether
7092: the operation should be performed before or after translation of the rule's
7093: element (the default is before). The type of the element to be moved must be
7094: specified after the <tt>Get</tt> keyword, optionally preceded by a keyword
7095: indicating where the element will be found in the logical structure of the
7096: document:</p>
1.18 cvs 7097: <dl>
1.30 cvs 7098: <dt><tt>Included</tt></dt>
7099: <dd>The element to be moved is the first element of the indicated type
7100: which is found inside the element to which the rule applies.</dd>
7101: <dt><tt>Referred</tt></dt>
7102: <dd>This keyword can only be used if the rule applies to a reference
1.37 cvs 7103: element. The element to be moved is either the element designated by
7104: the reference (if that element is of the specified type), or the first
1.30 cvs 7105: element of the desired type contained within the element designated by
7106: the reference.</dd>
7107: <dt>no keyword</dt>
1.37 cvs 7108: <dd><p>The translator takes the first element of the indicated type from
7109: among the siblings of the rule's element. This is primarily used to
7110: change the order of the components of an aggregate.</p>
1.30 cvs 7111: </dd>
1.18 cvs 7112: </dl>
1.30 cvs 7113:
7114: <p>If the element to be moved is defined in a structure schema which is not
7115: the one which corresponds to the translation schema (in the case of an
7116: included object with a different schema), the type name of this element must
7117: be followed, between parentheses, by the name of the structure schema which
1.18 cvs 7118: defines it.</p>
7119: <pre> 'Get' [ RelPosition ] ElemID
1.6 cvs 7120: [ ExtStruct ]
7121: [ Position ] ';' /
7122: RelPosition = 'Included' / 'Referred' .
1.18 cvs 7123: ExtStruct = '(' ElemID ')' .</pre>
1.30 cvs 7124:
7125: <p>The <tt>Get</tt> rule has no effect if the element which it is supposed to
1.37 cvs 7126: move has already been translated. Thus, the element will not be duplicated.
1.1 cvs 7127: It is generally best to associate the rule with the first element which will
1.37 cvs 7128: be encountered by the translator in its traversal of the document. Suppose an
1.18 cvs 7129: aggregate has two elements <tt>A</tt> and <tt>B</tt>, with <tt>A</tt>
1.37 cvs 7130: appearing first in the logical structure. To permute these two elements, a
1.18 cvs 7131: <tt>Get B before</tt> rule should be associated with the <tt>A</tt> element
1.37 cvs 7132: type, not the inverse. Similarly, a rule of the form <tt>Get Included X
1.18 cvs 7133: After</tt>, even though syntactically correct, makes no sense since, by the
1.1 cvs 7134: time it will be applied, after the translation of the contents of the element
1.18 cvs 7135: to which it is attached, the <tt>X</tt> element will already have been
7136: translated.</p>
7137: </div>
7138:
7139: <div class="subsection">
1.37 cvs 7140: <h3><a name="sectc5215" id="sectc5215">The <tt>Copy</tt> rule</a></h3>
1.18 cvs 7141:
1.30 cvs 7142: <p>Like the <tt>Get</tt> rule, the <tt>Copy</tt> rule generates the
7143: translation of a specified element, but it acts even if the element has
7144: already been translated and it allows to copy it or to translate it later.
7145: Both rules have the same syntax.</p>
1.18 cvs 7146: <pre> 'Copy' [ RelPosition ] ElemID
7147: [ ExtStruct ] [ Position ] ';'</pre>
7148: </div>
7149:
7150: <div class="subsection">
1.37 cvs 7151: <h3><a name="sectc5216" id="sectc5216">The <tt>Use</tt> rule</a></h3>
1.18 cvs 7152:
1.30 cvs 7153: <p>The <tt>Use</tt> rule specifies the translation schema to be applied to
1.37 cvs 7154: objects of a certain class that are part of the document. This rule only
1.1 cvs 7155: appears in the rules for the root element of the document (the first type
1.18 cvs 7156: defined after the <tt>STRUCT</tt> keyword in the structure schema) or the
1.1 cvs 7157: rules of an element defined by an external structure (by another structure
1.37 cvs 7158: schema). Also, the <tt>Use</tt> rule cannot be conditional.</p>
1.30 cvs 7159:
7160: <p>If the rule is applied to an element defined by an external structure, the
1.18 cvs 7161: <tt>Use</tt> keyword is simply followed by the name of the translation schema
1.37 cvs 7162: to be used for element constructed according to that external structure. If
1.1 cvs 7163: the rule is applied to the document's root element, it is formed by the
1.18 cvs 7164: <tt>Use</tt> keyword followed by the translation schema's name, the
7165: <tt>For</tt> keyword and the name of the external structure to which the
7166: indicated translation schema should be applied.</p>
7167: <pre> 'Use' TrSchema [ 'For' ElemID ] ';'
7168: TrSchema = NAME .</pre>
1.30 cvs 7169:
7170: <p>If no <tt>Use</tt> rule defines the translation schema to be used for an
1.1 cvs 7171: external structure which appears in a document, the translator asks the user,
7172: during the translation process, which schema should be used. Thus, it is not
1.18 cvs 7173: necessary to give the translation schema a <tt>Use</tt> rule for every
1.1 cvs 7174: external structure used, especially when the choice of translation schemas is
1.18 cvs 7175: to be left to the user.</p>
1.30 cvs 7176:
7177: <p>Notice: if the translator is launched by the editor (by the ``Save as''
1.18 cvs 7178: command), prompts are not displayed.</p>
1.30 cvs 7179:
1.18 cvs 7180: <blockquote class="example">
1.30 cvs 7181: <p><strong>Example:</strong></p>
7182:
7183: <p>The <tt>Article</tt> structure schema uses the <tt>Formula</tt> external
7184: structure, defined by another structure schema, for mathematical
7185: formulas:</p>
7186: <pre>STRUCTURE Article;
1.1 cvs 7187: ...
7188: STRUCT
7189: Article = ...
7190: ...
7191: Formula_in_text = Formula;
7192: Isolated_formula = Formula;
7193: ...
1.18 cvs 7194: END</pre>
1.30 cvs 7195:
7196: <p>Suppose that it would be useful to use the <tt>FormulaT</tt> translation
1.37 cvs 7197: schema for the formulas of an article. This can be expressed in two
1.30 cvs 7198: different ways in the <tt>Article</tt> class translation schema, using the
7199: rules:</p>
7200: <pre>RULES
1.1 cvs 7201: Article :
1.18 cvs 7202: Use FormulaT for Formula;</pre>
1.30 cvs 7203:
7204: <p>or:</p>
7205: <pre>RULES
1.1 cvs 7206: ...
7207: Formula :
1.18 cvs 7208: Use FormulaT;</pre>
7209: </blockquote>
7210: </div>
7211:
7212: <div class="subsection">
1.37 cvs 7213: <h3><a name="sectc5217" id="sectc5217">The <tt>Remove</tt> rule</a></h3>
1.18 cvs 7214:
1.37 cvs 7215: <p>The <tt>Remove</tt> rule indicates that nothing should be generated, in
7216: the translated document, for the content of the element to which the rule
7217: applies. The content of that element is simply ignored by the translator.
7218: This does not prevent the generation of text for the element itself, using
7219: the <tt>Create</tt> or <tt>Include</tt> rules, for example.</p>
1.30 cvs 7220:
7221: <p>The <tt>Remove</tt> rule is simply written with the <tt>Remove</tt>
7222: keyword. It is terminated, like all rules, by a semicolon.</p>
1.18 cvs 7223: <pre> 'Remove' ';'</pre>
7224: </div>
7225:
7226: <div class="subsection">
1.37 cvs 7227: <h3><a name="sectc5217a" id="sectc5217a">The <tt>Ignore</tt> rule</a></h3>
1.31 cvs 7228:
1.37 cvs 7229: <p>The <tt>Ignore</tt> rule indicates that nothing should be generated, in
7230: the translated document, for the element to which the rule applies. The whole
1.32 cvs 7231: element is simply ignored by the translator.</p>
1.31 cvs 7232:
7233: <p>The <tt>Ignore</tt> rule is simply written with the <tt>Ignore</tt>
7234: keyword. It is terminated, like all rules, by a semicolon.</p>
7235: <pre> 'Ignore' ';'</pre>
7236: </div>
7237:
7238: <div class="subsection">
1.37 cvs 7239: <h3><a name="sectc5218" id="sectc5218">The <tt>NoTranslation</tt>
7240: rule</a></h3>
1.18 cvs 7241:
1.30 cvs 7242: <p>The <tt>NoTranslation</tt> rule indicates to the translator that it must
1.37 cvs 7243: not translate the content of the leaves of the element to which it applies.
7244: In contrast to the <tt>Remove</tt> rule, it does not suppress the content of
7245: the element, but it inhibits the translation of character strings, symbols,
7246: and graphical elements contained in the element. These are retrieved so that
1.18 cvs 7247: after the translation of the document, the rules of the <a
7248: href="#sectc5225"><tt>TEXTTRANSLATE</tt>, <tt>SYMBTRANSLATE</tt> and
7249: <tt>GRAPHTRANSLATE</tt> sections</a> will not be applied to them.</p>
1.30 cvs 7250:
7251: <p>The <tt>NoTranslation</tt> rule is written with the <tt>NoTranslation</tt>
1.18 cvs 7252: keyword followed by a semicolon.</p>
7253: <pre> 'NoTranslation' ';'</pre>
7254: </div>
7255:
7256: <div class="subsection">
1.37 cvs 7257: <h3><a name="sectc5219" id="sectc5219">The <tt>NoLineBreak</tt> rule</a></h3>
1.18 cvs 7258:
1.30 cvs 7259: <p>The <tt>NoLineBreak</tt> rule indicates to the translator that it must not
1.1 cvs 7260: generate additional line breaks in the output produced for the element to
1.37 cvs 7261: which it applies. This is as if it was an <a href="#sectc522">instruction
1.18 cvs 7262: <tt>LINELENGTH 0;</tt></a> at the beginning of the translation schema, but
7263: only for the current element.</p>
1.30 cvs 7264:
7265: <p>The <tt>NoLineBreak</tt> rule is written with the <tt>NoLineBreak</tt>
7266: keyword followed by a semicolon.</p>
1.18 cvs 7267: <pre> 'NoLineBreak' ';'</pre>
7268: </div>
1.1 cvs 7269:
1.18 cvs 7270: <div class="subsection">
1.37 cvs 7271: <h3><a name="sectc5220" id="sectc5220">The <tt>ChangeMainFile</tt>
7272: rule</a></h3>
1.1 cvs 7273:
1.30 cvs 7274: <p>When the translation program starts, it opens a main output file, whose
1.37 cvs 7275: name is given as a parameter of the translator. All <a
7276: href="#sectc5210"><tt>Create</tt> rules</a> without explicit indication of
7277: the output file write sequentially in this file. When a
7278: <tt>ChangeMainFile</tt> rule is executed, the main output file is closed and
7279: it is replaced by a new one, whose name is specified in the
7280: <tt>ChangeMainFile</tt> rule. The <tt>Create</tt> rules without indication of
7281: the output file that are then executed write in this new file. Several
7282: <tt>ChangeMainFile</tt> rules can be executed during the same translation,
7283: for dividing the main output into several files.</p>
1.30 cvs 7284:
7285: <p>This rule is written with the <tt>ChangeMainFile</tt> keyword followed by
7286: the name of a variable that specifies the name of the new main file. The
1.37 cvs 7287: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the
7288: rule to specify whether the operation should be performed before or after
7289: translation of the rule's element (the default is before). This rule, like
7290: all translation rules, is terminated by a semicolon.</p>
1.18 cvs 7291: <pre> 'ChangeMainFile' VarID [ Position ] ';'</pre>
1.30 cvs 7292:
1.18 cvs 7293: <blockquote class="example">
1.30 cvs 7294: <p><strong>Example:</strong></p>
7295:
7296: <p>To generate the translation of each section in a different file, the
1.37 cvs 7297: following rule can be associated with type <tt>Section</tt>. That rule uses
1.30 cvs 7298: the <a href="#varoutputfile"><tt>VarOutpuFile</tt> variable</a> defined
7299: above.</p>
7300: <pre> Section:
1.18 cvs 7301: ChangeMainFile VarOutpuFile Before;</pre>
1.30 cvs 7302:
7303: <p>If <tt>output.txt</tt> is the name of the output file specified when
7304: starting the translation program, translated sections are written in files
7305: <tt>output1.txt</tt>, <tt>output2.txt</tt>, etc.</p>
1.18 cvs 7306: </blockquote>
7307: </div>
1.1 cvs 7308:
1.18 cvs 7309: <div class="subsection">
1.37 cvs 7310: <h3><a name="sectc5220a" id="sectc5220a">The <tt>RemoveFile</tt> rule</a></h3>
1.14 cvs 7311:
1.37 cvs 7312: <p>Files may be used for storing temporary data that are no longer needed
7313: when the translation of a document is complete. These files may be removed by
7314: the <tt>RemoveFile</tt> rule.</p>
1.30 cvs 7315:
7316: <p>This rule is written with the <tt>RemoveFile</tt> keyword followed by the
1.37 cvs 7317: name of a variable that specifies the name of the file to be removed. The
7318: keyword <tt>Before</tt> or <tt>After</tt> can be placed at the end of the
7319: rule to specify whether the operation should be performed before or after
7320: translation of the rule's element (the default is before). This rule, like
1.30 cvs 7321: all translation rules, is terminated by a semicolon.</p>
1.18 cvs 7322: <pre> 'RemoveFile' VarID [ Position ] ';'</pre>
7323: </div>
7324:
7325: <div class="subsection">
1.37 cvs 7326: <h3><a name="sectc5221" id="sectc5221">The <tt>Set</tt> and <tt>Add</tt>
7327: rules</a></h3>
1.18 cvs 7328:
1.37 cvs 7329: <p>The <tt>Set</tt> and <tt>Add</tt> rules are used for modifying the value
7330: of counters that have no <a href="#sectc524">counting function</a>. Only this
1.18 cvs 7331: type of counter can be used in the <tt>Set</tt> and <tt>Add</tt> rules.</p>
1.30 cvs 7332:
7333: <p>Both rules have the same syntax: after the keyword <tt>Set</tt> or
1.18 cvs 7334: <tt>Add</tt> appear the counter name and the value to assign to the counter
7335: (<tt>Set</tt> rule) or the value to be added to the counter (<tt>Add</tt>
1.37 cvs 7336: rule). The keyword <tt>Before</tt> or <tt>After</tt> can follow that value to
1.1 cvs 7337: indicate when the rule must be applied: before or after the element's content
1.37 cvs 7338: is translated. By default, <tt>Before</tt> is assumed. A semicolon terminates
1.18 cvs 7339: the rule.</p>
7340: <pre> 'Set' CounterID InitValue [ Position ] ';' /
7341: 'Add' CounterID Increment [ Position ] ';'</pre>
7342: </div>
7343:
7344: <div class="subsection">
1.37 cvs 7345: <h3><a name="sectc5221a" id="sectc5221a">The <tt>Indent</tt> rule</a></h3>
1.18 cvs 7346:
1.37 cvs 7347: <p>The <tt>Indent</tt> rule is used to modify the value of text indentation
7348: in the output files.</p>
1.30 cvs 7349:
1.37 cvs 7350: <p>Each time the translator creates a new line in an output file, it
7351: generates a variable number of space characters at the beginning of the new
7352: line. By default, the number of these characters (the indentation value) is
7353: 0. It can be changed with the <tt>Indent</tt> rule.</p>
1.30 cvs 7354:
7355: <p>In its simple form, the rule begins with the <tt>Indent</tt> keyword,
1.25 cvs 7356: followed by the indentation sign (optional) and value and a keyword
1.30 cvs 7357: <tt>Before</tt> or <tt>After</tt> indicating that the indentation should be
7358: changed <a href="#sectc5222">before or after</a> the element's content is
1.37 cvs 7359: generated. If the position is not indicated, the indentation is changed
7360: before the element's content is generated. This rule, like all translation
1.25 cvs 7361: rules, is terminated by a semicolon.</p>
1.30 cvs 7362:
7363: <p>The indentation value is indicated by an integer, which is the number of
7364: space characters to be generated at the beginning of each new line. A sign
1.18 cvs 7365: (<tt>+</tt> or <tt>-</tt>) can appear before the integer to indicate that the
1.37 cvs 7366: value is relative: the current value of indentation is incremented (if sign
7367: is <tt>+</tt>) or decremented (if sign is <tt>-</tt>) by the specified
7368: value.</p>
1.30 cvs 7369:
7370: <p>Keyword <tt>Suspend</tt> or <tt>Resume</tt> can appear instead of the
1.37 cvs 7371: (possibly signed) identation value. <tt>Suspend</tt> means that the new
1.30 cvs 7372: indentation value to be used is zero until another <tt>Indent</tt> rule is
7373: executed and changes the indentation value. <tt>Resume</tt> means that the
7374: indentation value that was used before the last <tt>Indent Suspend</tt> was
1.37 cvs 7375: executed becomes the new value. Only one <tt>Suspend</tt> can be used before
1.30 cvs 7376: a <tt>Resume</tt>; <tt>Supend</tt>-<tt>Resume</tt> pairs can not be
7377: nested.</p>
7378:
1.37 cvs 7379: <p>Like the <a href="#sectc5210"><tt>Create</tt> rule</a>, the
7380: <tt>Indent</tt> keyword can be followed by the <tt>IN</tt> keyword and by the
7381: name of a <a href="#sectc526">variable</a>. This means that the rule must not
7382: change indentation in the main output file, but in the file whose name is
7383: specified by the variable (by default, indentation is changed in the main
7384: output file).</p>
1.25 cvs 7385: <pre> 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .
1.10 cvs 7386:
1.25 cvs 7387: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue .
1.10 cvs 7388: IndentSign = '+' / '-' .
1.18 cvs 7389: IndentValue = NUMBER .</pre>
7390: </div>
1.10 cvs 7391:
1.18 cvs 7392: <div class="subsection">
1.37 cvs 7393: <h3><a name="sectc5222" id="sectc5222">Rule application order</a></h3>
1.1 cvs 7394:
1.30 cvs 7395: <p>The translator translates the elements which comprise the document in the
1.37 cvs 7396: order induced by the tree structure, except when the <tt>Get</tt> rule is
7397: used to change the order of translation. For each element, the translator
7398: first applies the rules specified for the element's type that must be applied
7399: before translation of the element's content (rules ending with the
7400: <tt>Before</tt> keyword or which have no position keyword). If several rules
7401: meet these criteria, the translator applies them in the order in where they
7402: appear in the translation schema.</p>
7403:
7404: <p>It then applies all <a href="#sectc5223">rules for the attributes</a>
7405: which the element has and which must be applied before the translation of the
7406: element's content (rules ending with the <tt>Before</tt> keyword or which
7407: have no position keyword). For one attribute value, the translator applies
7408: the rules in the order in which they are defined in the translation
7409: schema.</p>
1.30 cvs 7410:
7411: <p>The same procedure is followed with translation rules for specific
1.18 cvs 7412: presentations.</p>
1.30 cvs 7413:
1.31 cvs 7414: <p>Next, the element's content is translated, as long as a <tt>Remove</tt> or
7415: <code>Ignore</code> rule does not apply.</p>
1.30 cvs 7416:
7417: <p>In the next step, the translator applies rules for the specific
7418: presentation of the element that are to be applied after translation of the
1.37 cvs 7419: content (rules which end with the <tt>After</tt> keyword). The rules for each
1.30 cvs 7420: type of presentation rule or each value are applied in the order in which the
1.18 cvs 7421: translation appear in the schema.</p>
1.30 cvs 7422:
7423: <p>Then, the same procedure is followed for translation rules for attributes
7424: of the element.</p>
7425:
1.37 cvs 7426: <p>Finally, the translator applies rules for the element which must be
7427: applied after translation of the element's content. These rules are applied
7428: in the order that they appear in the translation schema. When the translation
7429: of an element is done, the translator procedes to translate the following
1.18 cvs 7430: element.</p>
1.30 cvs 7431:
7432: <p>This order can be changed with the <tt>Attributes</tt> and
1.18 cvs 7433: <tt>Presentation</tt> options of the <a href="#sectc5210"><tt>Create</tt>
7434: rule</a>.</p>
7435: </div>
1.1 cvs 7436:
1.18 cvs 7437: <div class="subsection">
1.37 cvs 7438: <h3><a name="sectc5223" id="sectc5223">Translation of logical
7439: attributes</a></h3>
1.1 cvs 7440:
1.37 cvs 7441: <p>After the rules for the element types, the translation schema defines
7442: rules for attribute values. This section begins with the <tt>ATTRIBUTES</tt>
1.1 cvs 7443: keyword and is composed of a sequence of rule blocks each preceded by an
1.18 cvs 7444: attribute name and an optional value or value range.</p>
1.30 cvs 7445:
7446: <p>If the attribute's name appears alone before the rule block, the rule are
1.1 cvs 7447: applied to all element which have the attribute, no matter what value the
1.37 cvs 7448: attribute has. In this case, the attribute name is followed by a colon before
1.18 cvs 7449: the beginning of the rule block.</p>
1.30 cvs 7450:
1.37 cvs 7451: <p>The attribute's name can be followed by the name of an element type
7452: between parentheses. This says, as in presentation schemas, that the rule
7453: block which follows applies not to the element which has the attribute, but
7454: to its descendants of the type indicated between the parentheses.</p>
1.30 cvs 7455:
7456: <p>If values are given after the attribute name (or after the name of the
1.37 cvs 7457: element type), the rules are applied only when the attribute has the
7458: indicated values. The same attribute can appear several times, with different
7459: values and different translation rules. Attribute values are indicated in the
7460: same way as in <a href="#sectc528">conditions</a> and are followed by a colon
7461: before the block of rules.</p>
1.30 cvs 7462:
7463: <p>The rule block associated with an attribute is either a simple rule or a
1.18 cvs 7464: sequence of rules delimited by the <tt>BEGIN</tt> and <tt>END</tt> keywords.
7465: Note that rules associated with attribute values cannot be conditional.</p>
1.30 cvs 7466:
7467: <p>Translation rules are not required for all attributes (or their values)
1.37 cvs 7468: defined in a structure schema. Only those attributes for which a particular
7469: action must be performed by the translator must have such rules. The rules
1.18 cvs 7470: that can be used are those described above, from <a
7471: href="#sectc5210"><tt>Create</tt></a> to <a
7472: href="#sectc5218"><tt>NoTranslation</tt></a>.</p>
1.30 cvs 7473: <pre> AttrSeq = TransAttr < TransAttr > .
1.1 cvs 7474: TransAttr = AttrID [ '(' ElemID ')' ]
7475: [ RelatAttr ] ':' RuleSeq .
7476: AttrID = NAME .
1.18 cvs 7477: ElemID = NAME .</pre>
1.30 cvs 7478:
1.18 cvs 7479: <blockquote class="example">
1.30 cvs 7480: <p><strong>Example:</strong></p>
7481:
7482: <p>The structure defined the ``Language'' attribute which can take the
1.37 cvs 7483: values ``French'' and ``English''. To have the French parts of the original
1.30 cvs 7484: document removed and prevent the translation of the leaves of the English
7485: parts, the following rules would be used:</p>
7486: <pre>ATTRIBUTES
1.1 cvs 7487: Language=French :
7488: Remove;
7489: Language=English :
1.18 cvs 7490: NoTranslation;</pre>
7491: </blockquote>
7492: </div>
1.1 cvs 7493:
1.18 cvs 7494: <div class="subsection">
1.37 cvs 7495: <h3><a name="sectc5224" id="sectc5224">Translation of specific
7496: presentations</a></h3>
1.1 cvs 7497:
1.30 cvs 7498: <p>After the rules for attributes, the translation schema defines rules for
1.37 cvs 7499: the specific presentation. This section begins with the <tt>PRESENTATION</tt>
7500: keyword and is composed of a sequence of translation rule blocks each
7501: preceded by a presentation rule name, optionally accompanied by a part which
7502: depends on the particular presentation rule.</p>
1.30 cvs 7503:
7504: <p>Each of these translation rule blocks is applied when the translator
7505: operates on an element which has a specific presentation rule of the type
1.37 cvs 7506: indicated at the head of the block. Depending on the type of the specific
1.30 cvs 7507: presentation rule, it is possible to specify values of the presentation rule
7508: for which the translation rule block should be applied.</p>
7509:
7510: <p>There are three categories of the presentation rules:</p>
7511: <ul>
7512: <li>rules taking numeric values: <tt>Size</tt>, <tt>Indent</tt>,
7513: <tt>LineSpacing</tt>, <tt>LineWeight</tt>,</li>
7514: <li>rules whose values are taken from a predefined list (i.e. whose type is
1.36 cvs 7515: an enumeration): <tt>Adjust</tt>, <tt>Hyphenate,/TT>, <tt>Style</tt>,
7516: <tt>Weight</tt>, <tt>Font</tt>, <tt>UnderLine</tt>, <tt>Thickness</tt>,
7517: <tt>LineStyle</tt>,</tt></li>
1.30 cvs 7518: <li>rules whose value is a name: <tt>FillPattern</tt>, <tt>Background</tt>,
7519: <tt>Foreground</tt>.</li>
1.18 cvs 7520: </ul>
1.30 cvs 7521:
7522: <p>For presentation rules of the first category, the values which provoke
1.1 cvs 7523: application of the translation rules are indicated in the same manner as for
1.37 cvs 7524: <a href="#relattr">numeric attributes</a>. This can be either a unique value
7525: or range of values. For a unique value, the value (an integer) is simply
7526: preceded by an equals sign. Value ranges can be specified in one of three
1.18 cvs 7527: ways:</p>
7528: <ul>
1.30 cvs 7529: <li>all values less than a given value (this value is preceded by a ``less
7530: than'' sign '<tt><</tt>'),</li>
7531: <li>all values greater than a given value (this value is preceded by a`
7532: `greater than'' sign '<tt>></tt>'),</li>
1.37 cvs 7533: <li>all values falling in an interval, bounds included. The range of values
1.30 cvs 7534: is then specified <tt>IN [</tt>Minimum<tt>..</tt>Maximum<tt>]</tt>, where
7535: Minimum and Maximum are integers.</li>
1.18 cvs 7536: </ul>
1.30 cvs 7537:
7538: <p>All numeric values can be negative, in which case the integer is preceded
1.37 cvs 7539: by a minus sign. All values must be given in typographers points.</p>
1.30 cvs 7540:
7541: <p>For presentation rules whose values are taken from a predefined list, the
1.1 cvs 7542: value which provokes application of the translation rules is simply indicated
1.18 cvs 7543: by the equals sign followed by the name of the value.</p>
1.30 cvs 7544:
1.37 cvs 7545: <p>For presentation rules whose values are names, the value which provokes
7546: the application of translation rules is simply indicated by the equals sign
7547: followed by the name of the value. The names of the fill patterns (the
1.18 cvs 7548: <tt>FillPattern</tt> rule) and of the colors (the <tt>Foreground</tt> and
7549: <tt>Background</tt> rules) used in Thot are the same as in the P language.</p>
1.30 cvs 7550: <pre> PresSeq = PresTrans < PresTrans > .
1.1 cvs 7551: PresTrans = PresRule ':' RuleSeq .
7552: PresRule = 'Size' [ PresRelation ] /
7553: 'Indent' [ PresRelation ] /
7554: 'LineSpacing' [ PresRelation ] /
7555: 'Adjust' [ '=' AdjustVal ] /
7556: 'Hyphenate' [ '=' BoolVal ] /
7557: 'Style' [ '=' StyleVal ] /
1.24 cvs 7558: 'Weight' [ '=' WeightVal ] /
1.1 cvs 7559: 'Font' [ '=' FontVal ] /
7560: 'UnderLine' [ '=' UnderLineVal ] /
7561: 'Thickness' [ '=' ThicknessVal ] /
7562: 'LineStyle' [ '=' LineStyleVal ] /
7563: 'LineWeight' [ PresRelation ] /
7564: 'FillPattern' [ '=' Pattern ] /
7565: 'Background' [ '=' Color ] /
7566: 'Foreground' [ '=' Color ] .
7567:
7568: PresRelation = '=' PresValue /
1.30 cvs 7569: '>' [ '-' ] PresMinimum /
1.1 cvs 7570: '<' [ '-' ] PresMaximum /
7571: 'IN' '[' [ '-' ] PresIntervalMin '..'
7572: [ '-' ] PresIntervalMax ']' .
1.35 cvs 7573: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.1 cvs 7574: 'LeftWithDots' .
7575: BoolVal = 'Yes' / 'No' .
1.24 cvs 7576: StyleVal = 'Roman' / 'Italics' / 'Oblique' .
7577: WeightVal = 'Normal' / 'Bold' .
1.1 cvs 7578: FontVal = 'Times' / 'Helvetica' / 'Courier' .
7579: UnderLineVal = 'NoUnderline' / 'UnderLined' /
7580: 'OverLined' / 'CrossedOut' .
7581: ThicknessVal = 'Thick' / 'Thin' .
1.6 cvs 7582: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
1.1 cvs 7583: Pattern = NAME .
7584: Color = NAME .
7585: PresMinimum = NUMBER .
7586: PresMaximum = NUMBER .
7587: PresIntervalMin= NUMBER .
7588: PresIntervalMax= NUMBER .
7589: PresValue = [ '-' ] PresVal .
1.18 cvs 7590: PresVal = NUMBER .</pre>
1.30 cvs 7591:
1.37 cvs 7592: <p>The <a name="prestransl" id="prestransl">translation rules associated with
7593: specific presentation rules</a> can use the value of the specific
7594: presentation rule that causes them to be applied. This behavior is designated
7595: by the keyword <tt>Value</tt>. For numerically-valued presentation rules, the
7596: numeric value is produced. For other presentation rules, the name of the
7597: value is produced.</p>
1.30 cvs 7598:
7599: <p>It should be noted that modifications to the layout of the document's
7600: elements that are made using the combination of the control key and a mouse
7601: button will have no effect on the translation of the document.</p>
7602:
7603: <blockquote class="example">
7604: <p><strong>Example:</strong></p>
7605:
7606: <p>Suppose that it is desirable to use the same font sizes as in the
7607: specific presentation, but the font size must be between 10 and 18
7608: typographer's points. If font size is set in the translated document by the
7609: string <tt>pointsize=n</tt> where <tt>n</tt> is the font size in
7610: typographer's points then the following rules will suffice:</p>
7611: <pre>PRESENTATION
1.1 cvs 7612: Size < 10 :
7613: Create 'pointsize=10';
7614: Size in [10..18] :
7615: BEGIN
7616: Create 'pointsize=';
7617: Create Value;
7618: END;
1.30 cvs 7619: Size > 18 :
1.18 cvs 7620: Create 'pointsize=18';</pre>
7621: </blockquote>
7622: </div>
1.1 cvs 7623:
1.18 cvs 7624: <div class="subsection">
1.37 cvs 7625: <h3><a name="sectc5225" id="sectc5225">Recoding of characters, symbols and
7626: graphics</a></h3>
1.1 cvs 7627:
1.37 cvs 7628: <p>The coding of characters, graphical elements and symbols as defined in
7629: Thot does not necessarily correspond to what is required by an application to
7630: which a Thot document must be exported. Because of this the translator can
7631: recode these terminal elements of the documents structure. The last sections
7632: of a translation schema are intended for this purpose, each specifying the
7633: recoding rules for one type of terminal element.</p>
1.30 cvs 7634:
1.37 cvs 7635: <p>The recoding rules for character strings are grouped by alphabets. There
7636: is a group of rules for each alphabet of the Thot document that must be
1.30 cvs 7637: translated. Each such group of rules begins with the <tt>TEXTTRANSLATE</tt>
7638: keyword, followed by the specification of the alphabet to translate and the
7639: recoding rules, between the <tt>BEGIN</tt> and <tt>END</tt> keywords unless
7640: there is only one recoding rule for the alphabet. The specification of the
7641: alphabet is not required: by default it is assumed to the Latin alphabet (the
7642: ISO Latin-1 character set).</p>
7643:
7644: <p>Each recoding rule is formed by a source string between apostrophes and a
1.1 cvs 7645: target string, also between apostrophes, the two strings being separated by
1.30 cvs 7646: the arrow symbol (<tt>-></tt>), formed by the ``minus'' and ``greater
1.37 cvs 7647: than'' characters. The rule is terminated by a semi-colon.</p>
1.18 cvs 7648: <pre> TextTransSeq = [ Alphabet ] TransSeq .
1.1 cvs 7649: Alphabet = NAME .
1.30 cvs 7650: TransSeq ='BEGIN' < Translation > 'END' ';' /
1.1 cvs 7651: Translation .
1.30 cvs 7652: Translation = Source [ '->' Target ] ';' .
1.1 cvs 7653: Source = STRING .
1.18 cvs 7654: Target = STRING .</pre>
1.30 cvs 7655:
7656: <p>One such rule signifies that when the source string appears in a text leaf
7657: of the document being translated, the translator must replace it, in the
1.37 cvs 7658: translated document, with the target string. The source string and the target
7659: string can have different lengths and the target string can be empty. In this
1.1 cvs 7660: last case, the translator simply suppresses every occurrence of the source
1.18 cvs 7661: string in the translated document.</p>
1.30 cvs 7662:
7663: <p>For a given alphabet, the order of the rules is not important and has no
1.1 cvs 7664: significance because the T language compiler reorders the rules in ways that
1.37 cvs 7665: speed up the translator's work. The total number of recoding rules is limited
1.18 cvs 7666: by the compiler as is the maximum length of the source and target strings.</p>
1.30 cvs 7667:
7668: <p>The recoding rules for symbols and graphical elements are written in the
1.37 cvs 7669: same manner as the recoding rules for character strings. They are preceded,
7670: respectively, by the <tt>SYMBTRANSLATE</tt> and <tt>GRAPHTRANSLATE</tt> and
7671: so not require a specification of the alphabet. Their source string is
7672: limited to one character, since, in Thot, each symbol and each graphical
7673: element is represented by a single character. The symbol and graphical
7674: element codes are defined along with the <a href="#sect7">non-standard
7675: character codes</a>.</p>
1.30 cvs 7676:
1.18 cvs 7677: <blockquote class="example">
1.30 cvs 7678: <p><strong>Example:</strong></p>
7679:
7680: <p>In a translation schema producing documents destined for use with the
7681: L<sup>A</sup>T<sub><big>E</big></sub>X formatter, the Latin characters``é''
1.37 cvs 7682: (octal code 351 in Thot) and ``č'' (octal code 350 in Thot) must be
1.30 cvs 7683: converted to their representation in
7684: L<sup>A</sup>T<sub><big>E</big></sub>X:</p>
7685: <pre>TEXTTRANSLATE Latin
1.1 cvs 7686: BEGIN
1.30 cvs 7687: '\350' -> '\`{e}'; { e grave }
7688: '\351' -> '\''{e}'; { e acute }
1.18 cvs 7689: END;</pre>
7690: </blockquote>
7691: </div>
7692: </div>
1.37 cvs 7693: <hr />
1.18 cvs 7694: </div>
1.1 cvs 7695:
1.18 cvs 7696: <div class="chapter">
1.37 cvs 7697: <h1><a name="sect6" id="sect6">Language grammars</a></h1>
1.1 cvs 7698:
1.30 cvs 7699: <p>This chapter gives the complete grammars of the languages of Thot. The
1.1 cvs 7700: grammars were presented and described in the preceding chapters, which also
1.37 cvs 7701: specify the semantics of the languages. This section gives only the
1.18 cvs 7702: syntax.</p>
1.1 cvs 7703:
1.18 cvs 7704: <div class="section">
1.37 cvs 7705: <h2><a name="sectb61" id="sectb61">The M meta-language</a></h2>
1.1 cvs 7706:
1.30 cvs 7707: <p>The language grammars are all expressed in the same formalism, the M
1.18 cvs 7708: meta-language, which is defined in this section.</p>
7709: <pre>{ Any text between braces is a comment. }
1.30 cvs 7710: Grammar = Rule < Rule > 'END' .
7711: { The < and > signs indicate zero }
1.1 cvs 7712: { or more repetitions. }
7713: { END marks the end of the grammar. }
7714: Rule = Ident '=' RightPart '.' .
7715: { The period indicates the end of a rule }
7716: RightPart = RtTerminal / RtIntermed .
7717: { The slash indicates a choice }
7718: RtTerminal ='NAME' / 'STRING' / 'NUMBER' .
7719: { Right part of a terminal rule }
1.30 cvs 7720: RtIntermed = Possibility < '/' Possibility > .
1.1 cvs 7721: { Right part of an intermediate rule }
1.30 cvs 7722: Possibility = ElemOpt < ElemOpt > .
7723: ElemOpt = Element / '[' Element < Element > ']' /
7724: '<' Element < Element > '>' .
1.1 cvs 7725: { Brackets delimit optional parts }
7726: Element = Ident / KeyWord .
7727: Ident = NAME .
7728: { Identifier, sequence of characters
7729: KeyWord = STRING .
7730: { Character string delimited by apostrophes }
1.18 cvs 7731: END</pre>
7732: </div>
1.1 cvs 7733:
1.18 cvs 7734: <div class="section">
1.37 cvs 7735: <h2><a name="sectb62" id="sectb62">The S language</a></h2>
1.1 cvs 7736:
1.30 cvs 7737: <p>The S language is used to write structure schemas, which contain the
1.37 cvs 7738: generic logical structures of document and object classes. It is described
1.30 cvs 7739: here in the M meta-language.</p>
1.18 cvs 7740: <pre>StructSchema = 'STRUCTURE' [ 'EXTENSION' ] ElemID ';'
1.1 cvs 7741: 'DEFPRES' PresID ';'
7742: [ 'ATTR' AttrSeq ]
7743: [ 'STRUCT' RulesSeq ]
7744: [ 'EXTENS' ExtensRuleSeq ]
7745: [ 'UNITS' RulesSeq ]
7746: [ 'EXPORT' SkeletonSeq ]
7747: [ 'EXCEPT' ExceptSeq ]
7748: 'END' .
7749:
7750: ElemID = NAME .
7751: PresID = NAME .
7752:
1.30 cvs 7753: AttrSeq = Attribute < Attribute > .
1.1 cvs 7754: Attribute = AttrID '=' AttrType ';' .
7755: AttrType = 'INTEGER' / 'TEXT' /
7756: 'REFERENCE' '(' RefType ')' /
7757: ValueSeq .
7758: RefType = 'ANY' /
7759: [ FirstSec ] ElemID [ ExtStruct ] .
1.30 cvs 7760: ValueSeq = AttrVal < ',' AttrVal > .
1.1 cvs 7761: AttrID = NAME .
7762: FirstSec = 'First' / 'Second' .
7763: ExtStruct = '(' ElemID ')' .
7764: AttrVal = NAME .
7765:
1.30 cvs 7766: RulesSeq = Rule < Rule > .
1.1 cvs 7767: Rule = ElemID [ LocAttrSeq ] '='
7768: DefWithAttr ';' .
7769: LocAttrSeq = '(' 'ATTR' LocalAttr
1.30 cvs 7770: < ';' LocalAttr > ')' .
1.1 cvs 7771: LocalAttr = [ '!' ] AttrID [ '=' AttrType ] .
7772: DefWithAttr = Definition
7773: [ '+' '(' ExtensionSeq ')' ]
7774: [ '-' '(' RestrictSeq ')' ]
7775: [ 'WITH' FixedAttrSeq ] .
1.30 cvs 7776: ExtensionSeq = ExtensionElem < ',' ExtensionElem > .
1.1 cvs 7777: ExtensionElem = ElemID / 'TEXT' / 'GRAPHICS' /
7778: 'SYMBOL' / 'PICTURE' .
1.30 cvs 7779: RestrictSeq = RestrictElem < ',' RestrictElem > .
1.1 cvs 7780: RestrictElem = ElemID / 'TEXT' / 'GRAPHICS' /
7781: 'SYMBOL' / 'PICTURE' .
1.30 cvs 7782: FixedAttrSeq = FixedAttr < ',' FixedAttr > .
1.1 cvs 7783: FixedAttr = AttrID [ FixedOrModifVal ] .
7784: FixedOrModifVal= [ '?' ] '=' FixedValue .
7785: FixedValue = [ '-' ] NumValue / TextValue / AttrVal .
7786: NumValue = NUMBER .
7787: TextValue = STRING .
7788:
7789: Definition = BaseType [ LocAttrSeq ] / Constr /
7790: Element .
7791: BaseType = 'TEXT' / 'GRAPHICS' / 'SYMBOL' /
7792: 'PICTURE' / 'UNIT' / 'NATURE' .
7793: Element = ElemID [ ExtOrDef ] .
7794: ExtOrDef = 'EXTERN' / 'INCLUDED' /
7795: [ LocAttrSeq ] '=' Definition .
7796:
7797: Constr = 'LIST' [ '[' min '..' max ']' ] 'OF'
7798: '(' DefWithAttr ')' /
7799: 'BEGIN' DefOptSeq 'END' /
7800: 'AGGREGATE' DefOptSeq 'END' /
7801: 'CASE' 'OF' DefSeq 'END' /
7802: 'REFERENCE' '(' RefType ')' /
7803: 'PAIR' .
7804:
7805: min = Integer / '*' .
7806: max = Integer / '*' .
7807: Integer = NUMBER .
7808:
1.30 cvs 7809: DefOptSeq = DefOpt ';' < DefOpt ';' > .
1.1 cvs 7810: DefOpt = [ '?' ] DefWithAttr .
7811:
1.30 cvs 7812: DefSeq = DefWithAttr ';' < DefWithAttr ';' > .
1.1 cvs 7813:
1.30 cvs 7814: SkeletonSeq = SkeletonElem < ',' SkeletonElem > ';' .
1.1 cvs 7815: SkeletonElem = ElemID [ 'WITH' Contents ] .
7816: Contents = 'Nothing' / ElemID [ ExtStruct ] .
7817:
1.30 cvs 7818: ExceptSeq = Except ';' < Except ';' > .
1.1 cvs 7819: Except = [ 'EXTERN' ] [ FirstSec ] ExcTypeOrAttr ':'
7820: ExcValSeq .
7821: ExcTypeOrAttr = ElemID / AttrID .
1.30 cvs 7822: ExcValSeq = ExcValue < ',' ExcValue > .
1.1 cvs 7823: ExcValue = 'NoCut' / 'NoCreate' /
7824: 'NoHMove' / 'NoVMove' / 'NoMove' /
7825: 'NoHResize' / 'NoVResize' / 'NoResize' /
1.18 cvs 7826: 'MoveResize' /
1.1 cvs 7827: 'NewWidth' / 'NewHeight' /
7828: 'NewHPos' / 'NewVPos' /
7829: 'Invisible' / 'NoSelect' /
7830: 'Hidden' / 'ActiveRef' /
7831: 'ImportLine' / 'ImportParagraph' /
1.9 cvs 7832: 'NoPaginate' / 'ParagraphBreak' /
7833: 'HighlightChildren' / 'ExtendedSelection' /
1.36 cvs 7834: 'SelectParent' / 'ClickableSurface' /
1.29 cvs 7835: 'ReturnCreateNL' / 'ReturnCreateWithin' .
1.1 cvs 7836:
1.30 cvs 7837: ExtensRuleSeq = ExtensRule ';' < ExtensRule ';' > .
1.1 cvs 7838: ExtensRule = RootOrElem [ LocAttrSeq ]
7839: [ '+' '(' ExtensionSeq ')' ]
7840: [ '-' '(' RestrictSeq ')' ]
7841: [ 'WITH' FixedAttrSeq ] .
7842: RootOrElem = 'Root' / ElemID .
7843:
1.18 cvs 7844: END</pre>
7845: </div>
1.1 cvs 7846:
1.18 cvs 7847: <div class="section">
1.37 cvs 7848: <h2><a name="sectb63" id="sectb63">The P language</a></h2>
1.1 cvs 7849:
1.30 cvs 7850: <p>The P language is used to write presentation schemas, which define the
1.1 cvs 7851: graphical presentation rules to be applied to different classes of documents
1.37 cvs 7852: and objects. It is described here in the M meta-language.</p>
1.18 cvs 7853: <pre>PresSchema = 'PRESENTATION' ElemID ';'
1.1 cvs 7854: [ 'VIEWS' ViewSeq ]
7855: [ 'PRINT' PrintViewSeq ]
7856: [ 'COUNTERS' CounterSeq ]
7857: [ 'CONST' ConstSeq ]
7858: [ 'VAR' VarSeq ]
7859: [ 'DEFAULT' ViewRuleSeq ]
7860: [ 'BOXES' BoxSeq ]
7861: [ 'RULES' PresentSeq ]
7862: [ 'ATTRIBUTES' PresAttrSeq ]
7863: [ 'TRANSMIT' TransmitSeq ]
7864: 'END' .
7865:
7866: ElemID = NAME .
7867:
7868: ViewSeq = ViewDeclaration
1.30 cvs 7869: < ',' ViewDeclaration > ';' .
1.1 cvs 7870: ViewDeclaration = ViewID [ 'EXPORT' ] .
7871: ViewID = NAME .
7872:
1.30 cvs 7873: PrintViewSeq = PrintView < ',' PrintView > ';' .
1.37 cvs 7874: PrintView = ViewID .
1.1 cvs 7875:
1.30 cvs 7876: CounterSeq = Counter < Counter > .
1.1 cvs 7877: Counter = CounterID ':' CounterFunc ';' .
7878: CounterID = NAME .
7879: CounterFunc = 'RANK' 'OF' TypeOrPage [ SLevelAsc ]
7880: [ 'INIT' AttrID ] [ 'REINIT' AttrID ] /
1.30 cvs 7881: SetFunction < SetFunction >
7882: AddFunction < AddFunction >
1.1 cvs 7883: [ 'INIT' AttrID ] /
1.16 cvs 7884: 'RLEVEL' 'OF' ElemID .
1.1 cvs 7885: SLevelAsc = [ '-' ] LevelAsc .
7886: LevelAsc = NUMBER .
7887: SetFunction = 'SET' CounterValue 'ON' TypeOrPage .
7888: AddFunction = 'ADD' CounterValue 'ON' TypeOrPage .
7889: TypeOrPage = 'Page' [ '(' ViewID ')' ] /
1.16 cvs 7890: [ '*' ] ElemID .
1.1 cvs 7891: CounterValue = NUMBER .
7892:
1.30 cvs 7893: ConstSeq = Const < Const > .
1.1 cvs 7894: Const = ConstID '=' ConstType ConstValue ';' .
7895: ConstID = NAME .
7896: ConstType = 'Text' [ Alphabet ] / 'Symbol' /
7897: 'Graphics' / 'Picture' .
7898: ConstValue = STRING .
7899: Alphabet = NAME .
7900:
1.30 cvs 7901: VarSeq = Variable < Variable > .
1.1 cvs 7902: Variable = VarID ':' FunctionSeq ';' .
7903: VarID = NAME .
1.30 cvs 7904: FunctionSeq = Function < Function > .
1.1 cvs 7905: Function = 'DATE' / 'FDATE' /
7906: 'DocName' / 'DirName' /
1.38 cvs 7907: 'ElemName' / 'AttributeName' / 'AttributeValue' /
1.1 cvs 7908: ConstID / ConstType ConstValue /
7909: AttrID /
7910: 'VALUE' '(' PageAttrCtr ','
7911: CounterStyle ')' .
7912: PageAttrCtr = 'PageNumber' [ '(' ViewID ')' ] /
7913: [ MinMax ] CounterID / AttrID .
7914: CounterStyle = 'Arabic' / 'LRoman' / 'URoman' /
7915: 'Uppercase' / 'Lowercase' .
7916: MinMax = 'MaxRangeVal' / 'MinRangeVal' .
7917:
1.30 cvs 7918: BoxSeq = Box < Box > .
1.1 cvs 7919: Box = 'FORWARD' BoxID ';' /
7920: BoxID ':' ViewRuleSeq .
7921: BoxID = NAME .
7922:
1.30 cvs 7923: PresentSeq = Present < Present > .
1.1 cvs 7924: Present = [ '*' ] [ FirstSec ] ElemID ':'
7925: ViewRuleSeq .
7926: FirstSec = 'First' / 'Second' .
7927:
1.30 cvs 7928: PresAttrSeq = PresAttr < PresAttr > .
1.1 cvs 7929: PresAttr = AttrID [ '(' [ FirstSec ] ElemID ')' ]
7930: [ AttrRelation ] ':' ViewRuleSeq .
7931: AttrID = NAME .
7932: AttrRelation = '=' AttrVal /
1.30 cvs 7933: '>' [ '-' ] MinValue /
1.1 cvs 7934: '<' [ '-' ] MaxValue /
7935: 'IN' '[' [ '-' ] LowerBound '..'
7936: [ '-' ] UpperBound ']' /
7937: 'GREATER' AttrID /
7938: 'EQUAL' AttrID /
7939: 'LESS' AttrID .
7940: AttrVal = [ '-' ] EqualNum / EqualText / AttrValue .
7941: MinValue = NUMBER .
7942: MaxValue = NUMBER .
7943: LowerBound = NUMBER .
7944: UpperBound = NUMBER.
7945: EqualNum = NUMBER .
7946: EqualText = STRING .
7947: AttrValue = NAME .
7948:
1.30 cvs 7949: ViewRuleSeq = 'BEGIN' < RulesAndCond > < ViewRules >
1.1 cvs 7950: 'END' ';' /
7951: ViewRules / CondRules / Rule .
7952: RulesAndCond = CondRules / Rule .
7953: ViewRules = 'IN' ViewID CondRuleSeq .
1.30 cvs 7954: CondRuleSeq = 'BEGIN' < RulesAndCond > 'END' ';' /
1.1 cvs 7955: CondRules / Rule .
1.30 cvs 7956: CondRules = CondRule < CondRule >
1.1 cvs 7957: [ 'Otherwise' RuleSeq ] .
7958: CondRule = 'IF' ConditionSeq RuleSeq .
1.30 cvs 7959: RulesSeq = 'BEGIN' Rule < Rule > 'END' ';' / Rule .
1.1 cvs 7960:
1.30 cvs 7961: ConditionSeq = Condition < 'AND' Condition > .
1.6 cvs 7962: Condition = [ 'NOT' ] [ 'Target' ] ConditionElem .
7963: ConditionElem = 'First' / 'Last' /
7964: [ 'Immediately' ] 'Within' [ NumParent ]
7965: ElemID [ ExtStruct ] /
7966: ElemID /
7967: 'Referred' / 'FirstRef' / 'LastRef' /
7968: 'ExternalRef' / 'InternalRef' / 'CopyRef' /
7969: 'AnyAttributes' / 'FirstAttr' / 'LastAttr' /
7970: 'UserPage' / 'StartPage' / 'ComputedPage' /
1.33 cvs 7971: 'Empty' / 'Root' /
1.6 cvs 7972: '(' [ MinMax ] CounterName CounterCond ')' /
7973: CondPage '(' CounterID ')' .
7974: NumParent = [ GreaterLess ] NParent .
1.30 cvs 7975: GreaterLess = '>' / '<' .
1.6 cvs 7976: NParent = NUMBER.
1.30 cvs 7977: CounterCond = '<' MaxCtrVal / '>' MinCtrVal /
1.6 cvs 7978: '=' EqCtrVal /
7979: 'IN' '[' ['-'] MinCtrBound '..'
7980: ['-'] MaxCtrBound ']' .
7981: PageCond = 'Even' / 'Odd' / 'One' .
7982: MaxCtrVal = NUMBER .
7983: MinCtrVal = NUMBER .
7984: EqCtrVal = NUMBER .
7985: MaxCtrBound = NUMBER .
7986: MinCtrBound = NUMBER .
1.1 cvs 7987:
1.34 cvs 7988: Rule = Property ';' / PresFunc ';' .
7989: Property = 'VertRef' ':' HorizPosition /
1.1 cvs 7990: 'HorizRef' ':' VertPosition /
7991: 'VertPos' ':' VPos /
7992: 'HorizPos' ':' HPos /
7993: 'Height' ':' Extent /
7994: 'Width' ':' Extent /
7995: 'VertOverflow' ':' Boolean /
7996: 'HorizOverflow' ':' Boolean /
1.26 cvs 7997: 'MarginTop' ':' MarginWidth /
7998: 'MarginRight' ':' MarginWidth /
7999: 'MarginBottom' ':' MarginWidth /
8000: 'MarginLeft' ':' MarginWidth /
8001: 'PaddingTop' ':' PaddingWidth /
8002: 'PaddingRight' ':' PaddingWidth /
8003: 'PaddingBottom' ':' PaddingWidth /
8004: 'PaddingLeft' ':' PaddingWidth /
8005: 'BorderTopWidth' ':' BorderWidth /
8006: 'BorderRightWidth' ':' BorderWidth /
8007: 'BorderBottomWidth' ':' BorderWidth /
8008: 'BorderLeftWidth' ':' BorderWidth /
8009: 'BorderTopColor' ':' BorderColor /
8010: 'BorderRightColor' ':' BorderColor /
8011: 'BorderBottomColor' ':' BorderColor /
8012: 'BorderLeftColor' ':' BorderColor /
8013: 'BorderTopStyle' ':' BorderStyle /
8014: 'BorderRightStyle' ':' BorderStyle /
8015: 'BorderBottomStyle' ':' BorderStyle /
8016: 'BorderLeftStyle' ':' BorderStyle .
1.1 cvs 8017: 'LineSpacing' ':' DistOrInherit /
8018: 'Indent' ':' DistOrInherit /
8019: 'Adjust' ':' AlignOrInherit /
8020: 'Hyphenate' ':' BoolInherit /
8021: 'PageBreak' ':' Boolean /
8022: 'LineBreak' ':' Boolean /
8023: 'InLine' ':' Boolean /
8024: 'NoBreak1' ':' AbsDist /
8025: 'NoBreak2' ':' AbsDist /
8026: 'Gather' ':' Boolean /
8027: 'Visibility' ':' NumberInherit /
8028: 'Size' ':' SizeInherit /
8029: 'Font' ':' NameInherit /
8030: 'Style' ':' StyleInherit /
1.23 cvs 8031: 'Weight' ':' WeightInherit /
1.1 cvs 8032: 'Underline' ':' UnderLineInherit /
8033: 'Thickness' ':' ThicknessInherit /
8034: 'Depth' ':' NumberInherit /
8035: 'LineStyle' ':' LineStyleInherit /
8036: 'LineWeight' ':' DistOrInherit /
8037: 'FillPattern' ':' NameInherit /
1.30 cvs 8038: 'Background' ':' Color /
8039: 'Foreground' ':' Color /
1.1 cvs 8040: 'Content' ':' VarConst .
8041: PresFunc = Creation '(' BoxID ')' /
8042: 'Line' /
8043: 'NoLine' /
8044: 'Page' '(' BoxID ')' /
1.13 cvs 8045: 'Copy' '(' BoxTypeToCopy ')' /
8046: 'ShowBox' /
1.18 cvs 8047: 'BackgroundPicture' ':' FileName /
8048: 'PictureMode' ':' PictMode .
1.1 cvs 8049:
8050: BoxTypeToCopy = BoxID [ ExtStruct ] /
8051: ElemID [ ExtStruct ] .
8052: ExtStruct = '(' ElemID ')' .
8053:
8054: Distance = [ Sign ] AbsDist .
8055: Sign = '+' / '-' .
8056: AbsDist = IntegerOrAttr [ '.' DecimalPart ]
8057: [ Unit ] .
8058: IntegerOrAttr = IntegerPart / AttrID .
8059: IntegerPart = NUMBER .
8060: DecimalPart = NUMBER .
8061: Unit = 'em' / 'ex' / 'cm' / 'mm' / 'in' / 'pt' /
8062: 'pc' / 'px' / '%' .
8063:
8064: HPos = 'nil' / VertAxis '=' HorizPosition
8065: [ 'UserSpecified' ] .
8066: VPos = 'nil' / HorizAxis '=' VertPosition
8067: [ 'UserSpecified' ] .
8068: VertAxis = 'Left' / 'VMiddle' / 'VRef' / 'Right' .
8069: HorizAxis = 'Top' / 'HMiddle' / 'HRef' / 'Bottom' .
8070:
1.6 cvs 8071: VertPosition = Reference '.' HorizAxis [ Distance ] .
8072: HorizPosition = Reference '.' VertAxis [ Distance ] .
8073: Reference = 'Enclosing' [ BoxTypeNot ] /
8074: 'Enclosed' [ BoxTypeNot ] /
8075: 'Previous' [ BoxTypeNot ] /
8076: 'Next' [ BoxTypeNot ] /
8077: 'Referred' [ BoxTypeNot ] /
8078: 'Creator' /
8079: 'Root' /
8080: '*' /
8081: BoxOrType .
8082: BoxOrType = BoxID /
8083: [ '*' ] [ FirstSec ] ElemID /
1.17 cvs 8084: 'AnyElem' / 'AnyBox' /
8085: 'ElemWithAttr' AttrID .
1.6 cvs 8086: BoxTypeNot = [ 'NOT' ] BoxOrType .
8087:
8088: Extent = Reference '.' HeightWidth
8089: [ Relation ] [ 'Min' ] /
8090: AbsDist [ 'UserSpecified' ] [ 'Min' ] /
8091: HPos / VPos .
8092: HeightWidth = 'Height' / 'Width' .
8093: Relation = '*' ExtentAttr '%' / Distance .
8094: ExtentAttr = ExtentVal / AttrID .
8095: ExtentVal = NUMBER .
1.26 cvs 8096:
8097: MarginWidth = InheritParent / 'Auto' / Distance .
8098: PaddingWidth = InheritParent / Distance .
8099: BorderWidth = InheritParent / 'Thin' / 'Medium' / 'Thick' / Distance .
8100: BorderColor = InheritParent / 'Transparent' / 'Foreground' /
8101: ColorName .
8102: BorderStyle = InheritParent /
8103: 'None' / 'Hidden' / 'Dotted' / 'Dashed' / 'Solid' /
8104: 'Double' / 'Groove' / 'Ridge' / 'Inset' / 'Outset' .
1.27 cvs 8105: InheritParent = 'Enclosing' '=' / 'Creator' '=' .
1.26 cvs 8106: ColorName = NAME .
1.6 cvs 8107:
8108: Inheritance = Kinship InheritedValue .
8109: Kinship = 'Enclosing' / 'GrandFather'/ 'Enclosed' /
8110: 'Previous' / 'Creator' .
8111: InheritedValue = '+' PosIntAttr [ 'Max' maximumA ] /
8112: '-' NegIntAttr [ 'Min' minimumA ] /
8113: '=' .
8114: PosIntAttr = PosInt / AttrID .
8115: PosInt = NUMBER .
8116: NegIntAttr = NegInt / AttrID .
8117: NegInt = NUMBER .
8118: maximumA = maximum / AttrID .
8119: maximum = NUMBER .
8120: minimumA = minimum / AttrID .
8121: minimum = NUMBER .
8122:
8123: AlignOrInherit = Kinship '=' / Alignment .
8124: Alignment = 'Left' / 'Right' / 'VMiddle' /
8125: 'LeftWithDots' .
1.1 cvs 8126:
1.6 cvs 8127: DistOrInherit = Kinship InheritedDist / Distance .
8128: InheritedDist = '=' / '+' AbsDist / '-' AbsDist .
1.1 cvs 8129:
1.6 cvs 8130: BoolInherit = Boolean / Kinship '=' .
8131: Boolean = 'Yes' / 'No' .
1.1 cvs 8132:
1.6 cvs 8133: NumberInherit = Integer / AttrID / Inheritance .
8134: Integer = NUMBER .
1.1 cvs 8135:
8136: LineStyleInherit= Kinship '=' / 'Solid' / 'Dashed' /
8137: 'Dotted' .
8138:
1.6 cvs 8139: SizeInherit = SizeAttr [ 'pt' ] / Kinship InheritedSize .
8140: InheritedSize = '+' SizeAttr [ 'pt' ]
8141: [ 'Max' MaxSizeAttr ] /
8142: '-' SizeAttr [ 'pt' ]
8143: [ 'Min' MinSizeAttr ] /
1.22 cvs 8144: '*' PercentSizeAttr '%' /
1.6 cvs 8145: '=' .
8146: SizeAttr = Size / AttrID .
8147: Size = NUMBER .
8148: MaxSizeAttr = MaxSize / AttrID .
8149: MaxSize = NUMBER .
8150: MinSizeAttr = MinSize / AttrID .
8151: MinSize = NUMBER .
1.22 cvs 8152: PercentSizeAttr = PercentSize / AttrID .
8153: PercentSize = NUMBER .
1.6 cvs 8154:
8155: NameInherit = Kinship '=' / FontName .
8156: FontName = NAME .
1.30 cvs 8157: Color = 'Transparent' / Kinship '=' / FontName .
1.6 cvs 8158: StyleInherit = Kinship '=' /
1.23 cvs 8159: 'Roman' / 'Italics' / 'Oblique' .
8160: WeightInherit = Kinship '=' /
8161: 'Normal' / 'Bold' .
1.1 cvs 8162: UnderLineInherit= Kinship '=' /
1.6 cvs 8163: 'NoUnderline' / 'Underlined' /
8164: 'Overlined' / 'CrossedOut' .
1.1 cvs 8165: ThicknessInherit= Kinship '=' / 'Thick' / 'Thin' .
1.13 cvs 8166:
8167: FileName = STRING .
8168: PictMode = 'NormalSize' / 'Scale' /
8169: 'RepeatXY' / 'RepeatX' / 'RepeatY' .
1.1 cvs 8170:
1.6 cvs 8171: VarConst = ConstID / ConstType ConstValue /
8172: VarID / '(' FunctionSeq ')' /
8173: ElemID .
8174:
8175: Creation = Create [ 'Repeated' ] .
8176: Create = 'CreateFirst' / 'CreateLast' /
8177: 'CreateBefore' / 'CreateAfter' /
8178: 'CreateEnclosing' .
8179:
1.30 cvs 8180: TransmitSeq = Transmit < Transmit > .
1.6 cvs 8181: Transmit = TypeOrCounter 'To' ExternAttr
8182: '(' ElemID ')' ';' .
8183: TypeOrCounter = CounterID / ElemID .
8184: ExternAttr = NAME .
1.1 cvs 8185:
1.18 cvs 8186: END</pre>
8187: </div>
1.1 cvs 8188:
1.18 cvs 8189: <div class="section">
1.37 cvs 8190: <h2><a name="sectb64" id="sectb64">The T language</a></h2>
1.18 cvs 8191: <pre>TransSchema = 'TRANSLATION' ElemID ';'
1.1 cvs 8192: [ 'LINELENGTH' LineLength ';' ]
8193: [ 'LINEEND' CHARACTER ';' ]
8194: [ 'LINEENDINSERT' STRING ';' ]
8195: [ 'BUFFERS' BufferSeq ]
8196: [ 'COUNTERS' CounterSeq ]
8197: [ 'CONST' ConstSeq ]
8198: [ 'VAR' VariableSeq ]
8199: 'RULES' ElemSeq
8200: [ 'ATTRIBUTES' AttrSeq ]
8201: [ 'PRESENTATION' PresSeq ]
1.30 cvs 8202: < 'TEXTTRANSLATE' TextTransSeq >
1.1 cvs 8203: [ 'SYMBTRANSLATE' TransSeq ]
8204: [ 'GRAPHTRANSLATE' TransSeq ]
8205: 'END' .
8206:
8207: LineLength = NUMBER .
8208:
1.30 cvs 8209: BufferSeq = Buffer < Buffer > .
1.1 cvs 8210: Buffer = BufferID [ '(' 'Picture' ')' ] ';' .
8211: BufferID = NAME .
8212:
1.30 cvs 8213: CounterSeq = Counter < Counter > .
1.1 cvs 8214: Counter = CounterID [ ':' CounterFunc ] ';' .
8215: CounterID = NAME .
8216: CounterFunc = 'Rank' 'of' ElemID [ SLevelAsc ]
8217: [ 'Init' AttrID ] /
8218: 'Rlevel' 'of' ElemID /
8219: 'Set' InitValue 'On' ElemID
8220: 'Add' Increment 'On' ElemID
8221: [ 'Init' AttrID ] .
8222: SLevelAsc = [ '-' ] LevelAsc .
8223: LevelAsc = NUMBER .
8224: InitValue = NUMBER .
8225: Increment = NUMBER .
8226: ElemID = NAME .
8227: AttrID = NAME .
8228:
1.30 cvs 8229: ConstSeq = Const < Const > .
1.1 cvs 8230: Const = ConstID '=' ConstValue ';' .
8231: ConstID = NAME .
8232: ConstValue = STRING .
8233:
1.30 cvs 8234: VariableSeq = Variable < Variable > .
8235: Variable = VarID ':' Function < Function > ';' .
1.1 cvs 8236: VarID = NAME .
8237: Function = 'Value' '(' CounterID [ ':' Length ]
8238: [ ',' CounterStyle ] ')' /
8239: 'FileDir' / 'FileName' / 'Extension' /
8240: 'DocumentName' / 'DocumentDir' /
8241: ConstID / CharString /
8242: BufferID / AttrID .
8243: Length = NUMBER .
8244: CounterStyle= 'Arabic' / 'LRoman' / 'URoman' /
8245: 'Uppercase' / 'Lowercase' .
8246: CharString = STRING .
8247:
1.30 cvs 8248: ElemSeq = TransType < TransType > .
1.1 cvs 8249: TransType = [ FirstSec ] ElemID ':' RuleSeq .
8250: FirstSec = 'First' / 'Second' .
1.30 cvs 8251: RuleSeq = Rule / 'BEGIN' < Rule > 'END' ';' .
1.1 cvs 8252: Rule = SimpleRule / ConditionBlock .
8253: ConditionBlock= 'IF' ConditionSeq SimpleRuleSeq .
1.30 cvs 8254: SimpleRuleSeq = 'BEGIN' < SimpleRule > 'END' ';' /
1.1 cvs 8255: SimpleRule .
8256:
8257: ConditionSeq = Condition [ 'AND' Condition ] .
8258: Condition = [ 'NOT' ] [ 'Target' ] Cond .
8259: Cond = CondElem / CondAscend .
8260: CondElem = 'FirstRef' / 'LastRef' /
8261: 'ExternalRef' /
8262: 'Alphabet' '=' Alphabet /
8263: 'ComputedPage' / 'StartPage' /
8264: 'UserPage' / 'ReminderPage' /
8265: 'Empty' /
1.18 cvs 8266: ElemID /
1.1 cvs 8267: 'FirstAttr' / 'LastAttr' .
8268: CondAscend = [ Ascend ] CondOnAscend .
8269: Ascend = '*' / 'Parent' / 'Ancestor' LevelOrType .
8270: LevelOrType = CondRelLevel / ElemID [ ExtStruct ] .
8271: CondRelLevel = NUMBER .
8272: CondOnAscend = 'First' / 'Last' /
8273: 'Referred' /
8274: [ 'Immediately' ] 'Within' [ NumParent ]
8275: ElemID [ ExtStruct ] /
8276: 'Attributes' /
8277: AttrID [ RelatAttr ] /
8278: 'Presentation' /
1.34 cvs 8279: PresRule .
1.1 cvs 8280: NumParent = [ GreaterLess ] NParent .
1.30 cvs 8281: GreaterLess = '>' / '<' .
1.1 cvs 8282: NParent = NUMBER.
8283: Alphabet = NAME .
8284: RelatAttr = '=' Value /
1.30 cvs 8285: '>' [ '-' ] Minimum /
1.1 cvs 8286: '<' [ '-' ] Maximum /
8287: 'IN' '[' [ '-' ] MinInterval '..'
8288: [ '-' ] MaxInterval ']' .
8289: Value = [ '-' ] IntegerVal / TextVal / AttrValue .
8290: Minimum = NUMBER .
8291: Maximum = NUMBER .
8292: MinInterval = NUMBER .
8293: MaxInterval = NUMBER .
8294: IntegerVal = NUMBER .
8295: TextVal = STRING .
8296: AttrValue = NAME .
8297:
8298: SimpleRule = 'Create' [ 'IN' VarID ] Object
8299: [ Position ] ';' /
8300: 'Write' Object [ Position ] ';' /
8301: 'Read' BufferID [ Position ] ';' /
8302: 'Include' File [ Position ] ';' /
1.6 cvs 8303: 'Get' [ RelPosition ] ElemID
8304: [ ExtStruct ]
8305: [ Position ] ';' /
1.1 cvs 8306: 'Copy' [ RelPosition ] ElemID
8307: [ ExtStruct ]
8308: [ Position ] ';' /
8309: 'Use' TrSchema [ 'For' ElemID ] ';' /
8310: 'Remove' ';' /
1.31 cvs 8311: 'Ignore' ';' /
1.1 cvs 8312: 'NoTranslation' ';' /
8313: 'NoLineBreak' ';' /
8314: 'ChangeMainFile' VarID [ Position ] ';' /
1.14 cvs 8315: 'RemoveFile' VarID [ Position ] ';' /
1.10 cvs 8316: 'Set' CounterID InitValue [ Position ] ';' /
8317: 'Add' CounterID Increment [ Position ] ';' /
1.25 cvs 8318: 'Indent' [ 'IN' VarID ] Indent [ Position ] ';' .
1.10 cvs 8319:
1.25 cvs 8320: Indent = 'Suspend' / 'Resume' / [ IndentSign ] IndentValue .
1.10 cvs 8321: IndentSign = '+' / '-' .
8322: IndentValue = NUMBER .
1.1 cvs 8323:
8324: Object = ConstID / CharString /
8325: BufferID /
8326: VarID /
1.30 cvs 8327: '(' Function < Function > ')' /
1.21 cvs 8328: [ 'Translated' ] AttrID /
1.1 cvs 8329: 'Value' /
8330: 'Content' /
8331: 'Attributes' /
8332: 'Presentation' /
8333: 'RefId' /
8334: 'PairId' /
8335: 'FileDir' / 'FileName' / 'Extension' /
8336: 'DocumentName' / 'DocumentDir' /
8337: [ 'Referred' ] ReferredObject .
8338: Position = 'After' / 'Before' .
8339:
1.6 cvs 8340: ReferredObject= VarID /
8341: ElemID [ ExtStruct ] /
8342: 'RefId' /
8343: 'DocumentName' / 'DocumentDir' .
1.1 cvs 8344:
1.6 cvs 8345: File = FileName / BufferID .
8346: FileName = STRING .
1.1 cvs 8347:
1.6 cvs 8348: RelPosition = 'Included' / 'Referred' .
8349: ExtStruct = '(' ElemID ')' .
1.1 cvs 8350:
1.6 cvs 8351: TrSchema = NAME .
8352:
1.30 cvs 8353: AttrSeq = TransAttr < TransAttr > .
1.6 cvs 8354: TransAttr = AttrID [ '(' ElemID ')' ]
8355: [ RelatAttr ] ':' RuleSeq .
8356:
1.30 cvs 8357: PresSeq = PresTrans < PresTrans > .
1.6 cvs 8358: PresTrans = PresRule ':' RuleSeq .
8359: PresRule = 'Size' [ PresRelation ] /
8360: 'Indent' [ PresRelation ] /
8361: 'LineSpacing' [ PresRelation ] /
8362: 'Adjust' [ '=' AdjustVal ] /
8363: 'Hyphenate' [ '=' BoolVal ] /
8364: 'Style' [ '=' StyleVal ] /
1.24 cvs 8365: 'Weight' [ '=' WeightVal ] /
1.6 cvs 8366: 'Font' [ '=' FontVal ] /
8367: 'UnderLine' [ '=' UnderLineVal ] /
8368: 'Thickness' [ '=' ThicknessVal ] /
8369: 'LineStyle' [ '=' LineStyleVal ] /
8370: 'LineWeight' [ PresRelation ] /
8371: 'FillPattern' [ '=' Pattern ] /
8372: 'Background' [ '=' Color ] /
8373: 'Foreground' [ '=' Color ] .
8374:
8375: PresRelation = '=' PresValue /
1.30 cvs 8376: '>' [ '-' ] PresMinimum /
1.6 cvs 8377: '<' [ '-' ] PresMaximum /
8378: 'IN' '[' [ '-' ] PresIntervalMin '..'
8379: [ '-' ] PresIntervalMax ']' .
1.35 cvs 8380: AdjustVal = 'Left' / 'Right' / 'VMiddle' / 'Justify' /
1.6 cvs 8381: 'LeftWithDots' .
8382: BoolVal = 'Yes' / 'No' .
1.24 cvs 8383: StyleVal = 'Roman' / 'Italics' / 'Oblique' .
8384: WeightVal = 'Normal' / 'Bold' .
1.6 cvs 8385: FontVal = 'Times' / 'Helvetica' / 'Courier' .
8386: UnderLineVal = 'NoUnderline' / 'UnderLined' /
8387: 'OverLined' / 'CrossedOut' .
8388: ThicknessVal = 'Thick' / 'Thin' .
8389: LineStyleVal = 'Solid' / 'Dashed' / 'Dotted' .
8390: Pattern = NAME .
8391: Color = NAME .
8392: PresMinimum = NUMBER .
8393: PresMaximum = NUMBER .
1.1 cvs 8394: PresIntervalMin= NUMBER .
8395: PresIntervalMax= NUMBER .
1.6 cvs 8396: PresValue = [ '-' ] PresVal .
8397: PresVal = NUMBER .
1.1 cvs 8398:
1.6 cvs 8399: TextTransSeq = [ Alphabet ] TransSeq .
8400: Alphabet = NAME .
1.30 cvs 8401: TransSeq = 'BEGIN' < Translation > 'END' ';' /
1.6 cvs 8402: Translation .
1.30 cvs 8403: Translation = Source [ '->' Target ] ';' .
1.6 cvs 8404: Source = STRING .
1.18 cvs 8405: Target = STRING .</pre>
8406: </div>
1.37 cvs 8407: <hr />
1.18 cvs 8408: </div>
1.1 cvs 8409:
1.18 cvs 8410: <div class="chapter">
1.37 cvs 8411: <h1><a name="sect7" id="sect7">Character coding</a></h1>
1.1 cvs 8412:
1.18 cvs 8413: <div class="section">
1.37 cvs 8414: <h2><a name="sectb71" id="sectb71">Characters</a></h2>
1.1 cvs 8415:
1.37 cvs 8416: <p>The characters of the Latin alphabet follow the encoding defined in the
8417: ISO 8859-1 (ISO Latin-1) standard. The characters of the Greek alphabet
8418: follow the encoding defined by Adobe for its Symbol font (Adobe
8419: FontSpecific).</p>
8420:
8421: <p>Characters whose octal code is greater than 0200 are written in the form
8422: of their octal code preceded by a backslash character (``\''). For example,
8423: the French word 'Résumé' is written <tt>R\351sum\351</tt>.</p>
1.30 cvs 8424:
8425: <p>To the ISO 8859-1 encoding four characters with the following codes have
1.37 cvs 8426: been added:<br />
8427: <tt>212</tt>: line break<br />
8428: <tt>240</tt>: sticky space<br />
8429: <tt>201</tt>: thin space<br />
1.18 cvs 8430: <tt>202</tt>: en space</p>
1.30 cvs 8431:
8432: <p>The <tt>212</tt> character is a ``line break'' character which forces a
1.37 cvs 8433: line break. The <tt>240</tt> character is a ``sticky space'', which cannot be
1.18 cvs 8434: replaced by a line break.</p>
8435: </div>
1.1 cvs 8436:
1.18 cvs 8437: <div class="section">
1.37 cvs 8438: <h2><a name="sectb72" id="sectb72">Symbols</a></h2>
1.1 cvs 8439:
1.37 cvs 8440: <p>The table below gives the codes for the symbols of Thot. Symbols can be
8441: used in presentation schemas constants and in transcoding rules of
8442: translation schemas. Each symbol is represented by a single character.</p>
1.18 cvs 8443: <ul>
1.39 ! cvs 8444: <li><tt>r</tt>
! 8445: : a radical</li>
! 8446: <li><tt>i</tt>
! 8447: : a simple integral</li>
! 8448: <li><tt>c</tt>
! 8449: : a curvilinear integral</li>
! 8450: <li><tt>d</tt>
! 8451: : a double integral</li>
! 8452: <li><tt>t</tt>
! 8453: : a triple integral</li>
! 8454: <li><code>o</code>: an over brace</li>
! 8455: <li><code>u</code>: an under brace</li>
! 8456: <li><tt>S</tt>
! 8457: : the summation symbol</li>
! 8458: <li><tt>P</tt>
! 8459: : the product symbol</li>
! 8460: <li><tt>U</tt>
! 8461: : the union symbol</li>
! 8462: <li><tt>I</tt>
! 8463: : the intersection symbol</li>
! 8464: <li><tt>R</tt>
! 8465: : a right arrow</li>
! 8466: <li><tt>L</tt>
! 8467: : a left arrow</li>
! 8468: <li><tt><</tt>
! 8469: : an opening pointy bracket</li>
! 8470: <li><tt>></tt>
! 8471: : a closing pointy bracket</li>
! 8472: <li><tt>^</tt>
! 8473: : an up arrow</li>
! 8474: <li><tt>V</tt>
! 8475: : a down arrow</li>
! 8476: <li><tt>(</tt>
! 8477: : an opening parenthesis</li>
! 8478: <li><tt>)</tt>
! 8479: : a closing parenthesis</li>
! 8480: <li><tt>{</tt>
! 8481: : an opening brace</li>
! 8482: <li><tt>}</tt>
! 8483: : a closing brace</li>
! 8484: <li><tt>[</tt>
! 8485: : an opening square bracket</li>
! 8486: <li><tt>]</tt>
! 8487: : a closing square bracket</li>
1.18 cvs 8488: </ul>
8489: </div>
1.1 cvs 8490:
1.18 cvs 8491: <div class="section">
1.37 cvs 8492: <h2><a name="sectb73" id="sectb73">Graphical elements</a></h2>
1.1 cvs 8493:
1.30 cvs 8494: <p>The table below gives the codes for the graphical elements of Thot. These
1.1 cvs 8495: elements can be used in presentation schemas constants and in transcoding
1.37 cvs 8496: rules of translation schemas. Each graphical element is represented by a
1.18 cvs 8497: single character.</p>
8498: <ul>
1.30 cvs 8499: <li>a: a circle</li>
8500: <li><p><tt>A</tt>: an open curve with an arrow head at the end</p>
8501: </li>
1.39 ! cvs 8502: <li><tt>b</tt>
! 8503: : a horizontal line along the lower side of the box</li>
! 8504: <li><tt>B</tt>
! 8505: : an open curve</li>
! 8506: <li><tt>c</tt>
! 8507: : an ellipse inscribed in the box</li>
! 8508: <li><tt>C</tt>
! 8509: : a rectangle with rounded corners</li>
! 8510: <li><tt>D</tt>
! 8511: : an open curve with two arrow heads</li>
! 8512: <li><tt>e</tt>
! 8513: : The northwest/southeast diagonal of the box with an arrowhead at the
! 8514: bottom</li>
! 8515: <li><tt>E</tt>
! 8516: : The southwest/northeast diagonal of the box with an arrowhead at the
! 8517: top</li>
! 8518: <li><tt>F</tt>
! 8519: : an open curve with an arrow head at start</li>
! 8520: <li><tt>g</tt>
! 8521: : a line from the origin of the box to its opposite corner</li>
! 8522: <li><tt>h</tt>
! 8523: : a horizontal line as wide as the box and placed in its middle</li>
! 8524: <li><tt>l</tt>
! 8525: : a vertical line on the left side of the box</li>
! 8526: <li><tt>L</tt>
! 8527: : a lozenge</li>
! 8528: <li><tt>M</tt>
! 8529: : an open broken line with two arrow heads</li>
! 8530: <li><tt>N</tt>
! 8531: : an open broken line with an arrow head at start</li>
! 8532: <li><tt>o</tt>
! 8533: : The southwest/northeast diagonal of the box with an arrowhead at the
! 8534: bottom</li>
! 8535: <li><tt>O</tt>
! 8536: : The northwest/southeast diagonal of the box with an arrowhead at the
! 8537: top</li>
! 8538: <li><tt>p</tt>
! 8539: : a polygon</li>
! 8540: <li><tt>P</tt>
! 8541: : a rectangle with round corners and a horizontal bar at the top</li>
! 8542: <li><tt>Q</tt>
! 8543: : an ellipse with a horizontal bar at the top</li>
! 8544: <li><tt>r</tt>
! 8545: : a vertical line on the right side of the box</li>
! 8546: <li><tt>R</tt>
! 8547: : a rectangle which is the shape of the box</li>
! 8548: <li><tt>s</tt>
! 8549: : a closed curve</li>
! 8550: <li><tt>S</tt>
! 8551: : an open broken line</li>
! 8552: <li><tt>t</tt>
! 8553: : a horizontal line along the upper side of the box</li>
! 8554: <li><tt>U</tt>
! 8555: : an open broken line with an arrow head at the end</li>
! 8556: <li><tt>v</tt>
! 8557: : a vertical line as tall as the box and placed in its middle</li>
! 8558: <li><tt>V</tt>
! 8559: : a down arrow as tall as the box and in its middle</li>
1.30 cvs 8560: <li>w: a segment (2 points)</li>
1.39 ! cvs 8561: <li><tt>W</tt>
! 8562: : the upper right corner</li>
1.30 cvs 8563: <li>x: a segment (2 points) with an arrow head at the end</li>
1.39 ! cvs 8564: <li><tt>X</tt>
! 8565: : the lower right corner</li>
1.30 cvs 8566: <li>y: a segment (2 points) with an arrow head at the end</li>
1.39 ! cvs 8567: <li><tt>Y</tt>
! 8568: : the lower left corner</li>
1.30 cvs 8569: <li>z: a segment (2 points) with an arrow head at the end</li>
1.39 ! cvs 8570: <li><tt>Z</tt>
! 8571: : the upper left corner</li>
! 8572: <li><tt>space</tt>
! 8573: : a transparent element</li>
! 8574: <li><tt>^</tt>
! 8575: : an up arrow as tall as the box and in its middle</li>
! 8576: <li><tt>></tt>
! 8577: : a right arrow as long as the box's width and in its middle</li>
! 8578: <li><tt>></tt>
! 8579: : a left arrow as long as the box's width and in its middle</li>
! 8580: <li><tt>/</tt>
! 8581: : The southwest/northeast diagonal of the box</li>
! 8582: <li><tt>\</tt>
! 8583: : the northwest/southeast diagonal of the box</li>
1.18 cvs 8584: </ul>
1.37 cvs 8585: <hr />
1.18 cvs 8586: </div>
8587: </div>
8588: </body>
8589: </html>
Webmaster