1 /* Copyright (c) 1986, 1987, 1988, 1989, 1990 Hewlett-Packard Co. */
2 /* Interface definition for HP Tag/TeX translator */
4 /* Things to watch out for:
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.
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 */
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>
62 nseconds = time(NULL);
63 timefoo = localtime(&nseconds);
64 strftime(s, maxsize, "%x", timefoo);
65 fprintf(outfile, "%s\n", s);
67 <!ENTITY TIME SDATA CODE>
73 nseconds = time(NULL);
74 timefoo = localtime(&nseconds);
75 strftime(s, maxsize, "%X", timefoo);
76 fprintf(outfile, "%s\n", s);
78 <!ENTITY HALFSPACE SDATA " ">
79 <!ENTITY M-SPECCHAR SDATA "Special characters">
81 /* Code entities for toggling debugging traces */
82 <!ENTITY m-aopt PI CODE>
83 m_malftrace = (LOGICAL) ! m_malftrace ;
86 <!ENTITY m-copt PI CODE>
87 m_chtrace = (LOGICAL) ! m_chtrace ;
90 <!ENTITY m-dopt PI CODE>
91 m_cdtrace = (LOGICAL) ! m_cdtrace ;
94 <!ENTITY m-hopt PI CODE>
95 m_heapchk = (LOGICAL) ! m_heapchk ;
98 <!ENTITY m-oopt PI CODE>
99 tracetostd = (LOGICAL) ! tracetostd ;
102 <!ENTITY m-sopt PI CODE>
103 m_scantrace = (LOGICAL) ! m_scantrace ;
106 <!ENTITY m-topt PI CODE>
107 m_tagtrace = (LOGICAL) ! m_tagtrace ;
110 /* Code entities for MARKUP and HP Tag versions */
111 <!ENTITY m-markup-ver SDATA CODE>
113 M_WCHAR *wc_1, *wc_2;
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");
123 <!ENTITY m-tagver SDATA CODE>
125 M_WCHAR *wc_1, *wc_2;
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");
135 <!ENTITY m-machine SDATA CODE>
137 m_piaction("VECTRA", "m-machine", M_SDATA) ;
141 M_WCHAR *wc_1, *wc_2;
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");
152 M_WCHAR *wc_1, *wc_2;
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");
163 M_WCHAR *wc_1, *wc_2;
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");
174 M_WCHAR *wc_1, *wc_2;
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");
185 M_WCHAR *wc_1, *wc_2;
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");
196 M_WCHAR *wc_1, *wc_2;
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");
205 m_piaction("UNDEFINED MACHINE",
217 <SIGN-ON>CDE HelpTag Formatting System. - Version B.00.00 (DTD Version A.01.23)
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.";
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++) ;
244 version = (char *) m_malloc(q - p + 1, "version") ;
254 if (m_errexit && stoponerror) m_exit(m_errexit) ;
257 new = (SEARCH *) m_malloc(sizeof(SEARCH), "search path") ;
258 new->directory = indir ;
265 prebye = ftell(outfile) ;
267 if (glossary) checkgloss() ;
269 /* warn if we have forward xrefs */
270 if (have_forward_xrefs) {
275 outchar(m_textchar, outfile) ;
278 outpi(m_enttype, m_pi, m_entname) ;
283 where = WHERE (QTOC = TOC,
286 <START-CODE CHAPHEAD RSUB>
287 fputs(" ABBREV=\"", outfile);
288 <START-CODE CHAPHEAD RSECT>
290 (! m_wcmbupstrcmp(where, QFOOTER) ||
291 ! m_wcmbupstrcmp(where, QBOTH)) ;
295 fputs(" ABBREV=\"", outfile);
296 <START-CODE CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
297 fputs(" ABBREV=\"", outfile);
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>
307 (! m_wcmbupstrcmp(where, QFOOTER) ||
308 ! m_wcmbupstrcmp(where, QBOTH)) ;
312 fputs(" ABBREV=\"", outfile);
314 M_WCHAR *wc_stago, *wc_tagc;
316 wc_stago = MakeWideCharString(m_stago);
317 wc_tagc = MakeWideCharString(m_tagc);
320 (! m_wcmbupstrcmp(where, QFOOTER) ||
321 ! m_wcmbupstrcmp(where, QBOTH)) ;
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");
330 fputs("\"", outfile);
335 static char abstract[] = "-ABSTRACT";
336 char id[SDLNAMESIZ+sizeof(abstract)];
339 needabstracthead = TRUE;
340 sprintf(id, "%s%s", sdlReservedName, abstract);
341 mb_starthelpnode("_ABSTRACT", id, 0);
345 outchar(m_textchar, outfile);
349 mb_strcode("<KEY CLASS=\"ACRO\">", outfile) ;
351 mb_echohead(m_stago);
352 echohead(m_parent(0)) ;
356 mb_strcode("</KEY>", outfile) ;
357 if (echo) mb_echohead(m_net) ;
361 <END-CODE * EXAMPLESEG, * IMAGE>
364 indexchar(m_textchar) ;
366 outchar(wc_toupper(m_textchar), outfile) ;
379 mb_strcode("<HEAD CLASS=\"ANNOTATION\" TYPE=\"DYNAMIC\" SSI=\"ANNOT-",
381 mb_strcode(stackex ? "STACK\">" : "SIDE\">", outfile);
383 mb_strcode("</HEAD>", outfile);
384 savehead[svheadlen] = '\0';
390 mb_strcode("<KEY CLASS=\"BOOK\">", outfile) ;
392 mb_echohead(m_stago) ;
393 echohead(m_parent(0)) ;
397 mb_strcode("</KEY>", outfile) ;
398 if (echo) mb_echohead(m_net) ;
403 indexchar(m_textchar) ;
414 fputs("<SUBHEAD TYPE=\"LINED\" SSI=\"CAPTION-NUMBERED\"", outfile);
417 "<HEAD TYPE=\"LINED\" CLASS=\"CAPTION\" SSI=\"CAPTION%s\"",
422 savehead[svheadlen] = M_EOS ;
425 mb_strcode(">", outfile);
426 strcode(savehead, outfile);
428 fputs("</SUBHEAD>", outfile);
438 startrow = STARTROW ;
445 emsghead = USERHEAD ;
447 <END-CODE CHAPTER, RSECT, S1, S2, S3, S4, S5, S6, S7,
448 S8, S9, TEST, HOMETOPIC, MESSAGE>
450 mb_strcode(">", outfile);
451 strcode(savehead, outfile);
453 /* Non node headings */
454 <END-CODE RSUB, MSGSUB, PROCEDURE>
456 mb_strcode(">", outfile);
457 strcode(savehead, outfile);
458 fputs("</HEAD>\n", outfile);
459 /* Non node headings */
462 fputs("</HEAD>\n", outfile);
473 wc_chapter = MakeWideCharString("CHAPTER");
475 assert_hometopic_exists();
478 starthelpnode(wc_chapter, id, thisnodelevel);
479 m_free(wc_chapter, "wide character string");
487 if (echo) mb_echohead("((") ;
488 mb_strcode("(", outfile) ;
489 outchar (m_textchar, outfile) ;
490 mb_strcode(")", outfile) ;
491 if (echo) mb_echohead("))") ;
496 indexchar(m_textchar) ;
501 mb_strcode("<KEY CLASS=\"MACH-OUT\">", outfile) ;
502 if (echo) mb_echohead("``") ;
505 mb_strcode("</KEY>", outfile) ;
506 if (echo) mb_echohead("''") ;
508 esoutchar(m_textchar) ;
510 exoutchar(m_textchar) ;
511 <TEXT-CODE * EXAMPLESEG>
512 exoutchar(m_textchar) ;
517 indexchar(m_textchar) ;
521 static char copyright[] = "-COPYRIGHT";
522 char id[SDLNAMESIZ+sizeof(copyright)];
524 sprintf(id, "%s%s", sdlReservedName, copyright);
525 mb_starthelpnode("_COPYRIGHT", id, 0);
526 /* No Head. Let author have a clean slate. */
533 mb_echohead(m_stago) ;
534 echohead(m_parent(0)) ;
538 if (echo) mb_echohead(m_net) ;
540 esoutchar(m_textchar) ;
541 <TEXT-CODE * EXAMPLESEG>
542 exoutchar(m_textchar) ;
547 indexchar(m_textchar) ;
560 /* trim possible (perhaps) last space */
561 if (termp - term > 1 && *(termp-1) == ' ') {
564 if (!(lastTermId = (int) m_lookfortrie(term, >ree)))
566 lastTermId = NextId();
567 m_ntrtrie(term, >ree, (void *) -lastTermId);
572 if (!m_resettrie(>ree, term, (void *) -lastTermId))
574 m_error("Internal error. Can't reset glossary trie") ;
579 lastTermId = -lastTermId;
582 termchar(m_textchar) ;
584 termpi(m_enttype, m_pi, m_entname) ;
588 mb_strcode("<KEY CLASS=\"EMPH\">", outfile) ;
589 if (echo) mb_echohead("!!") ;
591 mb_strcode("</KEY>", outfile) ;
592 if (echo) mb_echohead("!!") ;
597 indexchar(m_textchar) ;
603 indexchar(m_textchar) ;
605 static M_WCHAR ch[2];
608 strcode(ch, outfile);
611 mb_echohead(m_stago) ;
612 echohead(m_parent(0)) ;
616 if (echo) mb_echohead(m_net) ;
620 type = TYPE (QCOMPUTER = COMPUTER,
621 QDISPLAY = DISPLAY) ;
622 position = POSITION (QLEFT = LEFT,
625 notes = NOTES (QSIDE = SIDE,
628 lines = LINES (QNUMBER = NUMBER,
629 QNONUMBER = NONUMBER) ;
630 textsize = TEXTSIZE (QNORMAL = NORMAL,
632 QSMALLEST = SMALLEST) ;
634 StartEx(notes, lines, textsize);
637 tonumexlines = FALSE;
638 fputs(saveex, outfile);
639 fputs("</BLOCK>\n", outfile);
642 outchar(m_textchar, outfile) ;
651 saveexseg = mb_malloc(1);
653 svheadlen = 0; /* we save any <annotation> text in "savehead" */
658 exoutchar(m_textchar);
662 PushForm(NULL, "EXPLAIN", NULL);
667 tonumber = TONUMBER (QNUMBER = NUMBER,
668 QNONUMBER = NONUMBER) ;
671 figpos = FIGPOS (QLEFT = LEFT,
674 cappos = CAPPOS (QLEFT = LEFT,
677 oldtype = OLDTYPE (QART = ART,
682 xwidth = WIDTH (QFULL = FULL,
684 QCURRENT = CURRENT) ;
685 xdepth = HEIGHT (QNATURAL = NATURAL) ;
688 border = BORDER (QTOP = TOP,
693 type = TYPE (QART = ART,
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) ;
709 penwidth = PENWIDTH ;
710 snap = SNAP (QSNAP = SNAP,
712 autoscale = AUTOSCALE (QAUTOSCALE = AUTOSCALE,
713 QNOAUTOSCALE = NOAUTOSCALE) ;
714 plottype = PLOTTYPE ;
716 textsize = TEXTSIZE (QNORMAL = NORMAL,
718 QSMALLEST = SMALLEST) ;
719 ghyperlink = GHYPERLINK ;
720 glinktype = GLINKTYPE (QJUMP = JUMP,
721 QJUMPNEWVIEW = JUMPNEWVIEW,
722 QDEFINITION = DEFINITION,
724 QAPPDEFINED = APPDEFINED,
726 gdescription = GDESCRIPTION ;
738 if (ftonumber | (svheadlen != 0))
740 fputs("</HEAD>", outfile);
743 fputs("\n</REFITEM>\n</SNREF>", outfile);
746 fputs("</LINK>\n", outfile);
749 fputs("</P>\n", outfile);
752 /* When implementing, check conditionals of <FOOTNOTE> in <P> */
753 <TEXT-CODE * EXAMPLESEG, * IMAGE>
754 outchar(m_textchar, outfile) ;
764 PushForm(NULL, NULL, NULL);
769 GetDefaultHeaderString("GlossaryElementDefaultHeadingString",
772 static char glossary_string[] = "-GLOSSARY";
773 char id[SDLNAMESIZ+sizeof(glossary_string)];
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") ;
782 snprintf(chapstring, sizeof(chapstring), "%s", string) ;
783 fputs("\nGlossary\n", stderr) ;
785 fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
786 m_free(string, "default header string return");
796 unsigned char etype, wheredef ;
797 /* Code from figstart */
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 */
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
826 f_contqual[0] = M_EOS ;
828 /* check ENTITY and determine the figure type */
830 m_lookent(file, &etype, &f_file, &wheredef) ;
831 if (etype != M_SYSTEM) {
832 M_WCHAR *wc_stago, *wc_tagc, *wc_entsystem, *wc_entkw;
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",
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");
852 f_content = searchforfile(f_file) ;
854 if (getqualified(f_contqual, f_content)) {
855 /* unsuccessful qual */
856 if (w_strlen(f_content) < FNAMELEN)
857 w_strcpy(f_contqual, f_content) ;
859 m_err1("Internal error. File name too long: %s", f_content) ;
865 m_err2("Can't find file %s (declared in entity %s)", f_file, file) ;
871 char *mb_content, snb_id[32];
873 static M_WCHAR empty[1];
876 if (!f_content) f_content = empty;
878 mb_content = MakeMByteString(f_content);
879 sprintf(snb_id, "%s%d", sdlReservedName, NextId());
880 mb_strcode("<SNREF", outfile);
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");
891 ">\n<REFITEM RID=\"%s\" CLASS=\"IN-LINE\"></REFITEM>\n</SNREF>",
893 mb_strcode(buffer, outfile);
894 AddToSNB(snb_id, mb_content);
895 m_free(mb_content,"multi-byte string");
899 /* Accent headings */
900 <START-CODE NOTE, CAUTION, WARNING>
903 fputs("<HEAD TYPE=\"LINED\" SSI=\"NCW\">", outfile);
905 <START-CODE LABLIST, IMAGE, LIST, EX, P>
908 ssi = MakeMByteString(m_parent(1));
910 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
911 m_free(ssi, "multi-byte string");
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
921 ssi = MakeMByteString(m_parent(1));
927 savesnb = mb_malloc(1);
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>
936 ssi = MakeMByteString(m_parent(1));
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>
953 fputs("<HEAD TYPE=\"LINED\" SSI=\"PROCEDURE\"", outfile);
954 /* Non node headings */
955 <START-CODE OTHERHEAD>
958 ssi = MakeMByteString(m_parent(1));
964 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
965 m_free(ssi, "multi-byte string");
967 <START-CODE CHAPHEAD>
968 M_WCHAR *wc_stago, *wc_tagc;
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>
979 ssi = MakeMByteString(m_parent(1));
982 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
983 m_free(ssi, "multi-byte string");
984 /* Non-node headings */
985 <START-CODE ABSTRACT>
988 needabstracthead = FALSE;
989 fputs("<HEAD TYPE=\"LINED\" SSI=\"ABSTRACT\">", outfile);
991 <START-CODE OTHERFRONT>
992 had_an_otherfront_head = TRUE;
998 fputs("<HEAD TYPE=\"LINED\" SSI=\"METAINFO\">", outfile);
1001 /* Other headings (mixed content) */
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>
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>
1020 savehead[svheadlen] = '\0';
1022 /* Non node headings */
1023 <END-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
1026 savehead[svheadlen] = '\0';
1028 /* Non node headings */
1029 <END-CODE OTHERHEAD>
1031 fputs("</HEAD>\n", outfile);
1032 /* Node headings. */
1033 <END-CODE OTHERFRONT>
1036 /* Other headings. */
1039 fputs("</HEAD>", outfile);
1041 outchar(m_textchar, outfile) ;
1043 <ELEMENT HELPVOLUME>
1046 language = LANGUAGE (QENGLISH = ENGLISH,
1047 QNORWEGIAN = NORWEGIAN,
1055 QSPANISH = SPANISH) ;
1059 char hostname[BIGBUF];
1060 char **tossline = toss;
1061 char *mb_language, *mb_charset;
1064 ModifyEntities(); /* convert SDATA [......] to <spc name="[......]"> */
1066 if (!getenv("_DTHELPTAG_NO_UNIQUE_ID"))
1068 hostname[sizeof(hostname)-1] = '\0';
1069 gethostname(hostname, sizeof(hostname)-1);
1071 docId = mb_malloc(strlen(hostname)+1);
1072 strcpy(docId, hostname);
1074 timeStamp = time(0);
1085 "<SDLDOC %s=\"%s\" %s=\"%s\" %s=\"%ld\" %s=\"%s-%s\"",
1097 mb_language = MakeMByteString(helplang);
1098 fprintf(outfile, " %s=\"%s\"", "LANGUAGE", mb_language);
1099 mb_free(&mb_language);
1103 mb_charset = MakeMByteString(helpcharset);
1104 fprintf(outfile, " %s=\"%s\"", "CHARSET", mb_charset);
1105 mb_free(&mb_charset);
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);
1111 fputs("</VSTRUCT>\n", outfile);
1112 snbstart = ftell(outfile);
1114 assert_hometopic_exists();
1115 fputs("</SDLDOC>\n", outfile);
1121 fputs("&\n", outfile);
1124 <START-CODE CAPTION FIGURE>
1128 (sizeof(savehead) / sizeof(M_WCHAR)),
1130 "Too many characters in head or caption",
1132 <START-CODE HEAD CHAPHEAD, HEAD OTHERFRONT>
1134 fputs(" ", stderr) ;
1135 mb_strcode("\n", outfile) ;
1136 if (savid) shchar(' ',
1138 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1141 "Too many characters in corresponding cross-reference",
1145 (sizeof(savehead) / sizeof(M_WCHAR)),
1148 "Too many characters in head or caption",
1153 fputs("\n", outfile) ;
1155 <START-CODE HEAD P, HEAD IMAGE, HEAD LIST, HEAD LABLIST, HEAD EX,
1157 if (newhline++) fputc('\n', outfile) ;
1158 <END-CODE HEAD CHAPHEAD,
1162 putc('\n', stderr) ;
1163 <END-CODE HEAD ABSTRACT>
1164 putc('\n', stderr) ;
1169 static char hometopic[] = "-HOMETOPIC";
1170 char id[SDLNAMESIZ+sizeof(hometopic)];
1172 sprintf(id, "%s%s", sdlReservedName, hometopic);
1173 mb_starthelpnode("_HOMETOPIC", id, 1);
1174 nohometopic = FALSE;
1180 rule = RULE (QNORULE = NORULE,
1189 range = RANGE (QBEGIN = BEGIN,
1197 /* ignore <idx end>'s in cache creek */
1198 if (!range || (range && m_wcmbupstrcmp(range, QEND)) )
1200 char *mb_print, *mb_nospace1, *mb_nospace2, id[32];
1201 M_WCHAR *pwc, wnl, wsp;
1203 mbtowc(&wnl, "\n", 1);
1204 mbtowc(&wsp, " ", 1);
1207 while (pwc = w_strchr(pwc, wnl))
1209 mb_print = MakeMByteString(print);
1210 if (w_strlen(sort) > 0)
1215 while (pwc = w_strchr(pwc, wnl))
1217 mb_sort = MakeMByteString(sort);
1218 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1220 /* append subsort or subprint */
1224 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1226 while (pwc = w_strchr(pwc, wnl))
1228 mb_sub = MakeMByteString(pwcSub);
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';
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;
1244 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1245 m_free(mb_sub,"multi-byte string");
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';
1254 /* strip leading spaces */
1255 mb_nospace1 = mb_sort;
1256 while (*mb_nospace1++ == ' '); --mb_nospace1;
1258 fprintf(indexfp, "%s", mb_nospace1);
1260 m_free(mb_sort,"multi-byte string");
1263 { /* use print field */
1264 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1266 /* append subsort or subprint */
1270 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1272 while (pwc = w_strchr(pwc, wnl))
1274 mb_sub = MakeMByteString(pwcSub);
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';
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;
1290 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1291 m_free(mb_sub,"multi-byte string");
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';
1300 /* strip leading spaces */
1301 mb_nospace1 = mb_print;
1302 while (*mb_nospace1++ == ' '); --mb_nospace1;
1304 fprintf(indexfp, "%s", mb_nospace1);
1307 putc('\036' /* ascii record separator */, indexfp);
1310 if (w_strlen(subprint) > 0)
1315 while (pwc = w_strchr(pwc, wnl))
1317 mb_subprint = MakeMByteString(subprint);
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';
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;
1333 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1334 m_free(mb_subprint,"multi-byte string");
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';
1343 /* strip leading spaces */
1344 mb_nospace1 = mb_print;
1345 while (*mb_nospace1++ == ' '); --mb_nospace1;
1347 fprintf(indexfp, "%s", mb_nospace1);
1349 m_free(mb_print,"multi-byte string");
1350 putc('\036' /* ascii record separator */, indexfp);
1357 sprintf(id, "%s%d", sdlReservedName, NextId());
1358 fprintf(outfile, "<ANCHOR ID=\"%s\">", id);
1360 fputs("\n", indexfp);
1365 parTextId = NextId();
1366 sprintf(id, "%s%d", sdlReservedName, parTextId);
1368 fputs("\n", indexfp);
1375 mb_nodeid = MakeMByteString(nodeid);
1376 fputs(mb_nodeid, indexfp);
1377 fputs("\n", indexfp);
1378 m_free(mb_nodeid,"multi-byte string");
1381 fprintf(indexfp, "%s-HOMETOPIC\n", sdlReservedName);
1384 indexchar(m_textchar) ;
1391 gposition = GPOSITION (QLEFT = LEFT,
1393 ghyperlink = GHYPERLINK ;
1394 glinktype = GLINKTYPE (QJUMP = JUMP,
1395 QJUMPNEWVIEW = JUMPNEWVIEW,
1396 QDEFINITION = DEFINITION,
1398 QAPPDEFINED = APPDEFINED,
1400 gdescription = GDESCRIPTION ;
1402 <C variable> = NUMBER ;
1406 imagegentityp = gentity;
1407 imagegpositionp = gposition;
1408 imageghyperlinkp = ghyperlink;
1409 imageglinktypep = glinktype;
1410 imagegdescription = gdescription;
1413 StartBlock(NULL, NULL, NULL);
1416 fputs("<P TYPE=\"LITERAL\"", outfile);
1419 m_free(imageId,"multi-byte string");
1420 imageId = MakeMByteString(id);
1421 fprintf(outfile, " ID=\"%s\"", imageId);
1422 savid = checkid(id);
1424 fputs(" SSI=\"IMAGE", outfile);
1427 fputs("-INDENT", outfile);
1429 fputs("\">", outfile);
1432 fputs("</P>\n", outfile);
1434 imoutchar(m_textchar) ;
1440 wc_image = MakeWideCharString("IMAGE");
1441 handle_link_and_graphic(wc_image,
1447 m_free(wc_image,"wide character string");
1449 <ELEMENT INDEXPRIMARY>
1454 /* capture saved term unless <sort> got it already */
1456 idxsav[idxsavlen] = M_EOS;
1457 w_strcpy(print, idxsav);
1460 else { /* save the sort field */
1461 idxsav[idxsavlen] = M_EOS;
1462 w_strcpy(sort, idxsav);
1470 /* capture saved term unless <sort> got it already */
1472 idxsav[idxsavlen] = M_EOS;
1473 w_strcpy(subprint, idxsav);
1475 else { /* save the sort field */
1476 idxsav[idxsavlen] = M_EOS;
1477 w_strcpy(subsort, idxsav);
1481 <ELEMENT INPUT.....>
1483 if (echo) mb_echohead("``") ;
1486 if (echo) mb_echohead("''") ;
1492 if (lastlist->lastlist->type == PLAIN) {
1493 leaderok = TRUE ; /* allow <LEADER> only in <LIST PLAIN> */
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("[[") ;
1506 mb_strcode("</KEY>", outfile) ;
1507 if (echo) mb_echohead("]]") ;
1509 esoutchar(m_textchar) ;
1516 indexchar(m_textchar) ;
1522 char *first, *loose, *wrap;
1525 if (listitems[list].firstitem)
1530 fputs("<FDATA>\n", outfile);
1534 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1535 wrap = (listitems[list].longlabel == WRAP) ? "" : " TYPE=\"LINED\"";
1536 labelid[list] = NextId();
1538 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"%s%s-LABEL\">\n",
1543 fprintf(outfile, "<P%s>", wrap);
1545 char *first, *loose;
1546 char ssi[BIGBUF], labelId[BIGBUF];
1548 fputs("</P>\n</BLOCK>\n", outfile);
1551 if (listitems[list].firstitem)
1554 listitems[list].firstitem = FALSE;
1556 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1557 sprintf(ssi, "%s%s", first, loose);
1559 sprintf(labelId, "%s%d", sdlReservedName, labelid[list]);
1561 PushForm2("ITEM", ssi, labelId, NULL);
1565 if (listitems[list].firstitem)
1567 listitems[list].firstitem = FALSE;
1569 labhid[list] = NextId();
1572 fputs("<FDATA>\n", outfile);
1576 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABH-%s\">\n",
1579 lablisttight[list] ? "TIGHT" : "LOOSE");
1580 fputs("<P TYPE=\"LINED\">", outfile);
1582 fputs("</P>\n</BLOCK>\n", outfile);
1586 labhtextid[list] = NextId();
1588 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABHTEXT-%s\">\n",
1591 lablisttight[list] ? "TIGHT" : "LOOSE");
1592 fputs("<P TYPE=\"LINED\">", outfile);
1594 char labh_id[SDLNAMESIZ + 10], labhtext_id[SDLNAMESIZ + 10];
1596 fputs("</P>\n</BLOCK>\n", outfile);
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,
1611 longlabel = LONGLABEL (QWRAP = WRAP,
1614 spacing = SPACING (QTIGHT = TIGHT,
1617 StartLabList(spacing, longlabel);
1624 type = TYPE (QSPACE = SPACE,
1629 if (! m_wcmbupstrcmp(type, QDOTS))
1632 else if (! m_wcmbupstrcmp(type, QSPACE))
1637 M_WCHAR *wc_stago, *wc_tagc;
1639 wc_stago = MakeWideCharString(m_stago);
1640 wc_tagc = MakeWideCharString(m_tagc);
1641 m_err2("Internal error: element %sLEADER%s in tex.if",
1644 m_free(wc_stago,"wide character string");
1645 m_free(wc_tagc,"wide character string");
1650 M_WCHAR *wc_stago, *wc_tagc;
1652 wc_stago = MakeWideCharString(m_stago);
1653 wc_tagc = MakeWideCharString(m_tagc);
1654 m_err4("%sLEADER%s only allowed in %sLIST PLAIN%s",
1659 m_free(wc_stago,"wide character string");
1660 m_free(wc_tagc,"wide character string");
1667 char mb_xrefstring[400];
1671 "Preparing cross-reference to a line in an example without line numbers"
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;
1690 char *mb_id, buffer[BIGBUF];
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");
1700 hyperlink = HYPERLINK ;
1701 type = TYPE (QJUMP = JUMP,
1702 QJUMPNEWVIEW = JUMPNEWVIEW,
1703 QDEFINITION = DEFINITION,
1705 QAPPDEFINED = APPDEFINED,
1707 description = DESCRIPTION ;
1709 HandleLink(hyperlink, type, description);
1711 /* reset link type to default. This is braindead, but enough.
1715 <link foo DEFINITION><XREF bar><\link>
1717 will do the right thing (remember that xref turns to an implicit link).
1718 Right_thing => xref becomes definition link.
1722 <link foo DEFINITION> <link fub> Test <\link> <xref bar> <\link>
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.
1727 global_linktype = 0;
1728 mb_strcode("</LINK>", outfile);
1732 type = TYPE (QORDER = ORDER,
1737 order = ORDERTYPE (QUALPHA = UALPHA,
1742 spacing = SPACING (QTIGHT = TIGHT,
1746 StartList(type, order, spacing, cont) ;
1757 char buffer[BIGBUF];
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");
1764 savid = checkid(id);
1771 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1774 "Too many characters in corresponding cross-reference",
1790 if (m_textchar == '"')
1791 { /* handle funny quote in memo bug */
1795 outchar(m_textchar, outfile);
1799 /* could need to handle calculator context sensitive entities
1800 * here if needed to reduce tex macro count
1804 outpi(m_enttype, m_pi, m_entname) ;
1813 mb_starthelpnode("MESSAGE", "", thisnodelevel);
1815 fprintf(stderr, "\nMessages.\n") ;
1816 emsghead = DEFHEAD ;
1825 PushForm(NULL, "MSG", NULL);
1832 fputs("<HEAD SSI=\"MSGNUM\">", outfile);
1834 fputs("</HEAD>\n", outfile);
1841 PushForm(NULL, NULL, NULL);
1844 savid = checkid(NULL) ; /* hook for possible future ID */
1852 StartBlock(NULL, "MSGTEXT", NULL);
1853 fputs("<P>", outfile);
1856 fputs("</P>\n", outfile);
1860 type = TYPE (QBEGIN = BEGIN,
1862 QTOGETHER = TOGETHER) ;
1867 fputs("&\n", outfile) ;
1868 <START-CODE * ABSTRACT>
1869 fputs("&\n", outfile) ;
1881 indexchar(m_textchar) ;
1883 <TEXT-CODE * EXAMPLESEG, * IMAGE>
1884 outchar(m_textchar, outfile) ;
1889 fputs("[", outfile);
1891 fputs("]", outfile);
1894 <ELEMENT OTHERFRONT>
1905 mb_id = MakeMByteString(id);
1906 mb_starthelpnode("METAINFO", mb_id, 0);
1908 m_free(mb_id, "multi-byte string");
1909 had_an_otherfront_head = FALSE;
1910 savid = checkid(id) ;
1914 if (id && !had_an_otherfront_head) {
1915 m_errline("You must use a <HEAD> tag after <OTHERFRONT>\n");
1920 PushForm(NULL, "OTHERHEAD", NULL);
1924 <ELEMENT OUTPUT....>
1926 if (echo) mb_echohead("``") ;
1929 if (echo) mb_echohead("''") ;
1936 gposition = GPOSITION (QLEFT = LEFT,
1938 ghyperlink = GHYPERLINK ;
1939 glinktype = GLINKTYPE (QJUMP = JUMP,
1940 QJUMPNEWVIEW = JUMPNEWVIEW,
1941 QDEFINITION = DEFINITION,
1943 QAPPDEFINED = APPDEFINED,
1945 gdescription = GDESCRIPTION ;
1956 fputs("\n</P>\n", outfile);
1961 mb_echohead(m_stago) ;
1962 echohead(m_parent(0)) ;
1963 mb_echohead(m_net) ; /* '|' */
1966 if (echo) mb_echohead(m_net) ; /* '|' */
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. */
1975 M_WCHAR *wc_stago, *wc_tagc;
1977 wc_stago = MakeWideCharString(m_stago);
1978 wc_tagc = MakeWideCharString(m_tagc);
1979 m_err4("%sPARM%s not allowed in %sIDX%s.",
1984 m_free(wc_stago,"wide character string");
1985 m_free(wc_tagc,"wide character string");
1988 indexchar(m_textchar) ;
1989 <START-CODE * CHAPHEAD>
1990 M_WCHAR *wc_stago, *wc_tagc;
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>
1999 <END-CODE * EXAMPLESEG, * IMAGE>
2003 <START-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
2005 savid = NULL; /* in case there was no head */
2013 <END-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
2019 PushForm("TEXT", "PROCEDURE", NULL);
2024 <START-CODE * ABBREV>
2025 mb_strcode("``", outfile) ;
2026 if (echo) putc('"', stderr) ;
2028 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"OPEN\"></KEY>", outfile) ;
2029 if (echo) putc('"', stderr) ;
2031 mb_strcode("''", outfile) ;
2032 if (echo) putc('"', stderr) ;
2034 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"CLOSE\"></KEY>", outfile) ;
2035 if (echo) putc('"', stderr) ;
2042 indexchar(m_textchar) ;
2044 <ELEMENT REFERENCES>
2049 fputs("{", outfile);
2051 fputs("}", outfile);
2056 pagebreak = PAGEBREAK (QNEWPAGE = NEWPAGE,
2057 QSAMEPAGE = SAMEPAGE) ;
2061 M_WCHAR *wc_rsect, *wc_helpvolume;
2063 wc_rsect = MakeWideCharString("RSECT");
2064 wc_helpvolume = MakeWideCharString("HELPVOLUME");
2067 assert_hometopic_exists();
2068 if (!rsectseq) thisnodelevel = thisnodelevel + 1;
2069 if (w_strcmp(m_parent(1), wc_helpvolume) != 0)
2072 starthelpnode(wc_rsect, id, thisnodelevel);
2075 starthelpnode(wc_rsect, id, 2);
2076 m_free(wc_rsect, "wide character string");
2077 m_free(wc_helpvolume, "wide character string");
2080 M_WCHAR *wc_helpvolume;
2082 wc_helpvolume = MakeWideCharString("HELPVOLUME");
2083 if (w_strcmp(m_parent(1), wc_helpvolume) == 0)
2085 m_free(wc_helpvolume, "wide character string");
2092 PushForm(NULL, NULL, NULL);
2094 PushForm(NULL, NULL, NULL);
2103 <START-CODE HELPVOLUME>
2106 wc_s1 = MakeWideCharString("S1");
2108 assert_hometopic_exists();
2110 starthelpnode(wc_s1, id, thisnodelevel);
2111 m_free(wc_s1, "wide character string");
2114 savid = checkid(id) ;
2119 wc_s1 = MakeWideCharString("S1");
2121 assert_hometopic_exists();
2124 starthelpnode(wc_s1, id, thisnodelevel);
2125 m_free(wc_s1, "wide character string");
2128 savid = checkid(id) ;
2130 <END-CODE HELPVOLUME>
2146 wc_s2 = MakeWideCharString("S2");
2150 starthelpnode(wc_s2, id, thisnodelevel);
2151 m_free(wc_s2, "wide character string");
2153 savid = checkid(id) ;
2167 wc_s3 = MakeWideCharString("S3");
2171 starthelpnode(wc_s3, id, thisnodelevel);
2172 m_free(wc_s3, "wide character string");
2174 savid = checkid(id) ;
2188 wc_s4 = MakeWideCharString("S4");
2192 starthelpnode(wc_s4, id, thisnodelevel);
2193 m_free(wc_s4, "wide character string");
2195 savid = checkid(id) ;
2209 wc_s5 = MakeWideCharString("S5");
2213 starthelpnode(wc_s5, id, thisnodelevel);
2214 m_free(wc_s5, "wide character string");
2216 savid = checkid(id) ;
2230 wc_s6 = MakeWideCharString("S6");
2234 starthelpnode(wc_s6, id, thisnodelevel);
2235 m_free(wc_s6, "wide character string");
2237 savid = checkid(id) ;
2251 wc_s7 = MakeWideCharString("S7");
2255 starthelpnode(wc_s7, id, thisnodelevel);
2256 m_free(wc_s7, "wide character string");
2258 savid = checkid(id) ;
2272 wc_s8 = MakeWideCharString("S8");
2276 starthelpnode(wc_s8, id, thisnodelevel);
2277 m_free(wc_s8, "wide character string");
2279 savid = checkid(id) ;
2293 wc_s9 = MakeWideCharString("S9");
2297 starthelpnode(wc_s9, id, thisnodelevel);
2298 m_free(wc_s9, "wide character string");
2300 savid = checkid(id) ;
2307 <START-CODE INDEXPRIMARY>
2309 idxsav[idxsavlen] = M_EOS;
2310 w_strcpy(print, idxsav);
2312 <END-CODE INDEXPRIMARY>
2313 idxsav[idxsavlen] = M_EOS;
2314 w_strcpy(sort, idxsav);
2315 <START-CODE INDEXSUB>
2317 idxsav[idxsavlen] = M_EOS;
2318 w_strcpy(subprint, idxsav);
2321 idxsav[idxsavlen] = M_EOS;
2322 w_strcpy(subsort, idxsav);
2329 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUB\">", outfile);
2330 mb_strcode("<SPHRASE CLASS=\"SUB\">", outfile);
2331 if (echo) mb_echohead("__") ;
2334 mb_strcode("</SPHRASE></KEY>", outfile);
2335 if (echo) mb_echohead("__") ;
2336 <TEXT-CODE * COMPUTER>
2337 outchar(m_textchar, outfile) ;
2339 indexchar(m_textchar) ;
2341 outchar(m_textchar, outfile) ;
2346 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUPER\">", outfile);
2347 mb_strcode("<SPHRASE CLASS=\"SUPER\">", outfile);
2348 if (echo) mb_echohead("^^") ;
2351 mb_strcode("</SPHRASE></KEY>", outfile);
2352 if (echo) mb_echohead("^^") ;
2353 <TEXT-CODE * COMPUTER>
2354 outchar(m_textchar, outfile) ;
2356 indexchar(m_textchar) ;
2358 outchar(m_textchar, outfile) ;
2361 <START-CODE OPTBLOCK, REQBLOCK>
2363 fputs("\n", outfile);
2365 <END-CODE OPTBLOCK, REQBLOCK>
2367 fputs("\n", outfile);
2369 outchar(m_textchar, outfile) ;
2375 StartBlock(NULL, NULL, NULL);
2376 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"SYNTAX\">");
2379 fputs("</P>\n", outfile);
2381 outchar(m_textchar, outfile) ;
2386 gloss = GLOSS (QGLOSS = GLOSS,
2387 QNOGLOSS = NOGLOSS) ;
2392 if (echo) mb_echohead("++") ;
2393 <END-CODE * GLOSSARY>
2394 endterm(base, gloss, "current"); /* don't use definition window for link */
2396 endterm(base, gloss, "popup"); /* use definition window for link */
2398 termchar(m_textchar) ;
2400 termpi(m_enttype, m_pi, m_entname) ;
2410 wc_test = MakeWideCharString("TEST");
2413 starthelpnode(wc_test, id, thisnodelevel);
2414 m_free(wc_test, "wide character string");
2417 savid = checkid(id) ;
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);
2441 PushForm(NULL, "MSGSUB", NULL);
2442 <START-CODE ABSTRACT>
2443 if (needabstracthead)
2445 fputs("<HEAD SSI=\"CHAPHEAD\">", outfile);
2447 needabstracthead = FALSE;
2449 <START-CODE DEFINITION>
2451 char id[SDLNAMESIZ+10];
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);
2461 <END-CODE DEFINITION>
2462 PopForm(); PopForm();
2464 if (formStackBase && (formStackTop >= formStackBase))
2466 if (formStackTop->vecLen == 1)
2467 StartBlock(NULL, NULL, NULL);
2472 fputs("</BLOCK>\n", outfile);
2478 fputs("<HEAD TYPE=\"LINED\" SSI=\"TITLE\">", outfile);
2485 char *mb_savehead, *ssi;
2486 static char title_string[] = "-TITLE";
2487 char id[SDLNAMESIZ+sizeof(title_string)];
2491 m_error("Error collecting title characters.");
2495 fputs("</HEAD>\n", outfile);
2497 sprintf(id, "%s%s", sdlReservedName, title_string);
2498 mb_starthelpnode("_TITLE", id, 0);
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);
2510 savedtitle = (M_WCHAR *) m_malloc(w_strlen(savehead) + 1, "saved title");
2511 w_strcpy(savedtitle, savehead);
2516 mb_echohead(m_stago) ;
2517 echohead(m_parent(0)) ;
2518 mb_echohead(m_net) ;
2520 mb_strcode("<KEY CLASS=\"MACH-IN\">", outfile) ;
2522 esoutchar(m_textchar) ;
2524 if (echo) mb_echohead(m_net) ;
2525 mb_strcode("</KEY>", outfile) ;
2526 <TEXT-CODE * EXAMPLESEG>
2527 exoutchar(m_textchar) ;
2532 indexchar(m_textchar) ;
2536 mb_strcode("<KEY CLASS=\"NAME\">", outfile) ;
2537 if (echo) mb_echohead("%%") ;
2539 mb_strcode("</KEY>", outfile) ;
2540 if (echo) mb_echohead("%%") ;
2545 indexchar(m_textchar) ;
2547 <END-CODE * EXAMPLESEG, * IMAGE, * SYNEL>
2549 mb_strcode("</KEY>", outfile) ;
2551 /* added to fix calculator computer chars */
2553 if (m_textchar == M_SPACE) fputs("\\ ", outfile) ;
2554 else outchar(m_textchar, outfile) ;
2558 type = TYPE (QCOMPUTER = COMPUTER,
2559 QDISPLAY = DISPLAY) ;
2560 position = POSITION (QLEFT = LEFT,
2563 textsize = TEXTSIZE (QNORMAL = NORMAL,
2565 QSMALLEST = SMALLEST) ;
2571 StartBlock(NULL, "EX", NULL);
2572 tsize = vextextsize(textsize);
2573 if (tsize == SMALLEST)
2575 else if (tsize == SMALLER)
2579 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"EX-%s\">", ssi);
2582 fputs("</P>\n", outfile);
2583 fputs("</BLOCK>\n", outfile);
2586 vexoutchar(m_textchar) ;
2590 StartNCW("WARNING");
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.
2616 indexchar(m_textchar) ;