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("OSF1");
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");
183 m_piaction("UNDEFINED MACHINE",
193 <SIGN-ON>CDE HelpTag Formatting System. - Version B.00.00 (DTD Version A.01.23)
198 static char ident1[]="@(#)CDE Help Tag Parser";
199 static char ident2[]="@(#)Version Number: B.00.00";
200 static char ident3[]="@(#) (c) Copyright 1993, 1994 Hewlett-Packard Company";
201 static char ident4[]="@(#) (c) Copyright 1993, 1994 International Business Machines Corp.";
202 static char ident5[]="@(#) (c) Copyright 1993, 1994 Sun Microsystems, Inc.";
203 static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.";
215 /* Pick version number out of sign-on message */
216 if (p = strstr(m_signon, VERSION)) {
217 p += strlen(VERSION) + 1 ;
218 for (q = p ; *q && *q != '\n'; q++) ;
220 version = (char *) m_malloc(q - p + 1, "version") ;
230 if (m_errexit && stoponerror) m_exit(m_errexit) ;
233 new = (SEARCH *) m_malloc(sizeof(SEARCH), "search path") ;
234 new->directory = indir ;
241 prebye = ftell(outfile) ;
243 if (glossary) checkgloss() ;
245 /* warn if we have forward xrefs */
246 if (have_forward_xrefs) {
251 outchar(m_textchar, outfile) ;
254 outpi(m_enttype, m_pi, m_entname) ;
259 where = WHERE (QTOC = TOC,
262 <START-CODE CHAPHEAD RSUB>
263 fputs(" ABBREV=\"", outfile);
264 <START-CODE CHAPHEAD RSECT>
266 (! m_wcmbupstrcmp(where, QFOOTER) ||
267 ! m_wcmbupstrcmp(where, QBOTH)) ;
271 fputs(" ABBREV=\"", outfile);
272 <START-CODE CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
273 fputs(" ABBREV=\"", outfile);
277 fputs(" ABBREV=\"", outfile);
278 <START-CODE CHAPHEAD CHAPTER, CHAPHEAD MESSAGE,
279 CHAPHEAD TEST, CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
280 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
281 CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD HOMETOPIC>
283 (! m_wcmbupstrcmp(where, QFOOTER) ||
284 ! m_wcmbupstrcmp(where, QBOTH)) ;
288 fputs(" ABBREV=\"", outfile);
290 M_WCHAR *wc_stago, *wc_tagc;
292 wc_stago = MakeWideCharString(m_stago);
293 wc_tagc = MakeWideCharString(m_tagc);
296 (! m_wcmbupstrcmp(where, QFOOTER) ||
297 ! m_wcmbupstrcmp(where, QBOTH)) ;
301 m_err2("Unimplemented %sABBREV%s reached", wc_stago, wc_tagc);
302 m_free(wc_stago,"wide character string");
303 m_free(wc_tagc,"wide character string");
306 fputs("\"", outfile);
311 static char abstract[] = "-ABSTRACT";
312 char id[SDLNAMESIZ+sizeof(abstract)];
315 needabstracthead = TRUE;
316 sprintf(id, "%s%s", sdlReservedName, abstract);
317 mb_starthelpnode("_ABSTRACT", id, 0);
321 outchar(m_textchar, outfile);
325 mb_strcode("<KEY CLASS=\"ACRO\">", outfile) ;
327 mb_echohead(m_stago);
328 echohead(m_parent(0)) ;
332 mb_strcode("</KEY>", outfile) ;
333 if (echo) mb_echohead(m_net) ;
337 <END-CODE * EXAMPLESEG, * IMAGE>
340 indexchar(m_textchar) ;
342 outchar(wc_toupper(m_textchar), outfile) ;
355 mb_strcode("<HEAD CLASS=\"ANNOTATION\" TYPE=\"DYNAMIC\" SSI=\"ANNOT-",
357 mb_strcode(stackex ? "STACK\">" : "SIDE\">", outfile);
359 mb_strcode("</HEAD>", outfile);
360 savehead[svheadlen] = '\0';
366 mb_strcode("<KEY CLASS=\"BOOK\">", outfile) ;
368 mb_echohead(m_stago) ;
369 echohead(m_parent(0)) ;
373 mb_strcode("</KEY>", outfile) ;
374 if (echo) mb_echohead(m_net) ;
379 indexchar(m_textchar) ;
390 fputs("<SUBHEAD TYPE=\"LINED\" SSI=\"CAPTION-NUMBERED\"", outfile);
393 "<HEAD TYPE=\"LINED\" CLASS=\"CAPTION\" SSI=\"CAPTION%s\"",
398 savehead[svheadlen] = M_EOS ;
401 mb_strcode(">", outfile);
402 strcode(savehead, outfile);
404 fputs("</SUBHEAD>", outfile);
414 startrow = STARTROW ;
421 emsghead = USERHEAD ;
423 <END-CODE CHAPTER, RSECT, S1, S2, S3, S4, S5, S6, S7,
424 S8, S9, TEST, HOMETOPIC, MESSAGE>
426 mb_strcode(">", outfile);
427 strcode(savehead, outfile);
429 /* Non node headings */
430 <END-CODE RSUB, MSGSUB, PROCEDURE>
432 mb_strcode(">", outfile);
433 strcode(savehead, outfile);
434 fputs("</HEAD>\n", outfile);
435 /* Non node headings */
438 fputs("</HEAD>\n", outfile);
449 wc_chapter = MakeWideCharString("CHAPTER");
451 assert_hometopic_exists();
454 starthelpnode(wc_chapter, id, thisnodelevel);
455 m_free(wc_chapter, "wide character string");
463 if (echo) mb_echohead("((") ;
464 mb_strcode("(", outfile) ;
465 outchar (m_textchar, outfile) ;
466 mb_strcode(")", outfile) ;
467 if (echo) mb_echohead("))") ;
472 indexchar(m_textchar) ;
477 mb_strcode("<KEY CLASS=\"MACH-OUT\">", outfile) ;
478 if (echo) mb_echohead("``") ;
481 mb_strcode("</KEY>", outfile) ;
482 if (echo) mb_echohead("''") ;
484 esoutchar(m_textchar) ;
486 exoutchar(m_textchar) ;
487 <TEXT-CODE * EXAMPLESEG>
488 exoutchar(m_textchar) ;
493 indexchar(m_textchar) ;
497 static char copyright[] = "-COPYRIGHT";
498 char id[SDLNAMESIZ+sizeof(copyright)];
500 sprintf(id, "%s%s", sdlReservedName, copyright);
501 mb_starthelpnode("_COPYRIGHT", id, 0);
502 /* No Head. Let author have a clean slate. */
509 mb_echohead(m_stago) ;
510 echohead(m_parent(0)) ;
514 if (echo) mb_echohead(m_net) ;
516 esoutchar(m_textchar) ;
517 <TEXT-CODE * EXAMPLESEG>
518 exoutchar(m_textchar) ;
523 indexchar(m_textchar) ;
536 /* trim possible (perhaps) last space */
537 if (termp - term > 1 && *(termp-1) == ' ') {
540 if (!(lastTermId = (int) m_lookfortrie(term, >ree)))
542 lastTermId = NextId();
543 m_ntrtrie(term, >ree, (void *) -lastTermId);
548 if (!m_resettrie(>ree, term, (void *) -lastTermId))
550 m_error("Internal error. Can't reset glossary trie") ;
555 lastTermId = -lastTermId;
558 termchar(m_textchar) ;
560 termpi(m_enttype, m_pi, m_entname) ;
564 mb_strcode("<KEY CLASS=\"EMPH\">", outfile) ;
565 if (echo) mb_echohead("!!") ;
567 mb_strcode("</KEY>", outfile) ;
568 if (echo) mb_echohead("!!") ;
573 indexchar(m_textchar) ;
579 indexchar(m_textchar) ;
581 static M_WCHAR ch[2];
584 strcode(ch, outfile);
587 mb_echohead(m_stago) ;
588 echohead(m_parent(0)) ;
592 if (echo) mb_echohead(m_net) ;
596 type = TYPE (QCOMPUTER = COMPUTER,
597 QDISPLAY = DISPLAY) ;
598 position = POSITION (QLEFT = LEFT,
601 notes = NOTES (QSIDE = SIDE,
604 lines = LINES (QNUMBER = NUMBER,
605 QNONUMBER = NONUMBER) ;
606 textsize = TEXTSIZE (QNORMAL = NORMAL,
608 QSMALLEST = SMALLEST) ;
610 StartEx(notes, lines, textsize);
613 tonumexlines = FALSE;
614 fputs(saveex, outfile);
615 fputs("</BLOCK>\n", outfile);
618 outchar(m_textchar, outfile) ;
627 saveexseg = mb_malloc(1);
629 svheadlen = 0; /* we save any <annotation> text in "savehead" */
634 exoutchar(m_textchar);
638 PushForm(NULL, "EXPLAIN", NULL);
643 tonumber = TONUMBER (QNUMBER = NUMBER,
644 QNONUMBER = NONUMBER) ;
647 figpos = FIGPOS (QLEFT = LEFT,
650 cappos = CAPPOS (QLEFT = LEFT,
653 oldtype = OLDTYPE (QART = ART,
658 xwidth = WIDTH (QFULL = FULL,
660 QCURRENT = CURRENT) ;
661 xdepth = HEIGHT (QNATURAL = NATURAL) ;
664 border = BORDER (QTOP = TOP,
669 type = TYPE (QART = ART,
677 xmagnify = MAGNIFY (QFIT = FIT) ;
678 video = VIDEO (QINVERSE = INVERSE,
679 QNOINVERSE = NOINVERSE) ;
680 strip = STRIP (QSTRIP = STRIP,
681 QNOSTRIP = NOSTRIP) ;
682 mirror = MIRROR (QMIRROR = MIRROR) ;
685 penwidth = PENWIDTH ;
686 snap = SNAP (QSNAP = SNAP,
688 autoscale = AUTOSCALE (QAUTOSCALE = AUTOSCALE,
689 QNOAUTOSCALE = NOAUTOSCALE) ;
690 plottype = PLOTTYPE ;
692 textsize = TEXTSIZE (QNORMAL = NORMAL,
694 QSMALLEST = SMALLEST) ;
695 ghyperlink = GHYPERLINK ;
696 glinktype = GLINKTYPE (QJUMP = JUMP,
697 QJUMPNEWVIEW = JUMPNEWVIEW,
698 QDEFINITION = DEFINITION,
700 QAPPDEFINED = APPDEFINED,
702 gdescription = GDESCRIPTION ;
714 if (ftonumber | (svheadlen != 0))
716 fputs("</HEAD>", outfile);
719 fputs("\n</REFITEM>\n</SNREF>", outfile);
722 fputs("</LINK>\n", outfile);
725 fputs("</P>\n", outfile);
728 /* When implementing, check conditionals of <FOOTNOTE> in <P> */
729 <TEXT-CODE * EXAMPLESEG, * IMAGE>
730 outchar(m_textchar, outfile) ;
740 PushForm(NULL, NULL, NULL);
745 GetDefaultHeaderString("GlossaryElementDefaultHeadingString",
748 static char glossary_string[] = "-GLOSSARY";
749 char id[SDLNAMESIZ+sizeof(glossary_string)];
752 sprintf(id, "%s%s", sdlReservedName, glossary_string);
753 mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
754 if (strlen(string) + 1 > sizeof(chapstring)) {
755 m_error("Program error: exceeded chapstring") ;
758 snprintf(chapstring, sizeof(chapstring), "%s", string) ;
759 fputs("\nGlossary\n", stderr) ;
761 fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
762 m_free(string, "default header string return");
772 unsigned char etype, wheredef ;
773 /* Code from figstart */
775 mbstowcs(xrefstring, "\\<xref graphic>", 400);
776 xstrlen = w_strlen(xrefstring) ;
777 m_getline(&xrffile, &xrfline) ;
778 if (xrffile == NULL) {
779 /* set to primary input source */
792 /* initialize some stuff first:
793 - file is the entity name,
794 - f_file is the content of the entity,
795 used only if f_content nonNULL
796 - f_content is f_file with the relative pathname, initialized to NULL,
797 - f_contqual is fully qualified f_file, assigned ONLY IF
802 f_contqual[0] = M_EOS ;
804 /* check ENTITY and determine the figure type */
806 m_lookent(file, &etype, &f_file, &wheredef) ;
807 if (etype != M_SYSTEM) {
808 M_WCHAR *wc_stago, *wc_tagc, *wc_entsystem, *wc_entkw;
810 wc_stago = MakeWideCharString(m_stago);
811 wc_tagc = MakeWideCharString(m_tagc);
812 wc_entsystem = MakeWideCharString(m_entsystem);
813 wc_entkw = MakeWideCharString(m_entkw);
814 m_err6("%s not a %s %s, as required for the ENTITY parameter of %s%s%s",
821 m_free(wc_stago,"wide character string");
822 m_free(wc_tagc,"wide character string");
823 m_free(wc_entsystem,"wide character string");
824 m_free(wc_entkw,"wide character string");
828 f_content = searchforfile(f_file) ;
830 if (getqualified(f_contqual, f_content)) {
831 /* unsuccessful qual */
832 if (w_strlen(f_content) < FNAMELEN)
833 w_strcpy(f_contqual, f_content) ;
835 m_err1("Internal error. File name too long: %s", f_content) ;
841 m_err2("Can't find file %s (declared in entity %s)", f_file, file) ;
847 char *mb_content, snb_id[32];
849 static M_WCHAR empty[1];
852 if (!f_content) f_content = empty;
854 mb_content = MakeMByteString(f_content);
855 sprintf(snb_id, "%s%d", sdlReservedName, NextId());
856 mb_strcode("<SNREF", outfile);
861 mb_id = MakeMByteString(id);
862 sprintf(buffer, " ID=\"%s\"", mb_id);
863 mb_strcode(buffer, outfile);
864 m_free(mb_id,"multi-byte string");
867 ">\n<REFITEM RID=\"%s\" CLASS=\"IN-LINE\"></REFITEM>\n</SNREF>",
869 mb_strcode(buffer, outfile);
870 AddToSNB(snb_id, mb_content);
871 m_free(mb_content,"multi-byte string");
875 /* Accent headings */
876 <START-CODE NOTE, CAUTION, WARNING>
879 fputs("<HEAD TYPE=\"LINED\" SSI=\"NCW\">", outfile);
881 <START-CODE LABLIST, IMAGE, LIST, EX, P>
884 ssi = MakeMByteString(m_parent(1));
886 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
887 m_free(ssi, "multi-byte string");
889 <START-CODE CHAPHEAD CHAPTER,
890 CHAPHEAD RSECT, CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
891 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
892 CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD TEST,
893 CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE
897 ssi = MakeMByteString(m_parent(1));
903 savesnb = mb_malloc(1);
906 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
907 m_free(ssi, "multi-byte string");
908 /* Non node headings */
909 <START-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB>
912 ssi = MakeMByteString(m_parent(1));
919 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
920 m_free(ssi, "multi-byte string");
921 /* Non node headings */
922 <START-CODE CHAPHEAD PROCEDURE>
929 fputs("<HEAD TYPE=\"LINED\" SSI=\"PROCEDURE\"", outfile);
930 /* Non node headings */
931 <START-CODE OTHERHEAD>
934 ssi = MakeMByteString(m_parent(1));
940 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
941 m_free(ssi, "multi-byte string");
943 <START-CODE CHAPHEAD>
944 M_WCHAR *wc_stago, *wc_tagc;
946 wc_stago = MakeWideCharString(m_stago);
947 wc_tagc = MakeWideCharString(m_tagc);
948 m_err2("Unimplemented %sCHAPHEAD%s reached", wc_stago, wc_tagc);
949 m_free(wc_stago,"wide character string");
950 m_free(wc_tagc,"wide character string");
951 /* Non-node headings */
952 <START-CODE FRONTSUB>
955 ssi = MakeMByteString(m_parent(1));
958 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
959 m_free(ssi, "multi-byte string");
960 /* Non-node headings */
961 <START-CODE ABSTRACT>
964 needabstracthead = FALSE;
965 fputs("<HEAD TYPE=\"LINED\" SSI=\"ABSTRACT\">", outfile);
967 <START-CODE OTHERFRONT>
968 had_an_otherfront_head = TRUE;
974 fputs("<HEAD TYPE=\"LINED\" SSI=\"METAINFO\">", outfile);
977 /* Other headings (mixed content) */
980 fputs("</HEAD>", outfile);
981 /* Accent and Other headings (no mixed content) */
982 <END-CODE LABLIST, LIST, EX, NOTE, CAUTION, WARNING>
983 fputs("</HEAD>\n", outfile);
984 /* Non node headings */
985 <END-CODE ABSTRACT, FRONTSUB, MESSAGE>
989 <END-CODE CHAPHEAD CHAPTER,
990 CHAPHEAD RSECT, CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
991 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6, CHAPHEAD S7,
992 CHAPHEAD S8, CHAPHEAD S9, CHAPHEAD TEST,
993 CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE>
996 savehead[svheadlen] = '\0';
998 /* Non node headings */
999 <END-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
1002 savehead[svheadlen] = '\0';
1004 /* Non node headings */
1005 <END-CODE OTHERHEAD>
1007 fputs("</HEAD>\n", outfile);
1008 /* Node headings. */
1009 <END-CODE OTHERFRONT>
1012 /* Other headings. */
1015 fputs("</HEAD>", outfile);
1017 outchar(m_textchar, outfile) ;
1019 <ELEMENT HELPVOLUME>
1022 language = LANGUAGE (QENGLISH = ENGLISH,
1023 QNORWEGIAN = NORWEGIAN,
1031 QSPANISH = SPANISH) ;
1035 char hostname[BIGBUF];
1036 char **tossline = toss;
1037 char *mb_language, *mb_charset;
1040 ModifyEntities(); /* convert SDATA [......] to <spc name="[......]"> */
1042 if (!getenv("_DTHELPTAG_NO_UNIQUE_ID"))
1044 hostname[sizeof(hostname)-1] = '\0';
1045 gethostname(hostname, sizeof(hostname)-1);
1047 docId = mb_malloc(strlen(hostname)+1);
1048 strcpy(docId, hostname);
1050 timeStamp = time(0);
1061 "<SDLDOC %s=\"%s\" %s=\"%s\" %s=\"%ld\" %s=\"%s-%s\"",
1073 mb_language = MakeMByteString(helplang);
1074 fprintf(outfile, " %s=\"%s\"", "LANGUAGE", mb_language);
1075 mb_free(&mb_language);
1079 mb_charset = MakeMByteString(helpcharset);
1080 fprintf(outfile, " %s=\"%s\"", "CHARSET", mb_charset);
1081 mb_free(&mb_charset);
1083 fprintf(outfile, " %s=\"%s\">\n", "SDLDTD", "1.1.1");
1084 fprintf(outfile, "<VSTRUCT DOC-ID=\"%s\">\n", docId);
1085 fputs("<LOIDS>\n</LOIDS>\n", outfile);
1087 fputs("</VSTRUCT>\n", outfile);
1088 snbstart = ftell(outfile);
1090 assert_hometopic_exists();
1091 fputs("</SDLDOC>\n", outfile);
1097 fputs("&\n", outfile);
1100 <START-CODE CAPTION FIGURE>
1104 (sizeof(savehead) / sizeof(M_WCHAR)),
1106 "Too many characters in head or caption",
1108 <START-CODE HEAD CHAPHEAD, HEAD OTHERFRONT>
1110 fputs(" ", stderr) ;
1111 mb_strcode("\n", outfile) ;
1112 if (savid) shchar(' ',
1114 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1117 "Too many characters in corresponding cross-reference",
1121 (sizeof(savehead) / sizeof(M_WCHAR)),
1124 "Too many characters in head or caption",
1129 fputs("\n", outfile) ;
1131 <START-CODE HEAD P, HEAD IMAGE, HEAD LIST, HEAD LABLIST, HEAD EX,
1133 if (newhline++) fputc('\n', outfile) ;
1134 <END-CODE HEAD CHAPHEAD,
1138 putc('\n', stderr) ;
1139 <END-CODE HEAD ABSTRACT>
1140 putc('\n', stderr) ;
1145 static char hometopic[] = "-HOMETOPIC";
1146 char id[SDLNAMESIZ+sizeof(hometopic)];
1148 sprintf(id, "%s%s", sdlReservedName, hometopic);
1149 mb_starthelpnode("_HOMETOPIC", id, 1);
1150 nohometopic = FALSE;
1156 rule = RULE (QNORULE = NORULE,
1165 range = RANGE (QBEGIN = BEGIN,
1173 /* ignore <idx end>'s in cache creek */
1174 if (!range || (range && m_wcmbupstrcmp(range, QEND)) )
1176 char *mb_print, *mb_nospace1, *mb_nospace2, id[32];
1177 M_WCHAR *pwc, wnl, wsp;
1179 mbtowc(&wnl, "\n", 1);
1180 mbtowc(&wsp, " ", 1);
1183 while (pwc = w_strchr(pwc, wnl))
1185 mb_print = MakeMByteString(print);
1186 if (w_strlen(sort) > 0)
1191 while (pwc = w_strchr(pwc, wnl))
1193 mb_sort = MakeMByteString(sort);
1194 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1196 /* append subsort or subprint */
1200 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1202 while (pwc = w_strchr(pwc, wnl))
1204 mb_sub = MakeMByteString(pwcSub);
1206 /* strip trailing spaces */
1207 mb_nospace1 = mb_sort;
1208 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1209 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1210 mb_nospace2 = mb_sub;
1211 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1212 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1214 /* strip leading spaces */
1215 mb_nospace1 = mb_sort;
1216 while (*mb_nospace1++ == ' '); --mb_nospace1;
1217 mb_nospace2 = mb_sub;
1218 while (*mb_nospace2++ == ' '); --mb_nospace2;
1220 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1221 m_free(mb_sub,"multi-byte string");
1225 /* strip trailing spaces */
1226 mb_nospace1 = mb_sort;
1227 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1228 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1230 /* strip leading spaces */
1231 mb_nospace1 = mb_sort;
1232 while (*mb_nospace1++ == ' '); --mb_nospace1;
1234 fprintf(indexfp, "%s", mb_nospace1);
1236 m_free(mb_sort,"multi-byte string");
1239 { /* use print field */
1240 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1242 /* append subsort or subprint */
1246 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1248 while (pwc = w_strchr(pwc, wnl))
1250 mb_sub = MakeMByteString(pwcSub);
1252 /* strip trailing spaces */
1253 mb_nospace1 = mb_print;
1254 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1255 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1256 mb_nospace2 = mb_sub;
1257 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1258 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1260 /* strip leading spaces */
1261 mb_nospace1 = mb_print;
1262 while (*mb_nospace1++ == ' '); --mb_nospace1;
1263 mb_nospace2 = mb_sub;
1264 while (*mb_nospace2++ == ' '); --mb_nospace2;
1266 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1267 m_free(mb_sub,"multi-byte string");
1271 /* strip trailing spaces */
1272 mb_nospace1 = mb_print;
1273 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1274 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1276 /* strip leading spaces */
1277 mb_nospace1 = mb_print;
1278 while (*mb_nospace1++ == ' '); --mb_nospace1;
1280 fprintf(indexfp, "%s", mb_nospace1);
1283 putc('\036' /* ascii record separator */, indexfp);
1286 if (w_strlen(subprint) > 0)
1291 while (pwc = w_strchr(pwc, wnl))
1293 mb_subprint = MakeMByteString(subprint);
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 mb_nospace2 = mb_subprint;
1300 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1301 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1303 /* strip leading spaces */
1304 mb_nospace1 = mb_print;
1305 while (*mb_nospace1++ == ' '); --mb_nospace1;
1306 mb_nospace2 = mb_subprint;
1307 while (*mb_nospace2++ == ' '); --mb_nospace2;
1309 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1310 m_free(mb_subprint,"multi-byte string");
1314 /* strip trailing spaces */
1315 mb_nospace1 = mb_print;
1316 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1317 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1319 /* strip leading spaces */
1320 mb_nospace1 = mb_print;
1321 while (*mb_nospace1++ == ' '); --mb_nospace1;
1323 fprintf(indexfp, "%s", mb_nospace1);
1325 m_free(mb_print,"multi-byte string");
1326 putc('\036' /* ascii record separator */, indexfp);
1333 sprintf(id, "%s%d", sdlReservedName, NextId());
1334 fprintf(outfile, "<ANCHOR ID=\"%s\">", id);
1336 fputs("\n", indexfp);
1341 parTextId = NextId();
1342 sprintf(id, "%s%d", sdlReservedName, parTextId);
1344 fputs("\n", indexfp);
1351 mb_nodeid = MakeMByteString(nodeid);
1352 fputs(mb_nodeid, indexfp);
1353 fputs("\n", indexfp);
1354 m_free(mb_nodeid,"multi-byte string");
1357 fprintf(indexfp, "%s-HOMETOPIC\n", sdlReservedName);
1360 indexchar(m_textchar) ;
1367 gposition = GPOSITION (QLEFT = LEFT,
1369 ghyperlink = GHYPERLINK ;
1370 glinktype = GLINKTYPE (QJUMP = JUMP,
1371 QJUMPNEWVIEW = JUMPNEWVIEW,
1372 QDEFINITION = DEFINITION,
1374 QAPPDEFINED = APPDEFINED,
1376 gdescription = GDESCRIPTION ;
1378 <C variable> = NUMBER ;
1382 imagegentityp = gentity;
1383 imagegpositionp = gposition;
1384 imageghyperlinkp = ghyperlink;
1385 imageglinktypep = glinktype;
1386 imagegdescription = gdescription;
1389 StartBlock(NULL, NULL, NULL);
1392 fputs("<P TYPE=\"LITERAL\"", outfile);
1395 m_free(imageId,"multi-byte string");
1396 imageId = MakeMByteString(id);
1397 fprintf(outfile, " ID=\"%s\"", imageId);
1398 savid = checkid(id);
1400 fputs(" SSI=\"IMAGE", outfile);
1403 fputs("-INDENT", outfile);
1405 fputs("\">", outfile);
1408 fputs("</P>\n", outfile);
1410 imoutchar(m_textchar) ;
1416 wc_image = MakeWideCharString("IMAGE");
1417 handle_link_and_graphic(wc_image,
1423 m_free(wc_image,"wide character string");
1425 <ELEMENT INDEXPRIMARY>
1430 /* capture saved term unless <sort> got it already */
1432 idxsav[idxsavlen] = M_EOS;
1433 w_strcpy(print, idxsav);
1436 else { /* save the sort field */
1437 idxsav[idxsavlen] = M_EOS;
1438 w_strcpy(sort, idxsav);
1446 /* capture saved term unless <sort> got it already */
1448 idxsav[idxsavlen] = M_EOS;
1449 w_strcpy(subprint, idxsav);
1451 else { /* save the sort field */
1452 idxsav[idxsavlen] = M_EOS;
1453 w_strcpy(subsort, idxsav);
1457 <ELEMENT INPUT.....>
1459 if (echo) mb_echohead("``") ;
1462 if (echo) mb_echohead("''") ;
1468 if (lastlist->lastlist->type == PLAIN) {
1469 leaderok = TRUE ; /* allow <LEADER> only in <LIST PLAIN> */
1477 /* also does special handling for calculator--supers/subs */
1478 /*handles super and subs in keys */
1479 mb_strcode("<KEY CLASS=\"MACH-CONT\">", outfile) ;
1480 if (echo) mb_echohead("[[") ;
1482 mb_strcode("</KEY>", outfile) ;
1483 if (echo) mb_echohead("]]") ;
1485 esoutchar(m_textchar) ;
1492 indexchar(m_textchar) ;
1498 char *first, *loose, *wrap;
1501 if (listitems[list].firstitem)
1506 fputs("<FDATA>\n", outfile);
1510 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1511 wrap = (listitems[list].longlabel == WRAP) ? "" : " TYPE=\"LINED\"";
1512 labelid[list] = NextId();
1514 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"%s%s-LABEL\">\n",
1519 fprintf(outfile, "<P%s>", wrap);
1521 char *first, *loose;
1522 char ssi[BIGBUF], labelId[BIGBUF];
1524 fputs("</P>\n</BLOCK>\n", outfile);
1527 if (listitems[list].firstitem)
1530 listitems[list].firstitem = FALSE;
1532 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1533 sprintf(ssi, "%s%s", first, loose);
1535 sprintf(labelId, "%s%d", sdlReservedName, labelid[list]);
1537 PushForm2("ITEM", ssi, labelId, NULL);
1541 if (listitems[list].firstitem)
1543 listitems[list].firstitem = FALSE;
1545 labhid[list] = NextId();
1548 fputs("<FDATA>\n", outfile);
1552 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABH-%s\">\n",
1555 lablisttight[list] ? "TIGHT" : "LOOSE");
1556 fputs("<P TYPE=\"LINED\">", outfile);
1558 fputs("</P>\n</BLOCK>\n", outfile);
1562 labhtextid[list] = NextId();
1564 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABHTEXT-%s\">\n",
1567 lablisttight[list] ? "TIGHT" : "LOOSE");
1568 fputs("<P TYPE=\"LINED\">", outfile);
1570 char labh_id[SDLNAMESIZ + 10], labhtext_id[SDLNAMESIZ + 10];
1572 fputs("</P>\n</BLOCK>\n", outfile);
1574 strcpy(labh_id, sdlReservedName);
1575 m_itoa(labhid[list], labh_id + SDLNAMESIZ - 1);
1576 strcpy(labhtext_id, sdlReservedName);
1577 m_itoa(labhtextid[list], labhtext_id + SDLNAMESIZ - 1);
1578 Add2ToRowVec(&formStackTop->vecLen,
1579 &formStackTop->rowVec,
1587 longlabel = LONGLABEL (QWRAP = WRAP,
1590 spacing = SPACING (QTIGHT = TIGHT,
1593 StartLabList(spacing, longlabel);
1600 type = TYPE (QSPACE = SPACE,
1605 if (! m_wcmbupstrcmp(type, QDOTS))
1608 else if (! m_wcmbupstrcmp(type, QSPACE))
1613 M_WCHAR *wc_stago, *wc_tagc;
1615 wc_stago = MakeWideCharString(m_stago);
1616 wc_tagc = MakeWideCharString(m_tagc);
1617 m_err2("Internal error: element %sLEADER%s in tex.if",
1620 m_free(wc_stago,"wide character string");
1621 m_free(wc_tagc,"wide character string");
1626 M_WCHAR *wc_stago, *wc_tagc;
1628 wc_stago = MakeWideCharString(m_stago);
1629 wc_tagc = MakeWideCharString(m_tagc);
1630 m_err4("%sLEADER%s only allowed in %sLIST PLAIN%s",
1635 m_free(wc_stago,"wide character string");
1636 m_free(wc_tagc,"wide character string");
1643 char mb_xrefstring[400];
1647 "Preparing cross-reference to a line in an example without line numbers"
1649 sprintf(mb_xrefstring, "%d", exLineNum) ;
1650 mbstowcs(xrefstring, mb_xrefstring, 400);
1651 xstrlen = w_strlen(xrefstring) ;
1652 m_getline(&xrffile, &xrfline) ;
1653 if (xrffile == NULL) {
1654 /* set to primary input */
1655 xrffile = inputname;
1666 char *mb_id, buffer[BIGBUF];
1668 mb_id = MakeMByteString(id);
1669 sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1670 mb_strcode(buffer, outfile);
1671 m_free(mb_id,"multi-byte string");
1676 hyperlink = HYPERLINK ;
1677 type = TYPE (QJUMP = JUMP,
1678 QJUMPNEWVIEW = JUMPNEWVIEW,
1679 QDEFINITION = DEFINITION,
1681 QAPPDEFINED = APPDEFINED,
1683 description = DESCRIPTION ;
1685 HandleLink(hyperlink, type, description);
1687 /* reset link type to default. This is braindead, but enough.
1691 <link foo DEFINITION><XREF bar><\link>
1693 will do the right thing (remember that xref turns to an implicit link).
1694 Right_thing => xref becomes definition link.
1698 <link foo DEFINITION> <link fub> Test <\link> <xref bar> <\link>
1700 the xref will think that is supposed to become a link of type jump,
1701 not definition. This case is odd, so we won't worry about it.
1703 global_linktype = 0;
1704 mb_strcode("</LINK>", outfile);
1708 type = TYPE (QORDER = ORDER,
1713 order = ORDERTYPE (QUALPHA = UALPHA,
1718 spacing = SPACING (QTIGHT = TIGHT,
1722 StartList(type, order, spacing, cont) ;
1733 char buffer[BIGBUF];
1735 mb_id = MakeMByteString(id);
1736 sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1737 mb_strcode(buffer, outfile);
1738 m_free(mb_id,"multi-byte string");
1740 savid = checkid(id);
1747 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1750 "Too many characters in corresponding cross-reference",
1766 if (m_textchar == '"')
1767 { /* handle funny quote in memo bug */
1771 outchar(m_textchar, outfile);
1775 /* could need to handle calculator context sensitive entities
1776 * here if needed to reduce tex macro count
1780 outpi(m_enttype, m_pi, m_entname) ;
1789 mb_starthelpnode("MESSAGE", "", thisnodelevel);
1791 fprintf(stderr, "\nMessages.\n") ;
1792 emsghead = DEFHEAD ;
1801 PushForm(NULL, "MSG", NULL);
1808 fputs("<HEAD SSI=\"MSGNUM\">", outfile);
1810 fputs("</HEAD>\n", outfile);
1817 PushForm(NULL, NULL, NULL);
1820 savid = checkid(NULL) ; /* hook for possible future ID */
1828 StartBlock(NULL, "MSGTEXT", NULL);
1829 fputs("<P>", outfile);
1832 fputs("</P>\n", outfile);
1836 type = TYPE (QBEGIN = BEGIN,
1838 QTOGETHER = TOGETHER) ;
1843 fputs("&\n", outfile) ;
1844 <START-CODE * ABSTRACT>
1845 fputs("&\n", outfile) ;
1857 indexchar(m_textchar) ;
1859 <TEXT-CODE * EXAMPLESEG, * IMAGE>
1860 outchar(m_textchar, outfile) ;
1865 fputs("[", outfile);
1867 fputs("]", outfile);
1870 <ELEMENT OTHERFRONT>
1881 mb_id = MakeMByteString(id);
1882 mb_starthelpnode("METAINFO", mb_id, 0);
1884 m_free(mb_id, "multi-byte string");
1885 had_an_otherfront_head = FALSE;
1886 savid = checkid(id) ;
1890 if (id && !had_an_otherfront_head) {
1891 m_errline("You must use a <HEAD> tag after <OTHERFRONT>\n");
1896 PushForm(NULL, "OTHERHEAD", NULL);
1900 <ELEMENT OUTPUT....>
1902 if (echo) mb_echohead("``") ;
1905 if (echo) mb_echohead("''") ;
1912 gposition = GPOSITION (QLEFT = LEFT,
1914 ghyperlink = GHYPERLINK ;
1915 glinktype = GLINKTYPE (QJUMP = JUMP,
1916 QJUMPNEWVIEW = JUMPNEWVIEW,
1917 QDEFINITION = DEFINITION,
1919 QAPPDEFINED = APPDEFINED,
1921 gdescription = GDESCRIPTION ;
1932 fputs("\n</P>\n", outfile);
1937 mb_echohead(m_stago) ;
1938 echohead(m_parent(0)) ;
1939 mb_echohead(m_net) ; /* '|' */
1942 if (echo) mb_echohead(m_net) ; /* '|' */
1945 /* We perhaps should allow <parm> to be used in <idx>.
1946 Since we are now dependent on LaserROM, we just can't
1947 add it in (as an inclusion exception to idx).
1948 So, we take out the code that would inplement it and
1949 give an error message. */
1951 M_WCHAR *wc_stago, *wc_tagc;
1953 wc_stago = MakeWideCharString(m_stago);
1954 wc_tagc = MakeWideCharString(m_tagc);
1955 m_err4("%sPARM%s not allowed in %sIDX%s.",
1960 m_free(wc_stago,"wide character string");
1961 m_free(wc_tagc,"wide character string");
1964 indexchar(m_textchar) ;
1965 <START-CODE * CHAPHEAD>
1966 M_WCHAR *wc_stago, *wc_tagc;
1968 wc_stago = MakeWideCharString(m_stago);
1969 wc_tagc = MakeWideCharString(m_tagc);
1970 m_err2("%sPARM%s not allowed in headings.", wc_stago, wc_tagc);
1971 m_free(wc_stago,"wide character string");
1972 m_free(wc_tagc,"wide character string");
1973 <END-CODE * CHAPHEAD>
1975 <END-CODE * EXAMPLESEG, * IMAGE>
1979 <START-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
1981 savid = NULL; /* in case there was no head */
1989 <END-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
1995 PushForm("TEXT", "PROCEDURE", NULL);
2000 <START-CODE * ABBREV>
2001 mb_strcode("``", outfile) ;
2002 if (echo) putc('"', stderr) ;
2004 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"OPEN\"></KEY>", outfile) ;
2005 if (echo) putc('"', stderr) ;
2007 mb_strcode("''", outfile) ;
2008 if (echo) putc('"', stderr) ;
2010 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"CLOSE\"></KEY>", outfile) ;
2011 if (echo) putc('"', stderr) ;
2018 indexchar(m_textchar) ;
2020 <ELEMENT REFERENCES>
2025 fputs("{", outfile);
2027 fputs("}", outfile);
2032 pagebreak = PAGEBREAK (QNEWPAGE = NEWPAGE,
2033 QSAMEPAGE = SAMEPAGE) ;
2037 M_WCHAR *wc_rsect, *wc_helpvolume;
2039 wc_rsect = MakeWideCharString("RSECT");
2040 wc_helpvolume = MakeWideCharString("HELPVOLUME");
2043 assert_hometopic_exists();
2044 if (!rsectseq) thisnodelevel = thisnodelevel + 1;
2045 if (w_strcmp(m_parent(1), wc_helpvolume) != 0)
2048 starthelpnode(wc_rsect, id, thisnodelevel);
2051 starthelpnode(wc_rsect, id, 2);
2052 m_free(wc_rsect, "wide character string");
2053 m_free(wc_helpvolume, "wide character string");
2056 M_WCHAR *wc_helpvolume;
2058 wc_helpvolume = MakeWideCharString("HELPVOLUME");
2059 if (w_strcmp(m_parent(1), wc_helpvolume) == 0)
2061 m_free(wc_helpvolume, "wide character string");
2068 PushForm(NULL, NULL, NULL);
2070 PushForm(NULL, NULL, NULL);
2079 <START-CODE HELPVOLUME>
2082 wc_s1 = MakeWideCharString("S1");
2084 assert_hometopic_exists();
2086 starthelpnode(wc_s1, id, thisnodelevel);
2087 m_free(wc_s1, "wide character string");
2090 savid = checkid(id) ;
2095 wc_s1 = MakeWideCharString("S1");
2097 assert_hometopic_exists();
2100 starthelpnode(wc_s1, id, thisnodelevel);
2101 m_free(wc_s1, "wide character string");
2104 savid = checkid(id) ;
2106 <END-CODE HELPVOLUME>
2122 wc_s2 = MakeWideCharString("S2");
2126 starthelpnode(wc_s2, id, thisnodelevel);
2127 m_free(wc_s2, "wide character string");
2129 savid = checkid(id) ;
2143 wc_s3 = MakeWideCharString("S3");
2147 starthelpnode(wc_s3, id, thisnodelevel);
2148 m_free(wc_s3, "wide character string");
2150 savid = checkid(id) ;
2164 wc_s4 = MakeWideCharString("S4");
2168 starthelpnode(wc_s4, id, thisnodelevel);
2169 m_free(wc_s4, "wide character string");
2171 savid = checkid(id) ;
2185 wc_s5 = MakeWideCharString("S5");
2189 starthelpnode(wc_s5, id, thisnodelevel);
2190 m_free(wc_s5, "wide character string");
2192 savid = checkid(id) ;
2206 wc_s6 = MakeWideCharString("S6");
2210 starthelpnode(wc_s6, id, thisnodelevel);
2211 m_free(wc_s6, "wide character string");
2213 savid = checkid(id) ;
2227 wc_s7 = MakeWideCharString("S7");
2231 starthelpnode(wc_s7, id, thisnodelevel);
2232 m_free(wc_s7, "wide character string");
2234 savid = checkid(id) ;
2248 wc_s8 = MakeWideCharString("S8");
2252 starthelpnode(wc_s8, id, thisnodelevel);
2253 m_free(wc_s8, "wide character string");
2255 savid = checkid(id) ;
2269 wc_s9 = MakeWideCharString("S9");
2273 starthelpnode(wc_s9, id, thisnodelevel);
2274 m_free(wc_s9, "wide character string");
2276 savid = checkid(id) ;
2283 <START-CODE INDEXPRIMARY>
2285 idxsav[idxsavlen] = M_EOS;
2286 w_strcpy(print, idxsav);
2288 <END-CODE INDEXPRIMARY>
2289 idxsav[idxsavlen] = M_EOS;
2290 w_strcpy(sort, idxsav);
2291 <START-CODE INDEXSUB>
2293 idxsav[idxsavlen] = M_EOS;
2294 w_strcpy(subprint, idxsav);
2297 idxsav[idxsavlen] = M_EOS;
2298 w_strcpy(subsort, idxsav);
2305 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUB\">", outfile);
2306 mb_strcode("<SPHRASE CLASS=\"SUB\">", outfile);
2307 if (echo) mb_echohead("__") ;
2310 mb_strcode("</SPHRASE></KEY>", outfile);
2311 if (echo) mb_echohead("__") ;
2312 <TEXT-CODE * COMPUTER>
2313 outchar(m_textchar, outfile) ;
2315 indexchar(m_textchar) ;
2317 outchar(m_textchar, outfile) ;
2322 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUPER\">", outfile);
2323 mb_strcode("<SPHRASE CLASS=\"SUPER\">", outfile);
2324 if (echo) mb_echohead("^^") ;
2327 mb_strcode("</SPHRASE></KEY>", outfile);
2328 if (echo) mb_echohead("^^") ;
2329 <TEXT-CODE * COMPUTER>
2330 outchar(m_textchar, outfile) ;
2332 indexchar(m_textchar) ;
2334 outchar(m_textchar, outfile) ;
2337 <START-CODE OPTBLOCK, REQBLOCK>
2339 fputs("\n", outfile);
2341 <END-CODE OPTBLOCK, REQBLOCK>
2343 fputs("\n", outfile);
2345 outchar(m_textchar, outfile) ;
2351 StartBlock(NULL, NULL, NULL);
2352 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"SYNTAX\">");
2355 fputs("</P>\n", outfile);
2357 outchar(m_textchar, outfile) ;
2362 gloss = GLOSS (QGLOSS = GLOSS,
2363 QNOGLOSS = NOGLOSS) ;
2368 if (echo) mb_echohead("++") ;
2369 <END-CODE * GLOSSARY>
2370 endterm(base, gloss, "current"); /* don't use definition window for link */
2372 endterm(base, gloss, "popup"); /* use definition window for link */
2374 termchar(m_textchar) ;
2376 termpi(m_enttype, m_pi, m_entname) ;
2386 wc_test = MakeWideCharString("TEST");
2389 starthelpnode(wc_test, id, thisnodelevel);
2390 m_free(wc_test, "wide character string");
2393 savid = checkid(id) ;
2402 StartNCWtext("NOTE",
2403 "NoteElementDefaultIconFile",
2404 "NoteElementDefaultHeadingString");
2405 <START-CODE CAUTION>
2406 StartNCWtext("CAUTION",
2407 "CautionElementDefaultIconFile",
2408 "CautionElementDefaultHeadingString");
2409 <START-CODE WARNING>
2410 StartNCWtext("WARNING",
2411 "WarningElementDefaultIconFile",
2412 "WarningElementDefaultHeadingString");
2413 <START-CODE MESSAGE>
2414 PushForm(NULL, "MESSAGE", NULL);
2417 PushForm(NULL, "MSGSUB", NULL);
2418 <START-CODE ABSTRACT>
2419 if (needabstracthead)
2421 fputs("<HEAD SSI=\"CHAPHEAD\">", outfile);
2423 needabstracthead = FALSE;
2425 <START-CODE DEFINITION>
2427 char id[SDLNAMESIZ+10];
2429 sprintf(id, "%s%d", sdlReservedName, lastTermId);
2430 PushForm(NULL, NULL, id);
2431 StartBlock(NULL, "TERM", NULL);
2432 mb_strcode("<P SSI=\"P\">", outfile);
2433 strcode(term, outfile);
2434 mb_strcode("</P>\n", outfile);
2435 PushForm(NULL, "DEFINITION", NULL);
2437 <END-CODE DEFINITION>
2438 PopForm(); PopForm();
2440 if (formStackBase && (formStackTop >= formStackBase))
2442 if (formStackTop->vecLen == 1)
2443 StartBlock(NULL, NULL, NULL);
2448 fputs("</BLOCK>\n", outfile);
2454 fputs("<HEAD TYPE=\"LINED\" SSI=\"TITLE\">", outfile);
2461 char *mb_savehead, *ssi;
2462 static char title_string[] = "-TITLE";
2463 char id[SDLNAMESIZ+sizeof(title_string)];
2467 m_error("Error collecting title characters.");
2471 fputs("</HEAD>\n", outfile);
2473 sprintf(id, "%s%s", sdlReservedName, title_string);
2474 mb_starthelpnode("_TITLE", id, 0);
2476 ssi = MakeMByteString(m_parent(1));
2477 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
2478 savehead[svheadlen] = M_EOS ;
2479 mb_savehead = MakeMByteString(savehead);
2480 fputs(mb_savehead, outfile);
2481 m_free(mb_savehead,"multi-byte string");
2482 m_free(ssi,"multi-byte string");
2483 fputs("</HEAD>\n", outfile);
2486 savedtitle = (M_WCHAR *) m_malloc(w_strlen(savehead) + 1, "saved title");
2487 w_strcpy(savedtitle, savehead);
2492 mb_echohead(m_stago) ;
2493 echohead(m_parent(0)) ;
2494 mb_echohead(m_net) ;
2496 mb_strcode("<KEY CLASS=\"MACH-IN\">", outfile) ;
2498 esoutchar(m_textchar) ;
2500 if (echo) mb_echohead(m_net) ;
2501 mb_strcode("</KEY>", outfile) ;
2502 <TEXT-CODE * EXAMPLESEG>
2503 exoutchar(m_textchar) ;
2508 indexchar(m_textchar) ;
2512 mb_strcode("<KEY CLASS=\"NAME\">", outfile) ;
2513 if (echo) mb_echohead("%%") ;
2515 mb_strcode("</KEY>", outfile) ;
2516 if (echo) mb_echohead("%%") ;
2521 indexchar(m_textchar) ;
2523 <END-CODE * EXAMPLESEG, * IMAGE, * SYNEL>
2525 mb_strcode("</KEY>", outfile) ;
2527 /* added to fix calculator computer chars */
2529 if (m_textchar == M_SPACE) fputs("\\ ", outfile) ;
2530 else outchar(m_textchar, outfile) ;
2534 type = TYPE (QCOMPUTER = COMPUTER,
2535 QDISPLAY = DISPLAY) ;
2536 position = POSITION (QLEFT = LEFT,
2539 textsize = TEXTSIZE (QNORMAL = NORMAL,
2541 QSMALLEST = SMALLEST) ;
2547 StartBlock(NULL, "EX", NULL);
2548 tsize = vextextsize(textsize);
2549 if (tsize == SMALLEST)
2551 else if (tsize == SMALLER)
2555 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"EX-%s\">", ssi);
2558 fputs("</P>\n", outfile);
2559 fputs("</BLOCK>\n", outfile);
2562 vexoutchar(m_textchar) ;
2566 StartNCW("WARNING");
2569 /* Cross-referencing that allows forward references is inherently a two-pass
2570 process. However, this interface assumes a two-pass process. MARKUP
2571 provides the first pass and TeX the second. MARKUP can therefore define
2572 a TeX macro for every cross-reference and write a file of definitions of
2573 these macros that is read at the beginning of the TeX pass. In fact,
2574 information about cross-references is stored in a trie by MARKUP. Data is
2575 entered into this structure both when a cross-reference is defined (with
2576 an id parameter on a chapter, figure, etc.) and when it is used (with the
2577 xref element). At the end of the manual, the file xref.tex is written
2578 with definitions of macros corresponding to all cross-references defined
2579 or accessed. In addition, the file xreftbl is written to save this
2580 information in a form that can be read to initialize the trie the next
2581 time the manual is processed. Saving cross-reference information across
2582 runs of MARKUP allows a manual to be processed a chapter at a time without
2583 invalidating interchapter references. The file xreftbl should be
2584 deleted before final processing, however, to verify that no cross-references
2585 remain to an id that existed at one time and was deleted. Such an id could
2586 remain in the cross-reference table indefinitely.
2592 indexchar(m_textchar) ;