dthelp: Further coverity fixes
[oweals/cde.git] / cde / programs / dthelp / parser / pass1 / helptag / help.if
1 /*   Copyright (c) 1986, 1987, 1988, 1989, 1990 Hewlett-Packard Co. */
2 /* Interface definition for HP Tag/TeX translator */
3
4 /* Things to watch out for:
5
6    1.  Index processing.  Notice for a number of tags (<BOOK> for example),
7        there is specific code when the tag is in <IDX>:
8          <START-CODE * IDX>, etc.
9        Many tags don't have empty <* IDX> string-code processing, to save
10        on executable size.  Therefore, when you add string-code processing
11        to a tag, make sure you add empty string-code for <* IDX>.
12    2.  Index processing for <COMPUTER>, <CURSOR>, <USER>.  They all have
13        hardcoded default values for their parameters to save on program
14        size (otherwise we have to uncomment parameter code).  This is not
15        a problem since parameters is unimplemented.  Need to watch out for
16        this when we do implement.
17 */
18
19 <!ENTITY MINUS SDATA "-">
20 <!ENTITY PM SDATA '[plusmn]'>               /* ISOnum  */
21 <!ENTITY DIV SDATA '[divide]'>              /* ISOnum  */
22 <!ENTITY TIMES SDATA '[times ]'>            /* ISOnum  */
23 <!ENTITY LEQ SDATA '[le    ]'>              /* ISOtech */
24 <!ENTITY GEQ SDATA '[ge    ]'>              /* ISOtech */
25 <!ENTITY NEQ SDATA '[ne    ]'>              /* ISOtech */
26 <!ENTITY COPY SDATA '[copy  ]'>             /* ISOnum  */
27 <!ENTITY REG SDATA '[reg   ]'>              /* ISOnum  */
28 <!ENTITY TM SDATA '[trade ]'>               /* ISOnum  */
29 <!ENTITY ELLIPSIS SDATA '[hellip]'>         /* ISOpub  */
30 <!ENTITY VELLIPSIS SDATA '[vellip]'>        /* ISOpub  */
31 <!ENTITY PELLIPSIS SDATA "....">  /* ellipsis followed by a period? */
32 <!ENTITY A.M. SDATA "a.m.">
33 <!ENTITY P.M. SDATA "p.m.">
34 <!ENTITY MINUTES SDATA '[prime ]'>          /* ISOtech */
35 <!ENTITY SECONDS SDATA '[Prime ]'>          /* ISOtech */
36 <!ENTITY DEG SDATA '[deg   ]'>              /* ISOnum  */
37 <!ENTITY SQUOTE SDATA "`">
38 <!ENTITY DQUOTE SDATA '"'>
39 <!ENTITY ENDASH SDATA "-">
40 <!ENTITY EMDASH SDATA '[mdash ]'>           /* ISOpub  */
41 <!ENTITY VBLANK SDATA "_">
42 <!ENTITY CENTS SDATA '[cent  ]'>            /* ISOnum  */
43 <!ENTITY STERLING SDATA '[pound ]'>         /* ISOnum  */
44 <!ENTITY M-D- PI "">
45 <!ENTITY SPACE SDATA " ">
46 <!ENTITY SIGSPACE SDATA "& ">
47 <!ENTITY SIGDASH SDATA "&-">
48 <!ENTITY MICRO SDATA '[micro ]'>            /* ISOnum  */
49 <!ENTITY OHM SDATA '[ohm   ]'>              /* ISOnum  */
50 <!ENTITY UP SDATA '[uarr  ]'>               /* ISOnum  */
51 <!ENTITY DOWN SDATA '[darr  ]'>             /* ISOnum  */
52 <!ENTITY LEFT SDATA '[larr  ]'>             /* ISOnum  */
53 <!ENTITY RIGHT SDATA '[rarr  ]'>            /* ISOnum  */
54 <!ENTITY HOME SDATA "home key">
55 <!ENTITY BACK SDATA "\<--">
56 <!ENTITY DATE SDATA CODE>
57      time_t nseconds;
58      struct tm *timefoo;
59      int maxsize = 20;
60      char s[20];
61
62      nseconds = time(NULL);
63      timefoo = localtime(&nseconds);
64      strftime(s, maxsize, "%x", timefoo);
65      fprintf(outfile, "%s\n", s);
66 <\CODE>
67 <!ENTITY TIME SDATA CODE>
68      time_t nseconds;
69      struct tm *timefoo;
70      int maxsize = 20;
71      char s[20];
72
73      nseconds = time(NULL);
74      timefoo = localtime(&nseconds);
75      strftime(s, maxsize, "%X", timefoo);
76      fprintf(outfile, "%s\n", s);
77 <\CODE>
78 <!ENTITY HALFSPACE SDATA " ">
79 <!ENTITY M-SPECCHAR SDATA "Special characters">
80
81 /* Code entities for toggling debugging traces */
82 <!ENTITY m-aopt PI CODE>
83   m_malftrace = (LOGICAL) ! m_malftrace ;
84   <\CODE>
85
86 <!ENTITY m-copt PI CODE>
87   m_chtrace = (LOGICAL) ! m_chtrace ;
88   <\CODE>
89
90 <!ENTITY m-dopt PI CODE>
91   m_cdtrace = (LOGICAL) ! m_cdtrace ;
92   <\CODE>
93
94 <!ENTITY m-hopt PI CODE>
95   m_heapchk = (LOGICAL) ! m_heapchk ;
96   <\CODE>
97
98 <!ENTITY m-oopt PI CODE>
99   tracetostd = (LOGICAL) ! tracetostd ;
100   <\CODE>
101
102 <!ENTITY m-sopt PI CODE>
103   m_scantrace = (LOGICAL) ! m_scantrace ;
104   <\CODE>
105
106 <!ENTITY m-topt PI CODE>
107   m_tagtrace = (LOGICAL) ! m_tagtrace ;
108   <\CODE>
109
110 /* Code entities for MARKUP and HP Tag versions */
111 <!ENTITY m-markup-ver SDATA CODE>
112   {
113   M_WCHAR *wc_1, *wc_2;
114
115   wc_1 = MakeWideCharString(M_VERSION);
116   wc_2 = MakeWideCharString("m-markup-ver");
117   m_piaction(wc_1, wc_2, M_SDATA) ;
118   m_free(wc_1,"wide character string");
119   m_free(wc_2,"wide character string");
120   }
121   <\CODE>
122
123 <!ENTITY m-tagver SDATA CODE>
124   {
125   M_WCHAR *wc_1, *wc_2;
126
127   wc_1 = MakeWideCharString(version);
128   wc_2 = MakeWideCharString("m-tagver");
129   m_piaction(wc_1, wc_2, M_SDATA) ;
130   m_free(wc_1,"wide character string");
131   m_free(wc_2,"wide character string");
132   }
133   <\CODE>
134
135 <!ENTITY m-machine SDATA CODE>
136 #if defined(MSDOS)
137   m_piaction("VECTRA", "m-machine", M_SDATA) ;
138 #else
139 #if defined(hpux)
140   {
141   M_WCHAR *wc_1, *wc_2;
142
143   wc_1 = MakeWideCharString("HPUX");
144   wc_2 = MakeWideCharString("m-machine");
145   m_piaction(wc_1, wc_2, M_SDATA) ;
146   m_free(wc_1,"wide character string");
147   m_free(wc_2,"wide character string");
148   }
149 #else
150 #if defined(_AIX)
151   {
152   M_WCHAR *wc_1, *wc_2;
153
154   wc_1 = MakeWideCharString("AIX");
155   wc_2 = MakeWideCharString("m-machine");
156   m_piaction(wc_1, wc_2, M_SDATA) ;
157   m_free(wc_1,"wide character string");
158   m_free(wc_2,"wide character string");
159   }
160 #else
161 #if defined(sun)
162   {
163   M_WCHAR *wc_1, *wc_2;
164
165   wc_1 = MakeWideCharString("SUN");
166   wc_2 = MakeWideCharString("m-machine");
167   m_piaction(wc_1, wc_2, M_SDATA) ;
168   m_free(wc_1,"wide character string");
169   m_free(wc_2,"wide character string");
170   }
171 #else
172 #if defined(USL)
173   {
174   M_WCHAR *wc_1, *wc_2;
175
176   wc_1 = MakeWideCharString("USL");
177   wc_2 = MakeWideCharString("m-machine");
178   m_piaction(wc_1, wc_2, M_SDATA) ;
179   m_free(wc_1,"wide character string");
180   m_free(wc_2,"wide character string");
181   }
182 #else
183 #if defined(__uxp__)
184   {
185   M_WCHAR *wc_1, *wc_2;
186
187   wc_1 = MakeWideCharString("UXP");
188   wc_2 = MakeWideCharString("m-machine");
189   m_piaction(wc_1, wc_2, M_SDATA) ;
190   m_free(wc_1,"wide character string");
191   m_free(wc_2,"wide character string");
192   }
193 #else
194 #if defined(__osf__)
195   {
196   M_WCHAR *wc_1, *wc_2;
197
198   wc_1 = MakeWideCharString("OSF1");
199   wc_2 = MakeWideCharString("m-machine");
200   m_piaction(wc_1, wc_2, M_SDATA) ;
201   m_free(wc_1,"wide character string");
202   m_free(wc_2,"wide character string");
203   }
204 #else
205   m_piaction("UNDEFINED MACHINE",
206              "m-machine",
207              M_SDATA) ;
208 #endif
209 #endif
210 #endif
211 #endif
212 #endif
213 #endif
214 #endif
215   <\CODE>
216
217 <SIGN-ON>CDE HelpTag Formatting System. - Version B.00.00  (DTD Version A.01.23)
218 <GLOBAL-DEFINE>
219 #define DEFINE
220 #include "global.h"
221 #include "htag.tss"
222 static char ident1[]="@(#)CDE Help Tag Parser";
223 static char ident2[]="@(#)Version Number: B.00.00";
224 static char ident3[]="@(#) (c) Copyright 1993, 1994 Hewlett-Packard Company";
225 static char ident4[]="@(#) (c) Copyright 1993, 1994 International Business Machines Corp.";
226 static char ident5[]="@(#) (c) Copyright 1993, 1994 Sun Microsystems, Inc.";
227 static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.";
228
229
230 <GLOBAL-DECLARE>
231 #include "global.h"
232 #include "htag.tss"
233
234 <START-CODE>
235   SEARCH *new ;
236   char *p ;
237   char *q ;
238
239   /* Pick version number out of sign-on message */
240   if (p = strstr(m_signon, VERSION)) {
241     p += strlen(VERSION) + 1 ;
242     for (q = p ; *q && *q != '\n'; q++) ;
243     if (*q == '\n') {
244       version = (char *) m_malloc(q - p + 1, "version") ;
245       *q = M_EOS ;
246       strcpy(version, p) ;
247       *q = '\n' ;
248       }
249     }
250
251   fbasename();
252
253   options(FALSE) ;
254   if (m_errexit && stoponerror) m_exit(m_errexit) ;
255
256   if (indir) {
257     new = (SEARCH *) m_malloc(sizeof(SEARCH), "search path") ;
258     new->directory = indir ;
259     new->next = path ;
260     path = new ;
261     }
262
263 <END-CODE>
264   int i;
265   prebye = ftell(outfile) ;
266   dumpxref() ;
267   if (glossary) checkgloss() ;
268
269   /* warn if we have forward xrefs */
270   if (have_forward_xrefs) {
271        m_exit(77);
272   }
273
274 <TEXT-CODE>
275     outchar(m_textchar, outfile) ;
276
277 <PI-CODE>
278    outpi(m_enttype, m_pi, m_entname) ;
279
280
281 <ELEMENT ABBREV>
282   <PARAM>
283     where = WHERE (QTOC = TOC,
284                    QFOOTER = FOOTER,
285                    QBOTH = BOTH) ;
286   <START-CODE CHAPHEAD RSUB>
287     fputs(" ABBREV=\"", outfile);
288   <START-CODE CHAPHEAD RSECT>
289     fabbrev = (LOGICAL)
290               (! m_wcmbupstrcmp(where, QFOOTER) ||
291                ! m_wcmbupstrcmp(where, QBOTH)) ;
292     if (fabbrev) {
293       newhline = 0 ;
294       }
295     fputs(" ABBREV=\"", outfile);
296   <START-CODE CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
297     fputs(" ABBREV=\"", outfile);
298   <START-CODE CAPTION>
299     savhd = FALSE;
300     tooutput = TRUE;
301     fputs(" ABBREV=\"", outfile);
302   <START-CODE CHAPHEAD CHAPTER, CHAPHEAD MESSAGE,
303               CHAPHEAD TEST, CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
304               CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
305               CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD HOMETOPIC>
306     fabbrev = (LOGICAL)
307               (! m_wcmbupstrcmp(where, QFOOTER) ||
308                ! m_wcmbupstrcmp(where, QBOTH)) ;
309     if (fabbrev) {
310       newhline = 0 ;
311      }
312     fputs(" ABBREV=\"", outfile);
313   <START-CODE>
314     M_WCHAR *wc_stago, *wc_tagc;
315
316     wc_stago = MakeWideCharString(m_stago);
317     wc_tagc  = MakeWideCharString(m_tagc);
318     
319     fabbrev = (LOGICAL)
320               (! m_wcmbupstrcmp(where, QFOOTER) ||
321                ! m_wcmbupstrcmp(where, QBOTH)) ;
322     if (fabbrev) {
323       newhline = 0 ;
324     }
325     m_err2("Unimplemented %sABBREV%s reached", wc_stago, wc_tagc);
326     m_free(wc_stago,"wide character string");
327     m_free(wc_tagc,"wide character string");
328   <END-CODE>
329     fabbrev = FALSE ;
330     fputs("\"", outfile);
331
332
333 <ELEMENT ABSTRACT>
334   <START-CODE>
335     static char abstract[] = "-ABSTRACT";
336     char id[SDLNAMESIZ+sizeof(abstract)];
337
338     hadabstract = TRUE;
339     needabstracthead = TRUE;
340     sprintf(id, "%s%s", sdlReservedName, abstract);
341     mb_starthelpnode("_ABSTRACT", id, 0);
342   <END-CODE>
343     CloseVirpage();
344   <TEXT-CODE>
345      outchar(m_textchar, outfile);
346
347 <ELEMENT ACRO>
348   <START-CODE>
349     mb_strcode("<KEY CLASS=\"ACRO\">", outfile) ;
350     if (echo) {
351       mb_echohead(m_stago);
352       echohead(m_parent(0)) ;
353       mb_echohead(m_net);
354       }
355   <END-CODE>
356     mb_strcode("</KEY>", outfile) ;
357     if (echo) mb_echohead(m_net) ;
358
359   <START-CODE * IDX>
360   <END-CODE * IDX>
361   <END-CODE * EXAMPLESEG, * IMAGE>
362     POPFONT ;
363   <TEXT-CODE * IDX>
364     indexchar(m_textchar) ;
365   <TEXT-CODE>
366     outchar(wc_toupper(m_textchar), outfile) ;
367
368 <ELEMENT ANNOTATION>
369   <START-CODE>
370     if (!firstAnnot)
371         {
372         exLineNum++;
373         }
374     firstAnnot = FALSE;
375
376     savhd    = TRUE;
377     hderr    = FALSE;
378     tooutput = FALSE;
379     mb_strcode("<HEAD CLASS=\"ANNOTATION\" TYPE=\"DYNAMIC\" SSI=\"ANNOT-",
380                outfile);
381     mb_strcode(stackex ? "STACK\">" : "SIDE\">", outfile);
382   <END-CODE>
383     mb_strcode("</HEAD>", outfile);
384     savehead[svheadlen] = '\0';
385     savhd    = FALSE;
386     tooutput = TRUE;
387
388 <ELEMENT BOOK>
389   <START-CODE>
390     mb_strcode("<KEY CLASS=\"BOOK\">", outfile) ;
391     if (echo) {
392       mb_echohead(m_stago) ;
393       echohead(m_parent(0)) ;
394       mb_echohead(m_net) ;
395       }
396   <END-CODE>
397     mb_strcode("</KEY>", outfile) ;
398     if (echo) mb_echohead(m_net) ;
399
400   <START-CODE * IDX>
401   <END-CODE * IDX>
402   <TEXT-CODE * IDX>
403     indexchar(m_textchar) ;
404
405 <ELEMENT CAPTION>
406   <START-CODE FIGURE>
407     figcaption = TRUE ;
408     newhline = 0 ;
409     savhd = TRUE ;
410     hderr = FALSE ;
411     svheadlen = 0 ;
412     tooutput = FALSE;
413     if (ftonumber)
414         fputs("<SUBHEAD TYPE=\"LINED\" SSI=\"CAPTION-NUMBERED\"", outfile);
415     else
416         fprintf(outfile,
417                 "<HEAD TYPE=\"LINED\" CLASS=\"CAPTION\" SSI=\"CAPTION%s\"",
418                 capposition);
419   <END-CODE FIGURE>
420     char *mb_savehead;
421
422     savehead[svheadlen] = M_EOS ;
423     savhd = FALSE ;
424     tooutput = TRUE;
425     mb_strcode(">", outfile);
426     strcode(savehead, outfile);
427     if (ftonumber)
428         fputs("</SUBHEAD>", outfile);
429     ftonumber = 0;
430
431 <ELEMENT CAUTION>
432   <START-CODE>
433     StartNCW("CAUTION");
434
435 <ELEMENT CDISPLAY>
436   <PARAM>
437         file = ENTITY ;    
438         startrow = STARTROW  ;
439         endrow = ENDROW  ;
440         clip = CLIP ;
441         margin = MARGIN ;
442
443 <ELEMENT CHAPHEAD>
444   <START-CODE MESSAGE>
445     emsghead = USERHEAD ;
446 /* Node headings */
447   <END-CODE CHAPTER, RSECT,  S1, S2, S3, S4, S5, S6, S7,
448             S8, S9, TEST, HOMETOPIC, MESSAGE>
449     endhead() ;
450     mb_strcode(">", outfile);
451     strcode(savehead, outfile);
452     chksnb();
453 /* Non node headings */
454   <END-CODE RSUB, MSGSUB, PROCEDURE>
455     endhead() ;
456     mb_strcode(">", outfile);
457     strcode(savehead, outfile);
458     fputs("</HEAD>\n", outfile);
459 /* Non node headings */
460   <END-CODE OTHERHEAD>
461     endhead() ;
462     fputs("</HEAD>\n", outfile);
463
464 <ELEMENT CHAPTER>
465   <PARAM>
466     id = ID ;
467     number = NUMBER ;
468     include = INCLUDE  ;
469     exclude = EXCLUDE  ;
470   <START-CODE>
471     M_WCHAR *wc_chapter;
472
473     wc_chapter = MakeWideCharString("CHAPTER");
474
475     assert_hometopic_exists();
476     chapstart(id) ;
477     thisnodelevel = 2;
478     starthelpnode(wc_chapter, id, thisnodelevel);
479     m_free(wc_chapter, "wide character string");
480   <END-CODE>
481     CloseVirpage();
482     rseqend() ;
483     thisnodelevel = 0;
484
485 <ELEMENT CIRCLE>
486   <TEXT-CODE>
487     if (echo) mb_echohead("((") ;
488     mb_strcode("(", outfile) ;
489     outchar (m_textchar, outfile) ;
490     mb_strcode(")", outfile) ;
491     if (echo) mb_echohead("))") ;
492   <START-CODE * IDX>
493   <END-CODE * IDX>
494   <TEXT-CODE * IDX>
495     indexchar('(');
496     indexchar(m_textchar) ;
497     indexchar(')');
498
499 <ELEMENT COMPUTER>
500   <START-CODE>
501     mb_strcode("<KEY CLASS=\"MACH-OUT\">", outfile) ;
502     if (echo) mb_echohead("``") ;
503   <END-CODE>
504     POPFONT ;
505     mb_strcode("</KEY>", outfile) ;
506     if (echo) mb_echohead("''") ;
507   <TEXT-CODE>
508      esoutchar(m_textchar) ;
509   <TEXT-CODE * IMAGE>
510      exoutchar(m_textchar) ;
511   <TEXT-CODE * EXAMPLESEG>
512      exoutchar(m_textchar) ;
513
514   <START-CODE * IDX>
515   <END-CODE * IDX>
516   <TEXT-CODE * IDX>
517     indexchar(m_textchar) ;
518
519 <ELEMENT COPYRIGHT>
520   <START-CODE>
521     static char copyright[] = "-COPYRIGHT";
522     char id[SDLNAMESIZ+sizeof(copyright)];
523
524     sprintf(id, "%s%s", sdlReservedName, copyright);
525     mb_starthelpnode("_COPYRIGHT", id, 0);
526     /* No Head.  Let author have a clean slate. */
527   <END-CODE>
528     CloseVirpage();
529
530 <ELEMENT CURSOR>
531   <START-CODE>
532     if (echo) {
533       mb_echohead(m_stago) ;
534       echohead(m_parent(0)) ;
535       mb_echohead(m_net) ;
536       }
537   <END-CODE>
538     if (echo) mb_echohead(m_net) ;
539   <TEXT-CODE>
540     esoutchar(m_textchar) ;
541   <TEXT-CODE * EXAMPLESEG>
542     exoutchar(m_textchar) ;
543
544   <START-CODE * IDX>
545   <END-CODE * IDX>
546   <TEXT-CODE * IDX>
547     indexchar(m_textchar) ;
548
549 <ELEMENT DEFINITION>
550
551 <ELEMENT DESCRIP>
552
553 <ELEMENT DTERM>
554   <START-CODE>
555     termp = term;
556     tooutput = FALSE;
557   <END-CODE>
558     tooutput = TRUE;
559     *termp = M_EOS ;
560     /* trim possible (perhaps) last space */
561     if (termp - term > 1 && *(termp-1) == ' ') {
562          *(termp-1) = M_EOS;
563     }
564     if (!(lastTermId = (int) m_lookfortrie(term, &gtree)))
565         {
566         lastTermId = NextId();
567         m_ntrtrie(term, &gtree, (void *) -lastTermId);
568         }
569     else
570         if (lastTermId > 0)
571             {
572             if (!m_resettrie(&gtree, term, (void *) -lastTermId))
573                 {
574                 m_error("Internal error. Can't reset glossary trie") ;
575                 m_exit(TRUE) ;
576                 }
577             }
578         else
579             lastTermId = -lastTermId;
580
581   <TEXT-CODE>
582     termchar(m_textchar) ;
583   <PI-CODE>
584     termpi(m_enttype, m_pi, m_entname) ;
585
586 <ELEMENT EMPH>
587   <START-CODE>
588     mb_strcode("<KEY CLASS=\"EMPH\">", outfile) ;
589     if (echo) mb_echohead("!!") ;
590   <END-CODE>
591     mb_strcode("</KEY>", outfile) ;
592     if (echo) mb_echohead("!!") ;
593
594   <START-CODE * IDX>
595   <END-CODE * IDX>
596   <TEXT-CODE * IDX>
597     indexchar(m_textchar) ;
598
599 <ELEMENT ESC>
600   <START-CODE * IDX>
601   <END-CODE * IDX>
602   <TEXT-CODE * IDX>
603     indexchar(m_textchar) ;
604   <TEXT-CODE>
605     static M_WCHAR ch[2];
606
607     ch[0] = m_textchar;
608     strcode(ch, outfile);
609   <START-CODE>
610     if (echo) {
611       mb_echohead(m_stago) ;
612       echohead(m_parent(0)) ;
613       mb_echohead(m_net) ;
614       }
615   <END-CODE>
616     if (echo) mb_echohead(m_net) ;
617
618 <ELEMENT EX>
619   <PARAM>
620     type = TYPE (QCOMPUTER = COMPUTER,
621                  QDISPLAY  = DISPLAY) ;
622     position = POSITION (QLEFT = LEFT,
623                          QINDENT = INDENT,
624                          QCENTER = CENTER) ;
625     notes = NOTES (QSIDE = SIDE,
626                    QSTACK = STACK) ;
627     width = WIDTH ;
628     lines = LINES (QNUMBER = NUMBER,
629                    QNONUMBER = NONUMBER) ;
630     textsize = TEXTSIZE (QNORMAL = NORMAL,
631                          QSMALLER = SMALLER,
632                          QSMALLEST = SMALLEST) ;
633   <START-CODE>
634     StartEx(notes, lines, textsize);
635   <END-CODE>
636     EndEx();
637     tonumexlines = FALSE;
638     fputs(saveex, outfile);
639     fputs("</BLOCK>\n", outfile);
640     inBlock = FALSE;
641   <TEXT-CODE>
642     outchar(m_textchar, outfile) ;
643
644 <ELEMENT EXAMPLESEG>
645   <START-CODE>
646     if (exLineNum > 1)
647         EndEx();
648     inSdlP     = TRUE;
649     savex      = TRUE;
650     tooutput   = FALSE;
651     saveexseg  = mb_malloc(1);
652     svexseglen = 1;
653     svheadlen  = 0; /* we save any <annotation> text in "savehead" */
654   <END-CODE>
655     savex = FALSE;
656     tooutput = TRUE;
657   <TEXT-CODE>
658     exoutchar(m_textchar);
659
660 <ELEMENT EXPLAIN>
661   <START-CODE>
662     PushForm(NULL, "EXPLAIN", NULL);
663
664 <ELEMENT FIGURE>
665   <PARAM>
666     number = NUMBER ;
667     tonumber = TONUMBER (QNUMBER = NUMBER,
668                          QNONUMBER = NONUMBER) ;
669     id = ID ;
670     file = ENTITY ;
671     figpos = FIGPOS (QLEFT = LEFT,
672                      QCENTER = CENTER,
673                      QRIGHT = RIGHT) ;
674     cappos = CAPPOS (QLEFT = LEFT,
675                      QCENTER = CENTER,
676                      QRIGHT = RIGHT) ;
677     oldtype = OLDTYPE (QART = ART,
678                        QPCL = PCL,
679                        QTIFF = TIFF,
680                        QLISTING = LISTING,
681                        QTEXT = TEXT) ;
682     xwidth = WIDTH (QFULL = FULL,
683                    QTEXT = TEXT,
684                    QCURRENT = CURRENT) ;
685     xdepth = HEIGHT (QNATURAL = NATURAL) ;
686     xhadjust = HADJUST ;
687     xvadjust = VADJUST ;
688     border = BORDER (QTOP = TOP,
689                      QBOTTOM = BOTTOM,
690                      QBOX = BOX,
691                      QSCREEN = SCREEN,
692                      QNOBOX = NOBOX) ;
693     type = TYPE  (QART = ART,
694                   QPCL = PCL,
695                   QTIFF = TIFF,
696                   QTIF = TIF,
697                   QLISTING = LISTING,
698                   QTEXT = TEXT,
699                   QHPGL = HPGL,
700                   QHPG = HPG);
701     xmagnify = MAGNIFY (QFIT = FIT) ;
702     video = VIDEO (QINVERSE = INVERSE,
703                    QNOINVERSE = NOINVERSE) ;
704     strip = STRIP (QSTRIP = STRIP,
705                    QNOSTRIP = NOSTRIP) ;
706     mirror = MIRROR (QMIRROR = MIRROR) ;
707     margin = MARGIN ;
708     clip = CLIP ;
709     penwidth = PENWIDTH ;
710     snap = SNAP (QSNAP = SNAP,
711                  QNOSNAP = NOSNAP) ;
712     autoscale = AUTOSCALE (QAUTOSCALE = AUTOSCALE,
713                            QNOAUTOSCALE = NOAUTOSCALE) ;
714     plottype = PLOTTYPE ;
715     callout = CALLOUT ;
716     textsize = TEXTSIZE (QNORMAL = NORMAL,
717                          QSMALLER = SMALLER,
718                          QSMALLEST = SMALLEST) ;
719     ghyperlink = GHYPERLINK  ;
720     glinktype = GLINKTYPE (QJUMP = JUMP,
721                            QJUMPNEWVIEW = JUMPNEWVIEW,
722                            QDEFINITION = DEFINITION,
723                            QEXECUTE = EXECUTE,
724                            QAPPDEFINED = APPDEFINED,
725                            QMAN = MAN) ;
726     gdescription = GDESCRIPTION  ;
727   <START-CODE>
728      figure(number,
729             tonumber,
730             id,
731             file,
732             figpos,
733             cappos,
734             ghyperlink,
735             glinktype,
736             gdescription);
737   <END-CODE>
738     if (ftonumber | (svheadlen != 0))
739         {
740         fputs("</HEAD>", outfile);
741         ftonumber = 0;
742         }
743     fputs("\n</REFITEM>\n</SNREF>", outfile);
744     if (ghyperlink)
745         {
746         fputs("</LINK>\n", outfile);
747         }
748     inSdlP = FALSE;
749     fputs("</P>\n", outfile);
750
751 <ELEMENT FOOTNOTE>
752   /* When implementing, check conditionals of <FOOTNOTE> in <P>    */
753   <TEXT-CODE * EXAMPLESEG, * IMAGE>
754     outchar(m_textchar, outfile) ;
755   <END-CODE>
756     footnoteno++;
757     POPFONT; 
758
759 <ELEMENT FRONTSUB>
760   <PARAM>
761     include = INCLUDE  ;
762     exclude = EXCLUDE  ;
763 <START-CODE>
764    PushForm(NULL, NULL, NULL);
765
766 <ELEMENT GLOSSARY>
767   <START-CODE>
768     char *string = 
769       GetDefaultHeaderString("GlossaryElementDefaultHeadingString",
770                              M_SDATA,
771                              "Glossary");
772     static char glossary_string[] = "-GLOSSARY";
773     char id[SDLNAMESIZ+sizeof(glossary_string)];
774
775     thisnodelevel = 2;
776     sprintf(id, "%s%s", sdlReservedName, glossary_string);
777     mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
778     if (strlen(string) + 1 > sizeof(chapstring)) {
779       m_error("Program error: exceeded chapstring") ;
780       m_exit(TRUE) ;
781       }
782     snprintf(chapstring, sizeof(chapstring), "%s", string) ;
783     fputs("\nGlossary\n", stderr) ;
784     glossary = TRUE ;
785     fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
786     m_free(string, "default header string return");
787   <END-CODE>
788     CloseVirpage();
789     thisnodelevel = 0;
790
791 <ELEMENT GRAPHIC>
792   <PARAM>
793     id = ID ;
794     file = ENTITY ;
795 <START-CODE>
796     unsigned char etype, wheredef ;
797      /* Code from figstart */
798   if (id) {
799     mbstowcs(xrefstring, "\\<xref graphic>", 400);
800     xstrlen = w_strlen(xrefstring) ;
801     m_getline(&xrffile, &xrfline) ;
802     if (xrffile == NULL) {
803          /* set to primary input source */
804          xrffile = inputname;
805     }
806     setid(id,
807           TRUE,
808           FALSE,
809           inchapter,
810           chapstring,
811           xrffile,
812           xrfline,
813           FALSE) ;
814
815     }
816   /* initialize some stuff first:
817      - file is the entity name,
818      - f_file is the content of the entity,
819        used only if f_content nonNULL
820      - f_content is f_file with the relative pathname, initialized to NULL,
821      - f_contqual is fully qualified f_file, assigned ONLY IF
822        f_content nonNULL
823   */
824   file_ent = FALSE ;
825   f_content = NULL ;
826   f_contqual[0] = M_EOS ;
827
828   /* check ENTITY and determine the figure type  */
829   if (file) {
830     m_lookent(file, &etype, &f_file, &wheredef) ;
831     if (etype != M_SYSTEM) {
832       M_WCHAR *wc_stago, *wc_tagc, *wc_entsystem, *wc_entkw;
833
834       wc_stago     = MakeWideCharString(m_stago);
835       wc_tagc      = MakeWideCharString(m_tagc);
836       wc_entsystem = MakeWideCharString(m_entsystem);
837       wc_entkw     = MakeWideCharString(m_entkw);
838       m_err6("%s not a %s %s, as required for the ENTITY parameter of %s%s%s",
839              file,
840              wc_entsystem,
841              wc_entkw,
842              wc_stago,
843              m_parent(0),
844              wc_tagc) ;
845       m_free(wc_stago,"wide character string");
846       m_free(wc_tagc,"wide character string");
847       m_free(wc_entsystem,"wide character string");
848       m_free(wc_entkw,"wide character string");
849       }
850     else {
851       file_ent = TRUE ;
852       f_content = searchforfile(f_file) ;
853       if (f_content) {
854         if (getqualified(f_contqual, f_content)) {
855           /* unsuccessful qual */
856           if (w_strlen(f_content) < FNAMELEN)
857             w_strcpy(f_contqual, f_content) ;
858           else {
859             m_err1("Internal error. File name too long: %s", f_content) ;
860             m_exit(m_errexit) ;
861             }
862           }
863         }
864       else {
865         m_err2("Can't find file %s (declared in entity %s)", f_file, file) ;
866         }
867       }
868     }
869
870     {
871     char *mb_content, snb_id[32];
872     char buffer[BIGBUF];
873     static M_WCHAR empty[1];
874     empty[0] = M_EOS;
875
876     if (!f_content) f_content = empty;
877
878     mb_content = MakeMByteString(f_content);
879     sprintf(snb_id, "%s%d", sdlReservedName, NextId());
880     mb_strcode("<SNREF", outfile);
881     if (id)
882         {
883         char *mb_id;
884
885         mb_id = MakeMByteString(id);
886         sprintf(buffer, " ID=\"%s\"", mb_id);
887         mb_strcode(buffer, outfile);
888         m_free(mb_id,"multi-byte string");
889         }
890     sprintf(buffer,
891             ">\n<REFITEM RID=\"%s\" CLASS=\"IN-LINE\"></REFITEM>\n</SNREF>",
892             snb_id);
893     mb_strcode(buffer, outfile);
894     AddToSNB(snb_id, mb_content);
895     m_free(mb_content,"multi-byte string");
896     }
897
898 <ELEMENT HEAD>
899 /* Accent headings */
900   <START-CODE NOTE, CAUTION, WARNING>
901     notehead = TRUE ;
902     newhline = 0 ;
903     fputs("<HEAD TYPE=\"LINED\" SSI=\"NCW\">", outfile);
904 /* Other headings */
905   <START-CODE LABLIST, IMAGE, LIST, EX, P>
906     char *ssi;
907
908     ssi = MakeMByteString(m_parent(1));
909     newhline = 0 ;
910     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
911     m_free(ssi, "multi-byte string");
912 /* Node headings */
913   <START-CODE CHAPHEAD CHAPTER, 
914               CHAPHEAD RSECT, CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
915               CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
916               CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD TEST,
917               CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE
918               >
919     char *ssi;
920
921     ssi = MakeMByteString(m_parent(1));
922     newhline = 0 ;
923     echo = TRUE ;
924     savhd = TRUE ;
925     hderr = FALSE ;
926     svheadlen = 0 ;
927     savesnb = mb_malloc(1);
928     *savesnb = '\0';
929     tooutput = FALSE;
930     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
931     m_free(ssi, "multi-byte string");
932 /* Non node headings */
933   <START-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB>
934     char *ssi;
935
936     ssi = MakeMByteString(m_parent(1));
937     newhline = 0 ;
938     echo = TRUE ;
939     savhd = TRUE ;
940     hderr = FALSE ;
941     svheadlen = 0 ;
942     tooutput = FALSE;
943     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
944     m_free(ssi, "multi-byte string");
945 /* Non node headings */
946   <START-CODE CHAPHEAD PROCEDURE>
947     newhline = 0 ;
948     echo = TRUE ;
949     savhd = TRUE ;
950     hderr = FALSE ;
951     svheadlen = 0 ;
952     tooutput = FALSE;
953     fputs("<HEAD TYPE=\"LINED\" SSI=\"PROCEDURE\"", outfile);
954 /* Non node headings */
955   <START-CODE OTHERHEAD>
956     char *ssi;
957
958     ssi = MakeMByteString(m_parent(1));
959     newhline = 0 ;
960     echo = TRUE ;
961     savhd = TRUE ;
962     hderr = FALSE ;
963     svheadlen = 0 ;
964     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
965     m_free(ssi, "multi-byte string");
966 /* Other headings */ 
967   <START-CODE CHAPHEAD>
968      M_WCHAR *wc_stago, *wc_tagc;
969
970      wc_stago = MakeWideCharString(m_stago);
971      wc_tagc  = MakeWideCharString(m_tagc);
972      m_err2("Unimplemented %sCHAPHEAD%s reached", wc_stago, wc_tagc);
973      m_free(wc_stago,"wide character string");
974      m_free(wc_tagc,"wide character string");
975 /* Non-node headings */
976   <START-CODE FRONTSUB>
977     char *ssi;
978
979     ssi = MakeMByteString(m_parent(1));
980     echo = TRUE ;
981     newhline = 0 ;
982     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
983     m_free(ssi, "multi-byte string");
984 /* Non-node headings */
985   <START-CODE ABSTRACT>
986     echo = TRUE ;
987     newhline = 0 ;
988     needabstracthead = FALSE;
989     fputs("<HEAD TYPE=\"LINED\" SSI=\"ABSTRACT\">", outfile);
990 /* Node headings */
991   <START-CODE OTHERFRONT>
992     had_an_otherfront_head = TRUE;
993     newhline = 0 ;
994     echo = TRUE ;
995     savhd = TRUE ;
996     hderr = FALSE ;
997     svheadlen = 0 ;
998     fputs("<HEAD TYPE=\"LINED\" SSI=\"METAINFO\">", outfile);
999 /* Other headings.*/
1000   <START-CODE SYNTAX>
1001 /* Other headings (mixed content) */
1002   <END-CODE  P, IMAGE>
1003     endhead();
1004     fputs("</HEAD>", outfile);
1005 /* Accent and Other headings (no mixed content) */
1006   <END-CODE LABLIST, LIST, EX, NOTE, CAUTION, WARNING>
1007     fputs("</HEAD>\n", outfile);
1008 /* Non node headings */
1009   <END-CODE ABSTRACT, FRONTSUB, MESSAGE>
1010     echo = FALSE ;
1011     chksnb();
1012 /* Node headings */
1013   <END-CODE CHAPHEAD CHAPTER,
1014             CHAPHEAD RSECT,  CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
1015             CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
1016             CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD TEST,
1017             CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE>
1018     echo = FALSE;
1019     savhd = FALSE;
1020     savehead[svheadlen] = '\0';
1021     tooutput = TRUE;
1022 /* Non node headings */
1023   <END-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
1024     echo = FALSE;
1025     savhd = FALSE;
1026     savehead[svheadlen] = '\0';
1027     tooutput = TRUE;
1028 /* Non node headings */
1029   <END-CODE OTHERHEAD>
1030     endhead() ;
1031     fputs("</HEAD>\n", outfile);
1032 /* Node headings. */
1033   <END-CODE OTHERFRONT>
1034     endhead() ;
1035     chksnb();
1036 /* Other headings. */
1037   <END-CODE SYNTAX>
1038   <END-CODE>
1039     fputs("</HEAD>", outfile);
1040 <TEXT-CODE IMAGE>
1041     outchar(m_textchar, outfile) ;
1042
1043 <ELEMENT HELPVOLUME>
1044   <PARAM>
1045     author = AUTHOR  ;
1046     language = LANGUAGE (QENGLISH = ENGLISH,
1047                          QNORWEGIAN = NORWEGIAN,
1048                          QSWEDISH = SWEDISH,
1049                          QDANISH = DANISH,
1050                          QFINNISH = FINNISH,
1051                          QDUTCH = DUTCH,
1052                          QFRENCH = FRENCH,
1053                          QGERMAN = GERMAN,
1054                          QITALIAN = ITALIAN,
1055                          QSPANISH = SPANISH)  ;
1056     idxvol = IDXVOL  ;
1057     status = STATUS  ;
1058   <START-CODE>
1059     char   hostname[BIGBUF];
1060     char **tossline = toss;
1061     char  *mb_language, *mb_charset;
1062     long   timeStamp;
1063
1064     ModifyEntities(); /* convert SDATA [......] to <spc name="[......]"> */
1065
1066     if (!getenv("_DTHELPTAG_NO_UNIQUE_ID"))
1067         {
1068         hostname[sizeof(hostname)-1] = '\0';
1069         gethostname(hostname, sizeof(hostname)-1);
1070
1071         docId = mb_malloc(strlen(hostname)+1);
1072         strcpy(docId, hostname);
1073
1074         timeStamp = time(0);
1075         }
1076     else
1077         {
1078         docId = "test";
1079         timeStamp = 0;
1080         }
1081
1082
1083     thisnodelevel = 0;
1084     fprintf(outfile,
1085             "<SDLDOC %s=\"%s\" %s=\"%s\" %s=\"%ld\" %s=\"%s-%s\"",
1086             "PUB-ID",
1087             pubId,
1088             "DOC-ID",
1089             docId,
1090             "TIMESTMP",
1091             timeStamp,
1092             "FIRST-PAGE",
1093             sdlReservedName,
1094             "HOMETOPIC");
1095     if (helplang)
1096         {
1097         mb_language = MakeMByteString(helplang);
1098         fprintf(outfile, " %s=\"%s\"", "LANGUAGE", mb_language);
1099         mb_free(&mb_language);
1100         }
1101     if (helpcharset)
1102         {
1103         mb_charset = MakeMByteString(helpcharset);
1104         fprintf(outfile, " %s=\"%s\"", "CHARSET", mb_charset);
1105         mb_free(&mb_charset);
1106         }
1107     fprintf(outfile, " %s=\"%s\">\n", "SDLDTD", "1.1.1");
1108     fprintf(outfile, "<VSTRUCT DOC-ID=\"%s\">\n", docId);
1109     fputs("<LOIDS>\n</LOIDS>\n", outfile);
1110     IncludeToss();
1111     fputs("</VSTRUCT>\n", outfile);
1112     snbstart = ftell(outfile);
1113   <END-CODE>
1114     assert_hometopic_exists();
1115     fputs("</SDLDOC>\n", outfile);
1116
1117 <ELEMENT HLINE>
1118   <START-CODE ABBREV>
1119     if (fabbrev) {
1120         if (newhline++) {
1121              fputs("&\n", outfile);
1122         }
1123       }
1124   <START-CODE CAPTION FIGURE>
1125     if (newhline++) 
1126       mb_shstring("\n",
1127                &svheadlen,
1128                (sizeof(savehead) / sizeof(M_WCHAR)),
1129                savehead,
1130                "Too many characters in head or caption",
1131                &hderr) ;
1132   <START-CODE HEAD CHAPHEAD, HEAD OTHERFRONT>
1133     if (newhline++) {
1134       fputs("  ", stderr) ;
1135       mb_strcode("\n", outfile) ;
1136       if (savid) shchar(' ',
1137                         &xstrlen,
1138                         (sizeof(xrefstring) / sizeof(M_WCHAR)),
1139                         xrefstring,
1140                         idstring,
1141                         "Too many characters in corresponding cross-reference",
1142                         &iderr) ;
1143       shchar(' ',
1144              &svheadlen,
1145              (sizeof(savehead) / sizeof(M_WCHAR)),
1146              savehead,
1147              svhdstring,
1148              "Too many characters in head or caption", 
1149              &hderr) ;
1150       }
1151   <START-CODE TITLE>
1152      if (newhline++) {
1153           fputs("\n", outfile) ;
1154      }
1155   <START-CODE HEAD P, HEAD IMAGE, HEAD LIST, HEAD LABLIST, HEAD EX, 
1156               HEAD SYNTAX>
1157     if (newhline++) fputc('\n', outfile) ;
1158   <END-CODE HEAD CHAPHEAD, 
1159             HEAD FRONTSUB, 
1160             HEAD OTHERFRONT,
1161             HEAD OTHERHEAD>
1162     putc('\n', stderr) ;
1163   <END-CODE HEAD ABSTRACT>
1164     putc('\n', stderr) ;
1165   <END-CODE>
1166
1167 <ELEMENT HOMETOPIC>
1168   <START-CODE>
1169     static char hometopic[] = "-HOMETOPIC";
1170     char id[SDLNAMESIZ+sizeof(hometopic)];
1171
1172     sprintf(id, "%s%s", sdlReservedName, hometopic);
1173     mb_starthelpnode("_HOMETOPIC", id, 1);
1174     nohometopic = FALSE;
1175   <END-CODE>
1176     CloseVirpage();
1177
1178 <ELEMENT HSEP>
1179   <PARAM>
1180     rule = RULE (QNORULE = NORULE,
1181                  QRULE = RULE,
1182                  QBLANK = BLANK) ;
1183
1184 <ELEMENT IDSECTION>
1185
1186 <ELEMENT IDX>
1187   <PARAM>
1188     main = MAIN ;
1189     range = RANGE (QBEGIN = BEGIN,
1190                    QEND = END) ;
1191   <START-CODE>
1192     print[0] = '\0';
1193     subprint[0] = '\0';
1194     sort[0] = '\0';
1195     subsort[0] = '\0';
1196   <END-CODE>
1197      /* ignore <idx end>'s in cache creek */
1198     if (!range || (range && m_wcmbupstrcmp(range, QEND)) )
1199         { /* sort field */
1200         char *mb_print, *mb_nospace1, *mb_nospace2, id[32];
1201         M_WCHAR *pwc, wnl, wsp;
1202
1203         mbtowc(&wnl, "\n", 1);
1204         mbtowc(&wsp, " ", 1);
1205
1206         pwc = print;
1207         while (pwc = w_strchr(pwc, wnl))
1208             *pwc = wsp;
1209         mb_print = MakeMByteString(print);
1210         if (w_strlen(sort) > 0)
1211             { /* use sort[] */
1212             char *mb_sort;
1213
1214             pwc = sort;
1215             while (pwc = w_strchr(pwc, wnl))
1216                 *pwc = wsp;
1217             mb_sort = MakeMByteString(sort);
1218             if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1219                 {
1220                 /* append subsort or subprint */
1221                 char *mb_sub;
1222                 M_WCHAR *pwcSub;
1223
1224                 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1225                 pwc = pwcSub;
1226                 while (pwc = w_strchr(pwc, wnl))
1227                     *pwc = wsp;
1228                 mb_sub = MakeMByteString(pwcSub);
1229
1230                 /* strip trailing spaces */
1231                 mb_nospace1 = mb_sort;
1232                 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1233                 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1234                 mb_nospace2 = mb_sub;
1235                 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1236                 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1237
1238                 /* strip leading spaces */
1239                 mb_nospace1 = mb_sort;
1240                 while (*mb_nospace1++ == ' '); --mb_nospace1;
1241                 mb_nospace2 = mb_sub;
1242                 while (*mb_nospace2++ == ' '); --mb_nospace2;
1243
1244                 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1245                 m_free(mb_sub,"multi-byte string");
1246                 }
1247             else
1248                 { /* plain sort */
1249                 /* strip trailing spaces */
1250                 mb_nospace1 = mb_sort;
1251                 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1252                 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1253
1254                 /* strip leading spaces */
1255                 mb_nospace1 = mb_sort;
1256                 while (*mb_nospace1++ == ' '); --mb_nospace1;
1257
1258                 fprintf(indexfp, "%s", mb_nospace1);
1259                 }
1260             m_free(mb_sort,"multi-byte string");
1261             }
1262         else
1263             { /* use print field */
1264             if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1265                 {
1266                 /* append subsort or subprint */
1267                 char *mb_sub;
1268                 M_WCHAR *pwcSub;
1269
1270                 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1271                 pwc = pwcSub;
1272                 while (pwc = w_strchr(pwc, wnl))
1273                     *pwc = wsp;
1274                 mb_sub = MakeMByteString(pwcSub);
1275
1276                 /* strip trailing spaces */
1277                 mb_nospace1 = mb_print;
1278                 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1279                 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1280                 mb_nospace2 = mb_sub;
1281                 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1282                 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1283
1284                 /* strip leading spaces */
1285                 mb_nospace1 = mb_print;
1286                 while (*mb_nospace1++ == ' '); --mb_nospace1;
1287                 mb_nospace2 = mb_sub;
1288                 while (*mb_nospace2++ == ' '); --mb_nospace2;
1289
1290                 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1291                 m_free(mb_sub,"multi-byte string");
1292                 }
1293             else
1294                 { /* plain print */
1295                 /* strip trailing spaces */
1296                 mb_nospace1 = mb_print;
1297                 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1298                 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1299
1300                 /* strip leading spaces */
1301                 mb_nospace1 = mb_print;
1302                 while (*mb_nospace1++ == ' '); --mb_nospace1;
1303
1304                 fprintf(indexfp, "%s", mb_nospace1);
1305                 }
1306             }
1307         putc('\036' /* ascii record separator */, indexfp);
1308
1309         /* print field */
1310         if (w_strlen(subprint) > 0)
1311             {
1312             char *mb_subprint;
1313
1314             pwc = subprint;
1315             while (pwc = w_strchr(pwc, wnl))
1316                 *pwc = wsp;
1317             mb_subprint = MakeMByteString(subprint);
1318
1319             /* strip trailing spaces */
1320             mb_nospace1 = mb_print;
1321             while (*mb_nospace1++); --mb_nospace1; /* end of string */
1322             while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1323             mb_nospace2 = mb_subprint;
1324             while (*mb_nospace2++); --mb_nospace2; /* end of string */
1325             while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1326
1327             /* strip leading spaces */
1328             mb_nospace1 = mb_print;
1329             while (*mb_nospace1++ == ' '); --mb_nospace1;
1330             mb_nospace2 = mb_subprint;
1331             while (*mb_nospace2++ == ' '); --mb_nospace2;
1332
1333             fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1334             m_free(mb_subprint,"multi-byte string");
1335             }
1336         else
1337             {
1338             /* strip trailing spaces */
1339             mb_nospace1 = mb_print;
1340             while (*mb_nospace1++); --mb_nospace1; /* end of string */
1341             while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1342
1343             /* strip leading spaces */
1344             mb_nospace1 = mb_print;
1345             while (*mb_nospace1++ == ' '); --mb_nospace1;
1346
1347             fprintf(indexfp, "%s", mb_nospace1);
1348             }
1349         m_free(mb_print,"multi-byte string");
1350         putc('\036' /* ascii record separator */, indexfp);
1351
1352         /* id field */
1353         if (inSdlP)
1354             {
1355             if (inParText)
1356                 {
1357                 sprintf(id, "%s%d", sdlReservedName, NextId());
1358                 fprintf(outfile, "<ANCHOR ID=\"%s\">", id);
1359                 fputs(id, indexfp);
1360                 fputs("\n", indexfp);
1361                 }
1362             else
1363                 {
1364                 if (!parTextId)
1365                     parTextId = NextId();
1366                 sprintf(id, "%s%d", sdlReservedName, parTextId);
1367                 fputs(id, indexfp);
1368                 fputs("\n", indexfp);
1369                 }
1370             }
1371         else if (*nodeid)
1372             {
1373             char *mb_nodeid;
1374
1375             mb_nodeid = MakeMByteString(nodeid);
1376             fputs(mb_nodeid, indexfp);
1377             fputs("\n", indexfp);
1378             m_free(mb_nodeid,"multi-byte string");
1379             }
1380         else
1381             fprintf(indexfp, "%s-HOMETOPIC\n", sdlReservedName);
1382         }
1383   <TEXT-CODE>
1384     indexchar(m_textchar) ;
1385
1386 <ELEMENT IMAGE>
1387   <PARAM>
1388     indent = INDENT ;
1389     id = ID;
1390     gentity = GENTITY  ;
1391     gposition = GPOSITION (QLEFT = LEFT,
1392                            QRIGHT = RIGHT) ;
1393     ghyperlink = GHYPERLINK  ;
1394     glinktype = GLINKTYPE (QJUMP = JUMP,
1395                            QJUMPNEWVIEW = JUMPNEWVIEW,
1396                            QDEFINITION = DEFINITION,
1397                            QEXECUTE = EXECUTE,
1398                            QAPPDEFINED = APPDEFINED,
1399                            QMAN = MAN) ;
1400     gdescription = GDESCRIPTION  ;
1401   /*
1402     <C variable> = NUMBER ;
1403   */
1404   <START-CODE>
1405     indentp = indent;
1406     imagegentityp = gentity;
1407     imagegpositionp = gposition;
1408     imageghyperlinkp = ghyperlink;
1409     imageglinktypep = glinktype;
1410     imagegdescription = gdescription;
1411
1412     if (!inBlock)
1413         StartBlock(NULL, NULL, NULL);
1414
1415     inSdlP = TRUE;
1416     fputs("<P TYPE=\"LITERAL\"", outfile);
1417     if (id) {
1418       if (imageId)
1419           m_free(imageId,"multi-byte string");
1420       imageId = MakeMByteString(id);
1421       fprintf(outfile, " ID=\"%s\"", imageId);
1422       savid = checkid(id);
1423     }
1424     fputs(" SSI=\"IMAGE", outfile);
1425     if (indentp)
1426         {
1427         fputs("-INDENT", outfile);
1428         }
1429     fputs("\">", outfile);
1430   <END-CODE>
1431     inSdlP = FALSE;
1432     fputs("</P>\n", outfile);
1433   <TEXT-CODE>
1434     imoutchar(m_textchar) ;
1435
1436 <ELEMENT IMAGETEXT>
1437   <START-CODE>
1438      M_WCHAR *wc_image;
1439
1440      wc_image = MakeWideCharString("IMAGE");
1441      handle_link_and_graphic(wc_image,
1442                              imagegentityp,
1443                              imagegpositionp,
1444                              imageghyperlinkp,
1445                              imageglinktypep,
1446                              imagegdescription);
1447      m_free(wc_image,"wide character string");
1448
1449 <ELEMENT INDEXPRIMARY>
1450   <START-CODE>
1451     idxsavlen = 0; 
1452     didsort = FALSE;
1453   <END-CODE>
1454     /* capture saved term unless <sort> got it already */
1455     if (! didsort) {
1456          idxsav[idxsavlen] = M_EOS;
1457          w_strcpy(print, idxsav);
1458         
1459     }
1460     else { /* save the sort field */
1461          idxsav[idxsavlen] = M_EOS;
1462          w_strcpy(sort, idxsav);
1463     }
1464
1465 <ELEMENT INDEXSUB>
1466   <START-CODE>
1467     idxsavlen = 0; 
1468     didsubsort = FALSE;
1469   <END-CODE>
1470     /* capture saved term unless <sort> got it already */
1471     if (! didsubsort) {
1472          idxsav[idxsavlen] = M_EOS;
1473          w_strcpy(subprint, idxsav);
1474     }
1475     else { /* save the sort field */
1476          idxsav[idxsavlen] = M_EOS;
1477          w_strcpy(subsort, idxsav);
1478     }
1479
1480
1481 <ELEMENT INPUT.....>
1482   <START-CODE>
1483     if (echo) mb_echohead("``") ;
1484   <TEXT-CODE>
1485   <END-CODE>
1486     if (echo) mb_echohead("''") ;
1487
1488 <ELEMENT ITEM>
1489   <PARAM>
1490     id = ID ;
1491   <START-CODE LIST>
1492     if (lastlist->lastlist->type == PLAIN) {
1493       leaderok = TRUE ;   /* allow <LEADER> only in <LIST PLAIN> */
1494       }
1495     Item(id) ;
1496   <END-CODE LIST>
1497     leaderok = FALSE ;
1498
1499 <ELEMENT KEYCAP>
1500   <START-CODE>
1501     /* also does special handling for calculator--supers/subs */
1502     /*handles super and subs in keys */
1503     mb_strcode("<KEY CLASS=\"MACH-CONT\">", outfile) ;
1504     if (echo) mb_echohead("[[") ;
1505   <END-CODE>
1506     mb_strcode("</KEY>", outfile) ;
1507     if (echo) mb_echohead("]]") ;
1508   <TEXT-CODE>
1509      esoutchar(m_textchar) ;
1510
1511   <START-CODE * IDX>
1512     indexchar('[');
1513   <END-CODE * IDX>
1514     indexchar(']');
1515   <TEXT-CODE * IDX>
1516     indexchar(m_textchar) ;
1517
1518 <ELEMENT KEYS>
1519
1520 <ELEMENT LABEL>
1521   <START-CODE>
1522     char *first, *loose, *wrap;
1523
1524     first = "";
1525     if (listitems[list].firstitem)
1526         {
1527         first = "FIRST-";
1528         if (needFData)
1529             {
1530             fputs("<FDATA>\n", outfile);
1531             needFData = FALSE;
1532             }
1533         }
1534     loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1535     wrap  = (listitems[list].longlabel == WRAP) ? "" : " TYPE=\"LINED\"";
1536     labelid[list] = NextId();
1537     fprintf(outfile,
1538             "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"%s%s-LABEL\">\n",
1539             sdlReservedName,
1540             labelid[list],
1541             first,
1542             loose);
1543     fprintf(outfile, "<P%s>", wrap);
1544   <END-CODE>
1545     char *first, *loose;
1546     char  ssi[BIGBUF], labelId[BIGBUF];
1547
1548     fputs("</P>\n</BLOCK>\n", outfile);
1549
1550     first = "";
1551     if (listitems[list].firstitem)
1552         {
1553         first = "FIRST-";
1554         listitems[list].firstitem = FALSE;
1555         }
1556     loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1557     sprintf(ssi, "%s%s", first, loose);
1558
1559     sprintf(labelId, "%s%d", sdlReservedName, labelid[list]);
1560
1561     PushForm2("ITEM", ssi, labelId, NULL);
1562
1563 <ELEMENT LABH>
1564   <START-CODE>
1565     if (listitems[list].firstitem)
1566         {
1567         listitems[list].firstitem = FALSE;
1568         }
1569     labhid[list] = NextId();
1570     if (needFData)
1571         {
1572         fputs("<FDATA>\n", outfile);
1573         needFData = FALSE;
1574         }
1575     fprintf(outfile,
1576             "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABH-%s\">\n",
1577             sdlReservedName,
1578             labhid[list],
1579             lablisttight[list] ? "TIGHT" : "LOOSE");
1580     fputs("<P TYPE=\"LINED\">", outfile);
1581   <END-CODE>
1582     fputs("</P>\n</BLOCK>\n", outfile);
1583
1584 <ELEMENT LABHTEXT>
1585   <START-CODE>
1586     labhtextid[list] = NextId();
1587     fprintf(outfile,
1588             "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABHTEXT-%s\">\n",
1589             sdlReservedName,
1590             labhtextid[list],
1591             lablisttight[list] ? "TIGHT" : "LOOSE");
1592     fputs("<P TYPE=\"LINED\">", outfile);
1593   <END-CODE>
1594     char labh_id[SDLNAMESIZ + 10], labhtext_id[SDLNAMESIZ + 10];
1595
1596     fputs("</P>\n</BLOCK>\n", outfile);
1597
1598     strcpy(labh_id, sdlReservedName);
1599     m_itoa(labhid[list], labh_id + SDLNAMESIZ - 1);
1600     strcpy(labhtext_id, sdlReservedName);
1601     m_itoa(labhtextid[list], labhtext_id + SDLNAMESIZ - 1);
1602     Add2ToRowVec(&formStackTop->vecLen,
1603                  &formStackTop->rowVec,
1604                  labh_id,
1605                  labhtext_id);
1606
1607 <ELEMENT LABHEADS>
1608
1609 <ELEMENT LABLIST>
1610   <PARAM>
1611     longlabel = LONGLABEL (QWRAP = WRAP,
1612                            QNOWRAP = NOWRAP) ;
1613     width = WIDTH ;
1614     spacing = SPACING (QTIGHT = TIGHT,
1615                        QLOOSE = LOOSE) ;
1616   <START-CODE>
1617     StartLabList(spacing, longlabel);
1618   <END-CODE>
1619     PopForm2();
1620     list--;
1621
1622 <ELEMENT LEADER>
1623   <PARAM>
1624     type = TYPE (QSPACE = SPACE,
1625                  QDOTS = DOTS) ;
1626   <START-CODE>
1627     if (leaderok==TRUE)
1628         {
1629         if (! m_wcmbupstrcmp(type, QDOTS))
1630             {
1631             }
1632         else if (! m_wcmbupstrcmp(type, QSPACE))
1633             {
1634             }
1635         else
1636             {
1637             M_WCHAR *wc_stago, *wc_tagc;
1638
1639             wc_stago = MakeWideCharString(m_stago);
1640             wc_tagc  = MakeWideCharString(m_tagc);
1641             m_err2("Internal error: element %sLEADER%s in tex.if",
1642                    wc_stago,
1643                    wc_tagc) ;
1644             m_free(wc_stago,"wide character string");
1645             m_free(wc_tagc,"wide character string");
1646             }
1647         }
1648     else
1649         {
1650         M_WCHAR *wc_stago, *wc_tagc;
1651
1652         wc_stago = MakeWideCharString(m_stago);
1653         wc_tagc  = MakeWideCharString(m_tagc);
1654         m_err4("%sLEADER%s only allowed in %sLIST PLAIN%s",
1655                wc_stago,
1656                wc_tagc,
1657                wc_stago,
1658                wc_tagc) ;
1659         m_free(wc_stago,"wide character string");
1660         m_free(wc_tagc,"wide character string");
1661         }
1662
1663 <ELEMENT LINENO>
1664   <PARAM>
1665     id = ID ;
1666   <START-CODE>
1667     char mb_xrefstring[400];
1668
1669     if (! tonumexlines) 
1670       m_error(
1671     "Preparing cross-reference to a line in an example without line numbers"
1672       ) ;
1673     sprintf(mb_xrefstring, "%d", exLineNum) ;
1674     mbstowcs(xrefstring, mb_xrefstring, 400);
1675     xstrlen = w_strlen(xrefstring) ;
1676     m_getline(&xrffile, &xrfline) ;
1677     if (xrffile == NULL) {
1678            /* set to primary input */
1679            xrffile = inputname;
1680     }
1681     setid(id,
1682           TRUE,
1683           FALSE,
1684           inchapter,
1685           chapstring,
1686           xrffile,
1687           xrfline,
1688           TRUE) ;
1689     {
1690     char *mb_id, buffer[BIGBUF];
1691
1692     mb_id = MakeMByteString(id);
1693     sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1694     mb_strcode(buffer, outfile);
1695     m_free(mb_id,"multi-byte string");
1696     }
1697
1698 <ELEMENT LINK>
1699   <PARAM>
1700      hyperlink = HYPERLINK  ;
1701      type = TYPE (QJUMP = JUMP,
1702                   QJUMPNEWVIEW = JUMPNEWVIEW,
1703                   QDEFINITION = DEFINITION,
1704                   QEXECUTE = EXECUTE,
1705                   QAPPDEFINED = APPDEFINED,
1706                   QMAN = MAN) ;
1707      description = DESCRIPTION  ;
1708   <START-CODE>
1709      HandleLink(hyperlink, type, description);
1710   <END-CODE>
1711      /* reset link type to default.  This is braindead, but enough.
1712
1713         E.g.,
1714
1715            <link foo DEFINITION><XREF bar><\link> 
1716
1717         will do the right thing (remember that xref turns to an implicit link).
1718         Right_thing => xref becomes definition link.
1719
1720         However, in
1721
1722            <link foo DEFINITION> <link fub> Test <\link> <xref bar> <\link>
1723
1724         the xref will think that is supposed to become a link of type jump,
1725         not definition.  This case is odd, so we won't worry about it.
1726      */
1727      global_linktype = 0; 
1728      mb_strcode("</LINK>", outfile);
1729
1730 <ELEMENT LIST>
1731   <PARAM>
1732     type = TYPE (QORDER = ORDER,
1733                  QBULLET = BULLET,
1734                  QPLAIN = PLAIN,
1735                  QMILSPEC = MILSPEC,
1736                  QCHECK = CHECK) ;
1737     order = ORDERTYPE (QUALPHA = UALPHA,
1738                        QLALPHA = LALPHA,
1739                        QARABIC = ARABIC,
1740                        QUROMAN = UROMAN,
1741                        QLROMAN = LROMAN) ;
1742     spacing = SPACING (QTIGHT = TIGHT,
1743                        QLOOSE = LOOSE) ;
1744     cont = CONTINUE ;
1745   <START-CODE>
1746     StartList(type, order, spacing, cont) ;
1747   <END-CODE>
1748     EndList();
1749
1750 <ELEMENT LOCATION>
1751   <PARAM>
1752     id = ID  ;
1753   <START-CODE>
1754     if (id)
1755         {
1756         char *mb_id;
1757         char buffer[BIGBUF];
1758
1759         mb_id = MakeMByteString(id);
1760         sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1761         mb_strcode(buffer, outfile);
1762         m_free(mb_id,"multi-byte string");
1763
1764         savid = checkid(id);
1765         }
1766   <END-CODE>
1767     if (savid)
1768         {
1769         mb_shchar(M_EOS,
1770                   &xstrlen,
1771                   (sizeof(xrefstring) / sizeof(M_WCHAR)),
1772                   xrefstring,
1773                   idstring,
1774                   "Too many characters in corresponding cross-reference",
1775                   &iderr);
1776         setid(savid,
1777               TRUE,
1778               TRUE,
1779               inchapter,
1780               chapstring,
1781               xrffile,
1782               xrfline,
1783               TRUE);
1784         }
1785
1786 <ELEMENT MEMO>
1787   <TEXT-CODE>
1788     if (memo && inSdlP)
1789         {
1790         if (m_textchar == '"')
1791             { /* handle funny quote in memo bug */
1792             }
1793         else
1794             {
1795             outchar(m_textchar, outfile);
1796             }
1797         }
1798   <PI-CODE>
1799     /* could need to handle calculator context sensitive entities
1800      * here if needed to reduce tex macro count 
1801      */
1802     if (memo)
1803         {
1804         outpi(m_enttype, m_pi, m_entname) ;
1805         }
1806
1807 <ELEMENT MESSAGE>
1808   <PARAM>
1809     include = INCLUDE  ;
1810     exclude = EXCLUDE  ;
1811   <START-CODE>
1812     thisnodelevel = 2;
1813     mb_starthelpnode("MESSAGE", "", thisnodelevel);
1814     chapst = FALSE ;
1815     fprintf(stderr, "\nMessages.\n") ;
1816     emsghead = DEFHEAD ;
1817   <END-CODE>
1818     CloseVirpage();
1819     thisnodelevel = 0;
1820
1821 <ELEMENT METAINFO>
1822
1823 <ELEMENT MSG>
1824   <START-CODE>
1825     PushForm(NULL, "MSG", NULL);
1826     checkmsghead() ;
1827   <END-CODE>
1828     PopForm();
1829
1830 <ELEMENT MSGNUM>
1831   <START-CODE>
1832     fputs("<HEAD SSI=\"MSGNUM\">", outfile);
1833   <END-CODE>
1834     fputs("</HEAD>\n", outfile);
1835
1836 <ELEMENT MSGSUB>
1837   <PARAM>
1838     include = INCLUDE  ;
1839     exclude = EXCLUDE  ;
1840   <START-CODE>
1841     PushForm(NULL, NULL, NULL);
1842     checkmsghead() ;
1843     chapst = TRUE ;
1844     savid = checkid(NULL) ; /* hook for possible future ID */
1845     iderr = FALSE ;
1846   <END-CODE>
1847     PopForm();
1848
1849 <ELEMENT MSGTEXT>
1850   <START-CODE>
1851     inSdlP = TRUE;
1852     StartBlock(NULL, "MSGTEXT", NULL);
1853     fputs("<P>", outfile);
1854   <END-CODE>
1855     inSdlP = FALSE;
1856     fputs("</P>\n", outfile);
1857
1858 <ELEMENT NEED>
1859   <PARAM>
1860     type = TYPE (QBEGIN = BEGIN,
1861                  QEND = END,
1862                  QTOGETHER = TOGETHER) ;
1863     depth = AMOUNT ;
1864
1865 <ELEMENT NEWLINE>
1866   <START-CODE>
1867       fputs("&\n", outfile) ;
1868   <START-CODE * ABSTRACT>
1869       fputs("&\n", outfile) ;
1870
1871 <ELEMENT NEWPAGE>
1872
1873 <ELEMENT NOTE>
1874   <START-CODE>
1875     StartNCW("NOTE");
1876
1877 <ELEMENT NUMBER>
1878   <START-CODE * IDX>
1879   <END-CODE * IDX>
1880   <TEXT-CODE * IDX>
1881     indexchar(m_textchar) ;
1882
1883   <TEXT-CODE * EXAMPLESEG, * IMAGE>
1884     outchar(m_textchar, outfile) ;
1885
1886 <ELEMENT OPTBLOCK>
1887   <START-CODE>
1888     synelcnt = 0;
1889     fputs("[", outfile);
1890   <END-CODE>
1891     fputs("]", outfile);
1892
1893
1894 <ELEMENT OTHERFRONT>
1895   <PARAM>
1896     id = ID  ;
1897     include = INCLUDE  ;
1898     exclude = EXCLUDE  ;
1899   <START-CODE>
1900      char    *mb_id;
1901
1902      if (!id)
1903          mb_id = NULL;
1904      else
1905          mb_id = MakeMByteString(id);
1906      mb_starthelpnode("METAINFO", mb_id, 0);
1907      if (mb_id)
1908          m_free(mb_id, "multi-byte string");
1909      had_an_otherfront_head = FALSE;
1910      savid = checkid(id) ;
1911      iderr = FALSE ;
1912   <END-CODE>
1913     CloseVirpage();
1914      if (id && !had_an_otherfront_head) {
1915         m_errline("You must use a <HEAD> tag after <OTHERFRONT>\n");
1916      }
1917
1918 <ELEMENT OTHERHEAD>
1919   <START-CODE>
1920     PushForm(NULL, "OTHERHEAD", NULL);
1921   <END-CODE>
1922     PopFormMaybe();
1923
1924 <ELEMENT OUTPUT....>
1925   <START-CODE>
1926     if (echo) mb_echohead("``") ;
1927   <TEXT-CODE>
1928   <END-CODE>
1929     if (echo) mb_echohead("''") ;
1930
1931 <ELEMENT P>
1932   <PARAM>
1933     indent = INDENT ;
1934     id = ID;
1935     gentity = GENTITY  ;
1936     gposition = GPOSITION (QLEFT = LEFT,
1937                            QRIGHT = RIGHT) ;
1938     ghyperlink = GHYPERLINK  ;
1939     glinktype = GLINKTYPE (QJUMP = JUMP,
1940                            QJUMPNEWVIEW = JUMPNEWVIEW,
1941                            QDEFINITION = DEFINITION,
1942                            QEXECUTE = EXECUTE,
1943                            QAPPDEFINED = APPDEFINED,
1944                            QMAN = MAN) ;
1945     gdescription = GDESCRIPTION  ;
1946   <START-CODE>
1947     paragraph(indent,
1948               id,
1949               gentity,
1950               gposition,
1951               ghyperlink,
1952               glinktype,
1953               gdescription);
1954   <END-CODE>
1955     inSdlP = FALSE;
1956     fputs("\n</P>\n", outfile);
1957
1958 <ELEMENT PARM>
1959   <START-CODE>
1960     if (echo) {
1961       mb_echohead(m_stago) ;
1962       echohead(m_parent(0)) ;
1963       mb_echohead(m_net) ; /* '|' */
1964       }
1965   <END-CODE>
1966     if (echo) mb_echohead(m_net) ; /* '|' */
1967
1968   <START-CODE * IDX>
1969     /* We perhaps should allow <parm> to be used in <idx>.
1970        Since we are now dependent on LaserROM, we just can't
1971        add it in (as an inclusion exception to idx). 
1972        So, we take out the code that would inplement it and
1973        give an error message. */
1974
1975     M_WCHAR *wc_stago, *wc_tagc;
1976
1977     wc_stago = MakeWideCharString(m_stago);
1978     wc_tagc  = MakeWideCharString(m_tagc);
1979     m_err4("%sPARM%s not allowed in %sIDX%s.",
1980            wc_stago,
1981            wc_tagc,
1982            wc_stago,
1983            wc_tagc);
1984     m_free(wc_stago,"wide character string");
1985     m_free(wc_tagc,"wide character string");
1986   <END-CODE * IDX>
1987   <TEXT-CODE * IDX>
1988     indexchar(m_textchar) ;
1989   <START-CODE * CHAPHEAD>
1990     M_WCHAR *wc_stago, *wc_tagc;
1991
1992     wc_stago = MakeWideCharString(m_stago);
1993     wc_tagc  = MakeWideCharString(m_tagc);
1994     m_err2("%sPARM%s not allowed in headings.", wc_stago, wc_tagc);
1995     m_free(wc_stago,"wide character string");
1996     m_free(wc_tagc,"wide character string");
1997   <END-CODE * CHAPHEAD>
1998
1999   <END-CODE * EXAMPLESEG, * IMAGE>
2000     POPFONT ;
2001
2002 <ELEMENT PARTEXT>
2003   <START-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
2004   <START-CODE P>
2005     savid = NULL; /* in case there was no head */
2006     inParText++;
2007     if (tooutput)
2008         EmitSavedAnchors();
2009   <START-CODE>
2010     inParText++;
2011     if (tooutput)
2012         EmitSavedAnchors();
2013   <END-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
2014   <END-CODE>
2015     --inParText;
2016
2017 <ELEMENT PROCEDURE>
2018   <START-CODE>
2019     PushForm("TEXT", "PROCEDURE", NULL);
2020   <END-CODE>
2021     PopFormMaybe();
2022   
2023 <ELEMENT QUOTE>
2024   <START-CODE * ABBREV>
2025     mb_strcode("``", outfile) ;
2026     if (echo) putc('"', stderr) ;
2027   <START-CODE>
2028     mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"OPEN\"></KEY>", outfile) ;
2029     if (echo) putc('"', stderr) ;
2030   <END-CODE * ABBREV>
2031     mb_strcode("''", outfile) ;
2032     if (echo) putc('"', stderr) ;
2033   <END-CODE>
2034     mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"CLOSE\"></KEY>", outfile) ;
2035     if (echo) putc('"', stderr) ;
2036
2037   <START-CODE * IDX>
2038     indexchar('\"') ;
2039   <END-CODE * IDX>
2040     indexchar('\"') ;
2041   <TEXT-CODE * IDX>
2042     indexchar(m_textchar) ;
2043
2044 <ELEMENT REFERENCES>
2045
2046 <ELEMENT REQBLOCK>
2047   <START-CODE>
2048     synelcnt = 0;
2049     fputs("{", outfile);
2050   <END-CODE>
2051     fputs("}", outfile);
2052
2053 <ELEMENT RSECT>
2054   <PARAM>
2055     id = ID ;
2056     pagebreak = PAGEBREAK (QNEWPAGE = NEWPAGE,
2057                            QSAMEPAGE = SAMEPAGE) ;
2058     include = INCLUDE  ;
2059     exclude = EXCLUDE  ;
2060   <START-CODE>
2061     M_WCHAR *wc_rsect, *wc_helpvolume;
2062
2063     wc_rsect      = MakeWideCharString("RSECT");
2064     wc_helpvolume = MakeWideCharString("HELPVOLUME");
2065
2066
2067     assert_hometopic_exists();
2068     if (!rsectseq) thisnodelevel = thisnodelevel + 1;
2069     if (w_strcmp(m_parent(1), wc_helpvolume) != 0)
2070         {
2071         CloseVirpage();
2072         starthelpnode(wc_rsect, id, thisnodelevel);
2073         }
2074     else
2075         starthelpnode(wc_rsect, id, 2);
2076     m_free(wc_rsect, "wide character string");
2077     m_free(wc_helpvolume, "wide character string");
2078     rsectstart(id) ;
2079   <END-CODE>
2080     M_WCHAR *wc_helpvolume;
2081
2082     wc_helpvolume = MakeWideCharString("HELPVOLUME");
2083     if (w_strcmp(m_parent(1), wc_helpvolume) == 0)
2084         CloseVirpage();
2085     m_free(wc_helpvolume, "wide character string");
2086
2087 <ELEMENT RSUB>
2088   <PARAM>
2089     include = INCLUDE  ;
2090     exclude = EXCLUDE  ;
2091   <START-CODE>
2092     PushForm(NULL, NULL, NULL);
2093   <START-CODE * S2>
2094     PushForm(NULL, NULL, NULL);
2095   <END-CODE>
2096     PopFormMaybe();
2097
2098 <ELEMENT S1>
2099   <PARAM>
2100     id = ID ;
2101     include = INCLUDE  ;
2102     exclude = EXCLUDE  ;
2103   <START-CODE HELPVOLUME>
2104     M_WCHAR *wc_s1;
2105
2106     wc_s1 = MakeWideCharString("S1");
2107
2108     assert_hometopic_exists();
2109     thisnodelevel = 2;
2110     starthelpnode(wc_s1, id, thisnodelevel);
2111     m_free(wc_s1, "wide character string");
2112     rsectseq = FALSE ;
2113     chapst = TRUE ;
2114     savid = checkid(id) ;
2115     iderr = FALSE ;
2116   <START-CODE>
2117     M_WCHAR *wc_s1;
2118
2119     wc_s1 = MakeWideCharString("S1");
2120
2121     assert_hometopic_exists();
2122     thisnodelevel++;
2123     CloseVirpage();
2124     starthelpnode(wc_s1, id, thisnodelevel);
2125     m_free(wc_s1, "wide character string");
2126     rsectseq = FALSE ;
2127     chapst = TRUE ;
2128     savid = checkid(id) ;
2129     iderr = FALSE ;
2130   <END-CODE HELPVOLUME>
2131     CloseVirpage();
2132     rseqend() ;
2133     thisnodelevel = 0;
2134   <END-CODE>
2135     rseqend() ;
2136     --thisnodelevel;
2137
2138 <ELEMENT S2>
2139   <PARAM>
2140     id = ID ;
2141     include = INCLUDE  ;
2142     exclude = EXCLUDE  ;
2143   <START-CODE>
2144     M_WCHAR *wc_s2;
2145
2146     wc_s2 = MakeWideCharString("S2");
2147
2148     thisnodelevel++;
2149     CloseVirpage();
2150     starthelpnode(wc_s2, id, thisnodelevel);
2151     m_free(wc_s2, "wide character string");
2152     rsectseq = FALSE ;
2153     savid = checkid(id) ;
2154     iderr = FALSE ;
2155   <END-CODE>
2156     rseqend() ;
2157     --thisnodelevel;
2158
2159 <ELEMENT S3>
2160   <PARAM>
2161     id = ID ;
2162     include = INCLUDE  ;
2163     exclude = EXCLUDE  ;
2164   <START-CODE>
2165     M_WCHAR *wc_s3;
2166
2167     wc_s3 = MakeWideCharString("S3");
2168
2169     thisnodelevel++;
2170     CloseVirpage();
2171     starthelpnode(wc_s3, id, thisnodelevel);
2172     m_free(wc_s3, "wide character string");
2173     rsectseq = FALSE ;
2174     savid = checkid(id) ;
2175     iderr = FALSE ;
2176   <END-CODE>
2177     rseqend() ;
2178     --thisnodelevel;
2179
2180 <ELEMENT S4>
2181   <PARAM>
2182     id = ID ;
2183     include = INCLUDE  ;
2184     exclude = EXCLUDE  ;
2185   <START-CODE>
2186     M_WCHAR *wc_s4;
2187
2188     wc_s4 = MakeWideCharString("S4");
2189
2190     thisnodelevel++;
2191     CloseVirpage();
2192     starthelpnode(wc_s4, id, thisnodelevel);
2193     m_free(wc_s4, "wide character string");
2194     rsectseq = FALSE ;
2195     savid = checkid(id) ;
2196     iderr = FALSE ;
2197   <END-CODE>
2198     rseqend() ;
2199     --thisnodelevel;
2200
2201 <ELEMENT S5>
2202   <PARAM>
2203     id = ID ;
2204     include = INCLUDE  ;
2205     exclude = EXCLUDE  ;
2206   <START-CODE>
2207     M_WCHAR *wc_s5;
2208
2209     wc_s5 = MakeWideCharString("S5");
2210
2211     thisnodelevel++;
2212     CloseVirpage();
2213     starthelpnode(wc_s5, id, thisnodelevel);
2214     m_free(wc_s5, "wide character string");
2215     rsectseq = FALSE ;
2216     savid = checkid(id) ;
2217     iderr = FALSE ;
2218   <END-CODE>
2219     rseqend() ;
2220     --thisnodelevel;
2221
2222 <ELEMENT S6>
2223   <PARAM>
2224     id = ID ;
2225     include = INCLUDE  ;
2226     exclude = EXCLUDE  ;
2227   <START-CODE>
2228     M_WCHAR *wc_s6;
2229
2230     wc_s6 = MakeWideCharString("S6");
2231
2232     thisnodelevel++;
2233     CloseVirpage();
2234     starthelpnode(wc_s6, id, thisnodelevel);
2235     m_free(wc_s6, "wide character string");
2236     rsectseq = FALSE ;
2237     savid = checkid(id) ;
2238     iderr = FALSE ;
2239   <END-CODE>
2240     rseqend() ;
2241     --thisnodelevel;
2242
2243 <ELEMENT S7>
2244   <PARAM>
2245     id = ID ;
2246     include = INCLUDE  ;
2247     exclude = EXCLUDE  ;
2248   <START-CODE>
2249     M_WCHAR *wc_s7;
2250
2251     wc_s7 = MakeWideCharString("S7");
2252
2253     thisnodelevel++;
2254     CloseVirpage();
2255     starthelpnode(wc_s7, id, thisnodelevel);
2256     m_free(wc_s7, "wide character string");
2257     rsectseq = FALSE ;
2258     savid = checkid(id) ;
2259     iderr = FALSE ;
2260   <END-CODE>
2261     rseqend() ;
2262     --thisnodelevel;
2263
2264 <ELEMENT S8>
2265   <PARAM>
2266     id = ID ;
2267     include = INCLUDE  ;
2268     exclude = EXCLUDE  ;
2269   <START-CODE>
2270     M_WCHAR *wc_s8;
2271
2272     wc_s8 = MakeWideCharString("S8");
2273
2274     thisnodelevel++;
2275     CloseVirpage();
2276     starthelpnode(wc_s8, id, thisnodelevel);
2277     m_free(wc_s8, "wide character string");
2278     rsectseq = FALSE ;
2279     savid = checkid(id) ;
2280     iderr = FALSE ;
2281   <END-CODE>
2282     rseqend() ;
2283     --thisnodelevel;
2284
2285 <ELEMENT S9>
2286   <PARAM>
2287     id = ID ;
2288     include = INCLUDE  ;
2289     exclude = EXCLUDE  ;
2290   <START-CODE>
2291     M_WCHAR *wc_s9;
2292
2293     wc_s9 = MakeWideCharString("S9");
2294
2295     thisnodelevel++;
2296     CloseVirpage();
2297     starthelpnode(wc_s9, id, thisnodelevel);
2298     m_free(wc_s9, "wide character string");
2299     rsectseq = FALSE ;
2300     savid = checkid(id) ;
2301     iderr = FALSE ;
2302   <END-CODE>
2303     rseqend() ;
2304     --thisnodelevel;
2305
2306 <ELEMENT SORT>
2307   <START-CODE INDEXPRIMARY>
2308      didsort = TRUE;
2309      idxsav[idxsavlen] = M_EOS;
2310      w_strcpy(print, idxsav);
2311      idxsavlen = 0;
2312   <END-CODE INDEXPRIMARY>
2313      idxsav[idxsavlen] = M_EOS;
2314      w_strcpy(sort, idxsav);
2315   <START-CODE INDEXSUB>
2316      didsubsort = TRUE;
2317      idxsav[idxsavlen] = M_EOS;
2318      w_strcpy(subprint, idxsav);
2319      idxsavlen = 0;
2320   <END-CODE INDEXSUB>
2321      idxsav[idxsavlen] = M_EOS;
2322      w_strcpy(subsort, idxsav);
2323   <START-CODE>
2324   <END-CODE>
2325
2326 <ELEMENT SUB>
2327   <START-CODE * IDX>
2328   <START-CODE>
2329     mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUB\">", outfile);
2330     mb_strcode("<SPHRASE CLASS=\"SUB\">", outfile);
2331     if (echo) mb_echohead("__") ;
2332   <END-CODE * IDX>
2333   <END-CODE>
2334     mb_strcode("</SPHRASE></KEY>", outfile);
2335     if (echo) mb_echohead("__") ;
2336   <TEXT-CODE * COMPUTER>
2337      outchar(m_textchar, outfile) ;
2338   <TEXT-CODE * IDX>
2339     indexchar(m_textchar) ;
2340   <TEXT-CODE * IMAGE>
2341     outchar(m_textchar, outfile) ;
2342
2343 <ELEMENT SUPER>
2344   <START-CODE * IDX>
2345   <START-CODE>
2346     mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUPER\">", outfile);
2347     mb_strcode("<SPHRASE CLASS=\"SUPER\">", outfile);
2348     if (echo) mb_echohead("^^") ;
2349   <END-CODE * IDX>
2350   <END-CODE>
2351     mb_strcode("</SPHRASE></KEY>", outfile);
2352     if (echo) mb_echohead("^^") ;
2353   <TEXT-CODE * COMPUTER>
2354      outchar(m_textchar, outfile) ;
2355   <TEXT-CODE * IDX>
2356     indexchar(m_textchar) ;
2357   <TEXT-CODE * IMAGE>
2358      outchar(m_textchar, outfile) ;
2359
2360 <ELEMENT SYNEL>
2361   <START-CODE OPTBLOCK, REQBLOCK>
2362     if (synelcnt++) {
2363         fputs("\n", outfile);
2364     }
2365   <END-CODE OPTBLOCK, REQBLOCK>
2366   <END-CODE>
2367     fputs("\n", outfile);
2368   <TEXT-CODE>
2369      outchar(m_textchar, outfile) ;
2370
2371 <ELEMENT SYNTAX>
2372   <START-CODE>
2373     inSdlP = TRUE;
2374     if (!inBlock)
2375         StartBlock(NULL, NULL, NULL);
2376     fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"SYNTAX\">");
2377   <END-CODE>
2378     inSdlP = FALSE;
2379     fputs("</P>\n", outfile);
2380   <TEXT-CODE>
2381     outchar(m_textchar, outfile) ;
2382
2383 <ELEMENT TERM>
2384   <PARAM>
2385     base = BASE ;
2386     gloss = GLOSS (QGLOSS = GLOSS,
2387                    QNOGLOSS = NOGLOSS) ;
2388   <START-CODE>
2389     termp = term ;
2390     wsterm = FALSE ;
2391     tooutput = FALSE;
2392     if (echo) mb_echohead("++") ;
2393   <END-CODE * GLOSSARY>
2394     endterm(base, gloss, "current"); /* don't use definition window for link */
2395   <END-CODE>
2396     endterm(base, gloss, "popup");   /* use definition window for link       */
2397   <TEXT-CODE>
2398     termchar(m_textchar) ;
2399   <PI-CODE>
2400     termpi(m_enttype, m_pi, m_entname) ;
2401      
2402 <ELEMENT TEST>
2403   <PARAM>
2404     id = ID ;
2405     include = INCLUDE  ;
2406     exclude = EXCLUDE  ;
2407   <START-CODE>
2408     M_WCHAR *wc_test;
2409
2410     wc_test = MakeWideCharString("TEST");
2411
2412     thisnodelevel++;
2413     starthelpnode(wc_test, id, thisnodelevel);
2414     m_free(wc_test, "wide character string");
2415     rsectseq = FALSE ;
2416     chapst = TRUE ;
2417     savid = checkid(id) ;
2418     iderr = FALSE ;
2419   <END-CODE>
2420     CloseVirpage();
2421     rseqend() ;
2422     --thisnodelevel;
2423
2424 <ELEMENT TEXT>
2425   <START-CODE NOTE>
2426     StartNCWtext("NOTE",
2427                  "NoteElementDefaultIconFile",
2428                  "NoteElementDefaultHeadingString");
2429   <START-CODE CAUTION>
2430     StartNCWtext("CAUTION",
2431                  "CautionElementDefaultIconFile",
2432                  "CautionElementDefaultHeadingString");
2433   <START-CODE WARNING>
2434     StartNCWtext("WARNING",
2435                  "WarningElementDefaultIconFile",
2436                  "WarningElementDefaultHeadingString");
2437   <START-CODE MESSAGE>
2438     PushForm(NULL, "MESSAGE", NULL);
2439     checkmsghead() ;
2440   <START-CODE MSGSUB>
2441     PushForm(NULL, "MSGSUB", NULL);
2442   <START-CODE ABSTRACT>
2443      if (needabstracthead)
2444          {
2445          fputs("<HEAD SSI=\"CHAPHEAD\">", outfile);
2446          chksnb();
2447          needabstracthead = FALSE;
2448          }
2449   <START-CODE DEFINITION>
2450     M_WCHAR *p ;
2451     char     id[SDLNAMESIZ+10];
2452
2453     sprintf(id, "%s%d", sdlReservedName, lastTermId);
2454     PushForm(NULL, NULL, id);
2455     StartBlock(NULL, "TERM", NULL);
2456     mb_strcode("<P SSI=\"P\">", outfile);
2457     strcode(term, outfile);
2458     mb_strcode("</P>\n", outfile);
2459     PushForm(NULL, "DEFINITION", NULL);
2460   <START-CODE>
2461   <END-CODE DEFINITION>
2462     PopForm(); PopForm();
2463   <END-CODE>
2464     if (formStackBase && (formStackTop >= formStackBase))
2465         {
2466         if (formStackTop->vecLen == 1)
2467             StartBlock(NULL, NULL, NULL);
2468         PopForm();
2469         }
2470     else if (inBlock)
2471         {
2472         fputs("</BLOCK>\n", outfile);
2473         inBlock = FALSE;
2474         }
2475
2476 <ELEMENT TITLE>
2477   <START-CODE>
2478     fputs("<HEAD TYPE=\"LINED\" SSI=\"TITLE\">", outfile);
2479     hadtitle = TRUE;
2480     newhline = 0 ;
2481     savhd = TRUE ;
2482     hderr = FALSE ;
2483     svheadlen = 0 ;
2484   <END-CODE>
2485     char *mb_savehead, *ssi;
2486     static char title_string[] = "-TITLE";
2487     char id[SDLNAMESIZ+sizeof(title_string)];
2488
2489     if (hderr)
2490         {
2491         m_error("Error collecting title characters.");
2492         }
2493     savhd = FALSE ;
2494
2495     fputs("</HEAD>\n", outfile);
2496
2497     sprintf(id, "%s%s", sdlReservedName, title_string);
2498     mb_starthelpnode("_TITLE", id, 0);
2499
2500     ssi = MakeMByteString(m_parent(1));
2501     fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
2502     savehead[svheadlen] = M_EOS ;
2503     mb_savehead = MakeMByteString(savehead);
2504     fputs(mb_savehead, outfile);
2505     m_free(mb_savehead,"multi-byte string");
2506     m_free(ssi,"multi-byte string");
2507     fputs("</HEAD>\n", outfile);
2508     CloseVirpage();
2509
2510     savedtitle = (M_WCHAR *) m_malloc(w_strlen(savehead) + 1, "saved title");
2511     w_strcpy(savedtitle, savehead);
2512
2513 <ELEMENT USER>
2514   <START-CODE>
2515     if (echo) {
2516       mb_echohead(m_stago) ;
2517       echohead(m_parent(0)) ;
2518       mb_echohead(m_net) ;
2519       }
2520     mb_strcode("<KEY CLASS=\"MACH-IN\">", outfile) ;
2521   <TEXT-CODE>
2522     esoutchar(m_textchar) ;
2523   <END-CODE>
2524     if (echo) mb_echohead(m_net) ;
2525     mb_strcode("</KEY>", outfile) ;
2526   <TEXT-CODE * EXAMPLESEG>
2527     exoutchar(m_textchar) ;
2528
2529   <START-CODE * IDX>
2530   <END-CODE * IDX>
2531   <TEXT-CODE * IDX>
2532     indexchar(m_textchar) ;
2533
2534 <ELEMENT VAR>
2535   <START-CODE>
2536     mb_strcode("<KEY CLASS=\"NAME\">", outfile) ;
2537     if (echo) mb_echohead("%%") ;
2538   <END-CODE>
2539     mb_strcode("</KEY>", outfile) ;
2540     if (echo) mb_echohead("%%") ;
2541
2542   <START-CODE * IDX>
2543   <END-CODE * IDX>
2544   <TEXT-CODE * IDX>
2545     indexchar(m_textchar) ;
2546
2547   <END-CODE * EXAMPLESEG, * IMAGE, * SYNEL>
2548     POPFONT ;
2549     mb_strcode("</KEY>", outfile) ;
2550
2551   /* added to fix calculator computer chars */
2552   <TEXT-CODE * SYNEL> 
2553     if (m_textchar == M_SPACE) fputs("\\ ", outfile) ;
2554     else outchar(m_textchar, outfile) ;
2555
2556 <ELEMENT VEX>
2557   <PARAM>
2558     type = TYPE (QCOMPUTER = COMPUTER,
2559                  QDISPLAY  = DISPLAY) ;
2560     position = POSITION (QLEFT = LEFT,
2561                          QINDENT = INDENT,
2562                          QCENTER = CENTER) ;
2563     textsize = TEXTSIZE (QNORMAL = NORMAL,
2564                          QSMALLER = SMALLER,
2565                          QSMALLEST = SMALLEST) ;
2566   <START-CODE>
2567     int   tsize;
2568     char *ssi;
2569
2570     inSdlP = TRUE;
2571     StartBlock(NULL, "EX", NULL);
2572     tsize = vextextsize(textsize);
2573     if (tsize == SMALLEST)
2574         ssi = "SMLST";
2575     else if (tsize == SMALLER)
2576         ssi = "SMLR";
2577     else
2578         ssi = "NML";
2579     fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"EX-%s\">", ssi);
2580   <END-CODE>
2581     inSdlP = FALSE;
2582     fputs("</P>\n", outfile);
2583     fputs("</BLOCK>\n", outfile);
2584     inBlock = FALSE;
2585   <TEXT-CODE>
2586     vexoutchar(m_textchar) ;
2587
2588 <ELEMENT WARNING>
2589   <START-CODE>
2590     StartNCW("WARNING");
2591
2592 <ELEMENT XREF>
2593 /* Cross-referencing that allows forward references is inherently a two-pass
2594 process.  However, this interface assumes a two-pass process.  MARKUP
2595 provides the first pass and TeX the second.  MARKUP can therefore define
2596 a TeX macro for every cross-reference and write a file of definitions of
2597 these macros that is read at the beginning of the TeX pass.  In fact,
2598 information about cross-references is stored in a trie by MARKUP.  Data is
2599 entered into this structure both when a cross-reference is defined (with
2600 an id parameter on a chapter, figure, etc.) and when it is used (with the
2601 xref element).  At the end of the manual, the file xref.tex is written
2602 with definitions of macros corresponding to all cross-references defined
2603 or accessed.  In addition, the file xreftbl is written to save this
2604 information in a form that can be read to initialize the trie the next
2605 time the manual is processed.  Saving cross-reference information across
2606 runs of MARKUP allows a manual to be processed a chapter at a time without
2607 invalidating interchapter references.  The file xreftbl should be
2608 deleted before final processing, however, to verify that no cross-references
2609 remain to an id that existed at one time and was deleted.  Such an id could
2610 remain in the cross-reference table indefinitely.
2611 */
2612   <PARAM>
2613     id = ID ;
2614   <START-CODE * IDX>
2615   <TEXT-CODE * IDX>
2616     indexchar(m_textchar) ;
2617   <START-CODE>
2618     xrefexpand(id) ;