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 USER-DEFINED-ENTITIES SYSTEM "helptag.ent">
21 <!ENTITY MINUS SDATA "-">
22 <!ENTITY PM SDATA '[plusmn]'> /* ISOnum */
23 <!ENTITY DIV SDATA '[divide]'> /* ISOnum */
24 <!ENTITY TIMES SDATA '[times ]'> /* ISOnum */
25 <!ENTITY LEQ SDATA '[le ]'> /* ISOtech */
26 <!ENTITY GEQ SDATA '[ge ]'> /* ISOtech */
27 <!ENTITY NEQ SDATA '[ne ]'> /* ISOtech */
28 <!ENTITY COPY SDATA '[copy ]'> /* ISOnum */
29 <!ENTITY REG SDATA '[reg ]'> /* ISOnum */
30 <!ENTITY TM SDATA '[trade ]'> /* ISOnum */
31 <!ENTITY ELLIPSIS SDATA '[hellip]'> /* ISOpub */
32 <!ENTITY VELLIPSIS SDATA '[vellip]'> /* ISOpub */
33 <!ENTITY PELLIPSIS SDATA "...."> /* ellipsis followed by a period? */
34 <!ENTITY A.M. SDATA "a.m.">
35 <!ENTITY P.M. SDATA "p.m.">
36 <!ENTITY MINUTES SDATA '[prime ]'> /* ISOtech */
37 <!ENTITY SECONDS SDATA '[Prime ]'> /* ISOtech */
38 <!ENTITY DEG SDATA '[deg ]'> /* ISOnum */
39 <!ENTITY SQUOTE SDATA "`">
40 <!ENTITY DQUOTE SDATA '"'>
41 <!ENTITY ENDASH SDATA "-">
42 <!ENTITY EMDASH SDATA '[mdash ]'> /* ISOpub */
43 <!ENTITY VBLANK SDATA "_">
44 <!ENTITY CENTS SDATA '[cent ]'> /* ISOnum */
45 <!ENTITY STERLING SDATA '[pound ]'> /* ISOnum */
47 <!ENTITY SPACE SDATA " ">
48 <!ENTITY SIGSPACE SDATA "& ">
49 <!ENTITY SIGDASH SDATA "&-">
50 <!ENTITY MICRO SDATA '[micro ]'> /* ISOnum */
51 <!ENTITY OHM SDATA '[ohm ]'> /* ISOnum */
52 <!ENTITY UP SDATA '[uarr ]'> /* ISOnum */
53 <!ENTITY DOWN SDATA '[darr ]'> /* ISOnum */
54 <!ENTITY LEFT SDATA '[larr ]'> /* ISOnum */
55 <!ENTITY RIGHT SDATA '[rarr ]'> /* ISOnum */
56 <!ENTITY HOME SDATA "home key">
57 <!ENTITY BACK SDATA "\<--">
58 <!ENTITY DATE SDATA CODE>
64 nseconds = time(NULL);
65 timefoo = localtime(&nseconds);
66 strftime(s, maxsize, "%x", timefoo);
67 fprintf(outfile, "%s\n", s);
69 <!ENTITY TIME SDATA CODE>
75 nseconds = time(NULL);
76 timefoo = localtime(&nseconds);
77 strftime(s, maxsize, "%X", timefoo);
78 fprintf(outfile, "%s\n", s);
80 <!ENTITY HALFSPACE SDATA " ">
81 <!ENTITY M-SPECCHAR SDATA "Special characters">
83 /* Code entities for toggling debugging traces */
84 <!ENTITY m-aopt PI CODE>
85 m_malftrace = (LOGICAL) ! m_malftrace ;
88 <!ENTITY m-copt PI CODE>
89 m_chtrace = (LOGICAL) ! m_chtrace ;
92 <!ENTITY m-dopt PI CODE>
93 m_cdtrace = (LOGICAL) ! m_cdtrace ;
96 <!ENTITY m-hopt PI CODE>
97 m_heapchk = (LOGICAL) ! m_heapchk ;
100 <!ENTITY m-oopt PI CODE>
101 tracetostd = (LOGICAL) ! tracetostd ;
104 /* This option pertains to automatic index processing only (called by the
105 scripts only), so we don't need it in pi's.
107 <!ENTITY m-popt PI CODE>
108 parentsrch = (LOGICAL) ! parentsrch ;
113 <!ENTITY m-sopt PI CODE>
114 m_scantrace = (LOGICAL) ! m_scantrace ;
117 <!ENTITY m-topt PI CODE>
118 m_tagtrace = (LOGICAL) ! m_tagtrace ;
121 /* Code entities for MARKUP and HP Tag versions */
122 <!ENTITY m-markup-ver SDATA CODE>
124 M_WCHAR *wc_1, *wc_2;
126 wc_1 = MakeWideCharString(M_VERSION);
127 wc_2 = MakeWideCharString("m-markup-ver");
128 m_piaction(wc_1, wc_2, M_SDATA) ;
129 m_free(wc_1,"wide character string");
130 m_free(wc_2,"wide character string");
134 <!ENTITY m-tagver SDATA CODE>
136 M_WCHAR *wc_1, *wc_2;
138 wc_1 = MakeWideCharString(version);
139 wc_2 = MakeWideCharString("m-tagver");
140 m_piaction(wc_1, wc_2, M_SDATA) ;
141 m_free(wc_1,"wide character string");
142 m_free(wc_2,"wide character string");
146 <!ENTITY m-machine SDATA CODE>
148 m_piaction("VECTRA", "m-machine", M_SDATA) ;
152 M_WCHAR *wc_1, *wc_2;
154 wc_1 = MakeWideCharString("HPUX");
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("AIX");
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("SUN");
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("USL");
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("UXP");
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");
207 M_WCHAR *wc_1, *wc_2;
209 wc_1 = MakeWideCharString("OSF1");
210 wc_2 = MakeWideCharString("m-machine");
211 m_piaction(wc_1, wc_2, M_SDATA) ;
212 m_free(wc_1,"wide character string");
213 m_free(wc_2,"wide character string");
216 m_piaction("UNDEFINED MACHINE",
228 <SIGN-ON>CDE HelpTag Formatting System. - Version C.00.00 (DTD Version A.01.3)
233 static char ident1[]="@(#)CDE Help Tag Parser";
234 static char ident2[]="@(#)Version Number: C.00.00";
235 static char ident3[]="@(#) (c) Copyright 1993, 1994 Hewlett-Packard Company";
236 static char ident4[]="@(#) (c) Copyright 1993, 1994 International Business Machines Corp.";
237 static char ident5[]="@(#) (c) Copyright 1993, 1994 Sun Microsystems, Inc.";
238 static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc.";
249 /* Pick version number out of sign-on message */
250 if (p = strstr(m_signon, VERSION)) {
251 p += strlen(VERSION) + 1 ;
252 for (q = p ; *q && *q != '\n'; q++) ;
254 version = (char *) m_malloc(q - p + 1, "version") ;
261 /* Following: please refer to comments in custom.c, m_setoptions() */
263 if ((strchr(m_argv[2], 'p')) || (strchr(m_argv[2], 'P')))
264 parentsrch = TRUE ; /* Implies we are processing indexes */
270 if (m_errexit && stoponerror) m_exit(m_errexit) ;
273 new = (SEARCH *) m_malloc(sizeof(SEARCH), "search path") ;
274 new->directory = indir ;
283 prebye = ftell(outfile) ;
284 fseek(outfile, texcomplete, SEEK_SET) ;
285 fseek(outfile, 0L, SEEK_END) ;
287 if (glossary) checkgloss() ;
289 /* warn if we have forward xrefs */
290 if (have_forward_xrefs)
297 outchar(m_textchar, outfile) ;
300 outpi(m_enttype, m_pi, m_entname) ;
307 fputs(" ABBREV=\"", outfile);
308 <START-CODE CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
309 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6,
310 CHAPHEAD S7, CHAPHEAD S8, CHAPHEAD S9,
311 CHAPHEAD HOMETOPIC, CHAPHEAD CHAPTER,
312 CHAPHEAD MESSAGE, CHAPHEAD MSGSUB,
313 CHAPHEAD RSECT, CHAPHEAD RSUB,
315 fputs(" ABBREV=\"", outfile);
317 M_WCHAR *wc_stago, *wc_tagc;
319 wc_stago = MakeWideCharString(m_stago);
320 wc_tagc = MakeWideCharString(m_tagc);
322 m_err2("Unimplemented %sABBREV%s reached", wc_stago, wc_tagc);
323 m_free(wc_stago,"wide character string");
324 m_free(wc_tagc,"wide character string");
326 fputs("\"", outfile);
330 static char abstract[] = "-ABSTRACT";
331 char id[SDLNAMESIZ+sizeof(abstract)];
334 needabstracthead = TRUE;
335 sprintf(id, "%s%s", sdlReservedName, abstract);
336 mb_starthelpnode("_ABSTRACT", id, 0);
340 outchar(m_textchar, outfile);
343 <START-CODE * IDX, * EXAMPLESEG, * IMAGE>
345 mb_strcode("<KEY CLASS=\"ACRO\">", outfile) ;
347 mb_echohead(m_stago);
348 echohead(m_parent(0)) ;
351 <END-CODE * IDX, * EXAMPLESEG, * IMAGE>
353 mb_strcode("</KEY>", outfile) ;
354 if (echo) mb_echohead(m_net) ;
356 indexchar(m_textchar) ;
358 outchar(wc_toupper(m_textchar), outfile) ;
371 mb_strcode("<HEAD CLASS=\"ANNOTATION\" TYPE=\"DYNAMIC\" SSI=\"ANNOT-",
373 mb_strcode(stackex ? "STACK\">" : "SIDE\">", outfile);
375 mb_strcode("</HEAD>", outfile);
376 savehead[svheadlen] = '\0';
383 mb_strcode("<KEY CLASS=\"BOOK\">", outfile) ;
385 mb_echohead(m_stago) ;
386 echohead(m_parent(0)) ;
391 mb_strcode("</KEY>", outfile) ;
392 if (echo) mb_echohead(m_net) ;
394 indexchar(m_textchar) ;
405 fputs("<SUBHEAD TYPE=\"LINED\" SSI=\"CAPTION-NUMBERED\"", outfile);
408 "<HEAD TYPE=\"LINED\" CLASS=\"CAPTION\" SSI=\"CAPTION%s\"",
411 savehead[svheadlen] = M_EOS ;
414 mb_strcode(">", outfile);
415 strcode(savehead, outfile);
417 fputs("</SUBHEAD>", outfile);
426 emsghead = USERHEAD ;
428 <END-CODE CHAPTER, RSECT, S1, S2, S3, S4, S5, S6, S7,
429 S8, S9, HOMETOPIC, MESSAGE>
431 mb_strcode(">", outfile);
432 strcode(savehead, outfile);
434 /* Non node headings */
435 <END-CODE RSUB, MSGSUB, PROCEDURE>
437 mb_strcode(">", outfile);
438 strcode(savehead, outfile);
439 fputs("</HEAD>\n", outfile);
440 /* Non node headings */
443 fputs("</HEAD>\n", outfile);
451 wc_chapter = MakeWideCharString("CHAPTER");
453 assert_hometopic_exists();
456 starthelpnode(wc_chapter, id, thisnodelevel);
457 m_free(wc_chapter, "wide character string");
468 indexchar(m_textchar) ;
471 if (echo) mb_echohead("((") ;
472 mb_strcode("(", outfile) ;
473 outchar (m_textchar, outfile) ;
474 mb_strcode(")", outfile) ;
475 if (echo) mb_echohead("))") ;
480 mb_strcode("<KEY CLASS=\"MACH-OUT\">", outfile) ;
481 if (echo) mb_echohead("``") ;
484 mb_strcode("</KEY>", outfile) ;
485 if (echo) mb_echohead("''") ;
487 indexchar(m_textchar) ;
488 <TEXT-CODE * IMAGE, * EXAMPLESEG>
489 exoutchar(m_textchar) ;
491 esoutchar(m_textchar) ;
495 static char copyright[] = "-COPYRIGHT";
496 char id[SDLNAMESIZ+sizeof(copyright)];
498 sprintf(id, "%s%s", sdlReservedName, copyright);
499 mb_starthelpnode("_COPYRIGHT", id, 0);
500 /* No Head. Let author have a clean slate. */
515 /* trim possible (perhaps) last space */
516 if (termp - term > 1 && *(termp-1) == ' ') {
519 if (!(lastTermId = (int)(intptr_t) m_lookfortrie(term, >ree)))
521 lastTermId = NextId();
522 m_ntrtrie(term, >ree, (void *)(intptr_t) -lastTermId);
527 if (!m_resettrie(>ree, term, (void *)(intptr_t) -lastTermId))
529 m_error("Internal error. Can't reset glossary trie") ;
534 lastTermId = -lastTermId;
536 termchar(m_textchar) ;
538 termpi(m_enttype, m_pi, m_entname) ;
543 mb_strcode("<KEY CLASS=\"EMPH\">", outfile) ;
544 if (echo) mb_echohead("!!") ;
547 mb_strcode("</KEY>", outfile) ;
548 if (echo) mb_echohead("!!") ;
550 indexchar(m_textchar) ;
556 mb_echohead(m_stago) ;
557 echohead(m_parent(0)) ;
562 if (echo) mb_echohead(m_net) ;
564 indexchar(m_textchar) ;
566 static M_WCHAR ch[2];
569 strcode(ch, outfile);
573 notes = NOTES (QSIDE = SIDE,
575 lines = LINES (QNUMBER = NUMBER,
576 QNONUMBER = NONUMBER) ;
577 textsize = TEXTSIZE (QNORMAL = NORMAL,
579 QSMALLEST = SMALLEST) ;
581 StartEx(notes, lines, textsize);
584 tonumexlines = FALSE;
585 fputs(saveex, outfile);
586 fputs("</BLOCK>\n", outfile);
589 outchar(m_textchar, outfile) ;
598 saveexseg = mb_malloc(1);
600 svheadlen = 0; /* we save any <annotation> text in "savehead" */
605 exoutchar(m_textchar);
609 PushForm(NULL, "EXPLAIN", NULL);
614 tonumber = TONUMBER (QNUMBER = NUMBER,
615 QNONUMBER = NONUMBER) ;
618 figpos = FIGPOS (QLEFT = LEFT,
622 ghyperlink = GHYPERLINK ;
623 glinktype = GLINKTYPE (QJUMP = JUMP,
624 QJUMPNEWVIEW = JUMPNEWVIEW,
625 QDEFINITION = DEFINITION,
627 QAPPDEFINED = APPDEFINED,
629 gdescription = GDESCRIPTION ;
632 cappos += 3; /* bump over the "CAP" */
643 if (ftonumber | (svheadlen != 0))
645 fputs("</HEAD>", outfile);
648 fputs("\n</REFITEM>\n</SNREF>", outfile);
651 fputs("</LINK>\n", outfile);
654 fputs("</P>\n", outfile);
657 /* When implementing, check conditionals of <FOOTNOTE> in <P> */
658 <TEXT-CODE * EXAMPLESEG, * IMAGE>
659 outchar(m_textchar, outfile) ;
664 <START-CODE OTHERFRONT>
665 if (!had_an_otherfront_head) {
668 PushForm(NULL, NULL, NULL);
670 PushForm(NULL, NULL, NULL);
675 GetDefaultHeaderString("GlossaryElementDefaultHeadingString",
678 static char glossary_string[] = "-GLOSSARY";
679 char id[SDLNAMESIZ+sizeof(glossary_string)];
682 sprintf(id, "%s%s", sdlReservedName, glossary_string);
683 mb_starthelpnode("_GLOSSARY", id, thisnodelevel);
684 if (strlen(string) + 1 > sizeof(chapstring)) {
685 m_error("Program error: exceeded chapstring") ;
688 snprintf(chapstring, sizeof(chapstring), "%s", string) ;
689 fputs("\nGlossary\n", stderr) ;
691 fprintf(outfile, "<HEAD SSI=\"CHAPHEAD\">%s</HEAD>\n", string);
692 m_free(string, "default header string return");
704 unsigned char etype, wheredef ;
705 /* Code from figstart */
707 mbstowcs(xrefstring, "\\<xref graphic>", 400);
708 xstrlen = w_strlen(xrefstring) ;
709 m_getline(&xrffile, &xrfline) ;
710 if (xrffile == NULL) {
711 /* set to primary input source */
724 /* initialize some stuff first:
725 - file is the entity name,
726 - f_file is the content of the entity,
727 used only if f_content nonNULL
728 - f_content is f_file with the relative pathname, initialized to NULL,
729 - f_contqual is fully qualified f_file, assigned ONLY IF
734 f_contqual[0] = M_EOS ;
736 /* check ENTITY and determine the figure type */
738 m_lookent(file, &etype, &f_file, &wheredef) ;
739 if (etype != M_SYSTEM) {
740 M_WCHAR *wc_stago, *wc_tagc, *wc_entsystem, *wc_entkw;
742 wc_stago = MakeWideCharString(m_stago);
743 wc_tagc = MakeWideCharString(m_tagc);
744 wc_entsystem = MakeWideCharString(m_entsystem);
745 wc_entkw = MakeWideCharString(m_entkw);
746 m_err6("%s not a %s %s, as required for the ENTITY parameter of %s%s%s",
753 m_free(wc_stago,"wide character string");
754 m_free(wc_tagc,"wide character string");
755 m_free(wc_entsystem,"wide character string");
756 m_free(wc_entkw,"wide character string");
760 f_content = searchforfile(f_file) ;
762 if (getqualified(f_contqual, f_content)) {
763 /* unsuccessful qual */
764 if (w_strlen(f_content) < FNAMELEN)
765 w_strcpy(f_contqual, f_content) ;
767 m_err1("Internal error. File name too long: %s", f_content) ;
773 m_err2("Can't find file %s (declared in entity %s)", f_file, file) ;
779 char *mb_content, snb_id[32];
781 static M_WCHAR empty[1];
784 if (!f_content) f_content = empty;
786 mb_content = MakeMByteString(f_content);
787 sprintf(snb_id, "%s%d", sdlReservedName, NextId());
788 mb_strcode("<SNREF", outfile);
793 mb_id = MakeMByteString(id);
794 sprintf(buffer, " ID=\"%s\"", mb_id);
795 mb_strcode(buffer, outfile);
796 m_free(mb_id,"multi-byte string");
799 ">\n<REFITEM RID=\"%s\" CLASS=\"IN-LINE\"></REFITEM>\n</SNREF>",
801 mb_strcode(buffer, outfile);
802 AddToSNB(snb_id, mb_content);
803 m_free(mb_content,"multi-byte string");
807 /* Accent headings */
808 <START-CODE NOTE, CAUTION, WARNING>
811 fputs("<HEAD TYPE=\"LINED\" SSI=\"NCW\">", outfile);
813 <START-CODE LABLIST, IMAGE, LIST, EX, P>
816 ssi = MakeMByteString(m_parent(1));
818 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
819 m_free(ssi, "multi-byte string");
821 <START-CODE CHAPHEAD CHAPTER, CHAPHEAD RSECT,
822 CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE,
823 CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
824 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6,
825 CHAPHEAD S7, CHAPHEAD S8, CHAPHEAD S9
829 ssi = MakeMByteString(m_parent(1));
835 savesnb = mb_malloc(1);
838 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
839 m_free(ssi, "multi-byte string");
840 /* Non node headings */
841 <START-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB>
844 ssi = MakeMByteString(m_parent(1));
851 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\"", ssi);
852 m_free(ssi, "multi-byte string");
853 /* Non node headings */
854 <START-CODE CHAPHEAD PROCEDURE>
861 fputs("<HEAD TYPE=\"LINED\" SSI=\"PROCEDURE\"", outfile);
862 /* Non node headings */
863 <START-CODE OTHERHEAD>
866 ssi = MakeMByteString(m_parent(1));
872 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
873 m_free(ssi, "multi-byte string");
875 <START-CODE CHAPHEAD>
876 M_WCHAR *wc_stago, *wc_tagc;
878 wc_stago = MakeWideCharString(m_stago);
879 wc_tagc = MakeWideCharString(m_tagc);
880 m_err2("Unimplemented %sCHAPHEAD%s reached", wc_stago, wc_tagc);
881 m_free(wc_stago,"wide character string");
882 m_free(wc_tagc,"wide character string");
883 /* Non-node headings */
884 <START-CODE FRONTSUB, SYNTAX>
887 ssi = MakeMByteString(m_parent(1));
890 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
891 m_free(ssi, "multi-byte string");
892 /* Non-node headings */
893 <START-CODE ABSTRACT>
896 needabstracthead = FALSE;
897 fputs("<HEAD TYPE=\"LINED\" SSI=\"ABSTRACT\">", outfile);
899 <START-CODE OTHERFRONT>
900 had_an_otherfront_head = TRUE;
906 fputs("<HEAD TYPE=\"LINED\" SSI=\"METAINFO\">", outfile);
907 /* Other headings (mixed content) */
910 fputs("</HEAD>", outfile);
911 /* Accent and Other headings (no mixed content) */
912 <END-CODE LABLIST, LIST, EX, NOTE, CAUTION, WARNING>
913 fputs("</HEAD>\n", outfile);
914 /* Non node headings */
915 <END-CODE ABSTRACT, FRONTSUB, MESSAGE, SYNTAX>
919 <END-CODE CHAPHEAD CHAPTER, CHAPHEAD RSECT,
920 CHAPHEAD HOMETOPIC, CHAPHEAD MESSAGE,
921 CHAPHEAD S1, CHAPHEAD S2, CHAPHEAD S3,
922 CHAPHEAD S4, CHAPHEAD S5, CHAPHEAD S6,
923 CHAPHEAD S7, CHAPHEAD S8, CHAPHEAD S9>
926 savehead[svheadlen] = '\0';
928 /* Non node headings */
929 <END-CODE CHAPHEAD RSUB, CHAPHEAD MSGSUB, CHAPHEAD PROCEDURE>
932 savehead[svheadlen] = '\0';
934 /* Non node headings */
937 fputs("</HEAD>\n", outfile);
939 <END-CODE OTHERFRONT>
942 /* Other headings. */
944 fputs("</HEAD>", outfile);
946 outchar(m_textchar, outfile) ;
950 char hostname[BIGBUF];
951 char **tossline = toss;
952 char *mb_language, *mb_charset;
955 ModifyEntities(); /* convert SDATA [......] to <spc name="[......]"> */
957 if (!getenv("_DTHELPTAG_NO_UNIQUE_ID"))
959 hostname[sizeof(hostname)-1] = '\0';
960 gethostname(hostname, sizeof(hostname)-1);
962 docId = mb_malloc(strlen(hostname)+1);
963 strcpy(docId, hostname);
976 "<SDLDOC %s=\"%s\" %s=\"%s\" %s=\"%ld\" %s=\"%s-%s\"",
988 mb_language = MakeMByteString(helplang);
989 fprintf(outfile, " %s=\"%s\"", "LANGUAGE", mb_language);
990 mb_free(&mb_language);
994 mb_charset = MakeMByteString(helpcharset);
995 fprintf(outfile, " %s=\"%s\"", "CHARSET", mb_charset);
996 mb_free(&mb_charset);
998 fprintf(outfile, " %s=\"%s\">\n", "SDLDTD", "1.1.1");
999 fprintf(outfile, "<VSTRUCT DOC-ID=\"%s\">\n", docId);
1000 fputs("<LOIDS>\n</LOIDS>\n", outfile);
1002 fputs("</VSTRUCT>\n", outfile);
1003 snbstart = ftell(outfile);
1005 assert_hometopic_exists();
1006 fputs("</SDLDOC>\n", outfile);
1010 static char hometopic[] = "-HOMETOPIC";
1011 char id[SDLNAMESIZ+sizeof(hometopic)];
1013 sprintf(id, "%s%s", sdlReservedName, hometopic);
1014 mb_starthelpnode("_HOMETOPIC", id, 1);
1015 nohometopic = FALSE;
1029 /* ignore <idx end>'s in cache creek */
1031 char *mb_print, *mb_nospace1, *mb_nospace2, id[32];
1032 M_WCHAR *pwc, wnl, wsp;
1034 mbtowc(&wnl, "\n", 1);
1035 mbtowc(&wsp, " ", 1);
1038 while (pwc = w_strchr(pwc, wnl))
1040 mb_print = MakeMByteString(print);
1041 if (w_strlen(sort) > 0)
1046 while (pwc = w_strchr(pwc, wnl))
1048 mb_sort = MakeMByteString(sort);
1049 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1051 /* append subsort or subprint */
1055 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1057 while (pwc = w_strchr(pwc, wnl))
1059 mb_sub = MakeMByteString(pwcSub);
1061 /* strip trailing spaces */
1062 mb_nospace1 = mb_sort;
1063 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1064 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1065 mb_nospace2 = mb_sub;
1066 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1067 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1069 /* strip leading spaces */
1070 mb_nospace1 = mb_sort;
1071 while (*mb_nospace1++ == ' '); --mb_nospace1;
1072 mb_nospace2 = mb_sub;
1073 while (*mb_nospace2++ == ' '); --mb_nospace2;
1075 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1076 m_free(mb_sub,"multi-byte string");
1080 /* strip trailing spaces */
1081 mb_nospace1 = mb_sort;
1082 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1083 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1085 /* strip leading spaces */
1086 mb_nospace1 = mb_sort;
1087 while (*mb_nospace1++ == ' '); --mb_nospace1;
1089 fprintf(indexfp, "%s", mb_nospace1);
1091 m_free(mb_sort,"multi-byte string");
1094 { /* use print field */
1095 if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0)
1097 /* append subsort or subprint */
1101 pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint;
1103 while (pwc = w_strchr(pwc, wnl))
1105 mb_sub = MakeMByteString(pwcSub);
1107 /* strip trailing spaces */
1108 mb_nospace1 = mb_print;
1109 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1110 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1111 mb_nospace2 = mb_sub;
1112 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1113 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1115 /* strip leading spaces */
1116 mb_nospace1 = mb_print;
1117 while (*mb_nospace1++ == ' '); --mb_nospace1;
1118 mb_nospace2 = mb_sub;
1119 while (*mb_nospace2++ == ' '); --mb_nospace2;
1121 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1122 m_free(mb_sub,"multi-byte string");
1126 /* strip trailing spaces */
1127 mb_nospace1 = mb_print;
1128 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1129 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1131 /* strip leading spaces */
1132 mb_nospace1 = mb_print;
1133 while (*mb_nospace1++ == ' '); --mb_nospace1;
1135 fprintf(indexfp, "%s", mb_nospace1);
1138 putc('\036' /* ascii record separator */, indexfp);
1141 if (w_strlen(subprint) > 0)
1146 while (pwc = w_strchr(pwc, wnl))
1148 mb_subprint = MakeMByteString(subprint);
1150 /* strip trailing spaces */
1151 mb_nospace1 = mb_print;
1152 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1153 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1154 mb_nospace2 = mb_subprint;
1155 while (*mb_nospace2++); --mb_nospace2; /* end of string */
1156 while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0';
1158 /* strip leading spaces */
1159 mb_nospace1 = mb_print;
1160 while (*mb_nospace1++ == ' '); --mb_nospace1;
1161 mb_nospace2 = mb_subprint;
1162 while (*mb_nospace2++ == ' '); --mb_nospace2;
1164 fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2);
1165 m_free(mb_subprint,"multi-byte string");
1169 /* strip trailing spaces */
1170 mb_nospace1 = mb_print;
1171 while (*mb_nospace1++); --mb_nospace1; /* end of string */
1172 while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0';
1174 /* strip leading spaces */
1175 mb_nospace1 = mb_print;
1176 while (*mb_nospace1++ == ' '); --mb_nospace1;
1178 fprintf(indexfp, "%s", mb_nospace1);
1180 m_free(mb_print,"multi-byte string");
1181 putc('\036' /* ascii record separator */, indexfp);
1188 sprintf(id, "%s%d", sdlReservedName, NextId());
1189 fprintf(outfile, "<ANCHOR ID=\"%s\">", id);
1191 fputs("\n", indexfp);
1196 parTextId = NextId();
1197 sprintf(id, "%s%d", sdlReservedName, parTextId);
1199 fputs("\n", indexfp);
1206 mb_nodeid = MakeMByteString(nodeid);
1207 fputs(mb_nodeid, indexfp);
1208 fputs("\n", indexfp);
1209 m_free(mb_nodeid,"multi-byte string");
1212 fprintf(indexfp, "%s-HOMETOPIC\n", sdlReservedName);
1215 indexchar(m_textchar) ;
1221 gposition = GPOSITION (QLEFT = LEFT,
1223 ghyperlink = GHYPERLINK ;
1224 glinktype = GLINKTYPE (QJUMP = JUMP,
1225 QJUMPNEWVIEW = JUMPNEWVIEW,
1226 QDEFINITION = DEFINITION,
1228 QAPPDEFINED = APPDEFINED,
1230 gdescription = GDESCRIPTION ;
1234 imagegentityp = gentity;
1235 imagegpositionp = gposition;
1236 imageghyperlinkp = ghyperlink;
1237 imageglinktypep = glinktype;
1238 imagegdescription = gdescription;
1241 StartBlock(NULL, NULL, NULL);
1244 fputs("<P TYPE=\"LITERAL\"", outfile);
1247 m_free(imageId,"multi-byte string");
1248 imageId = MakeMByteString(id);
1249 fprintf(outfile, " ID=\"%s\"", imageId);
1250 savid = checkid(id);
1252 fputs(" SSI=\"IMAGE", outfile);
1255 fputs("-INDENT", outfile);
1257 fputs("\">", outfile);
1260 fputs("</P>\n", outfile);
1262 imoutchar(m_textchar) ;
1264 <ELEMENT INDEXPRIMARY>
1269 /* capture saved term unless <sort> got it already */
1271 idxsav[idxsavlen] = M_EOS;
1272 w_strcpy(print, idxsav);
1275 else { /* save the sort field */
1276 idxsav[idxsavlen] = M_EOS;
1277 w_strcpy(sort, idxsav);
1285 /* capture saved term unless <sort> got it already */
1287 idxsav[idxsavlen] = M_EOS;
1288 w_strcpy(subprint, idxsav);
1290 else { /* save the sort field */
1291 idxsav[idxsavlen] = M_EOS;
1292 w_strcpy(subsort, idxsav);
1305 mb_strcode("<KEY CLASS=\"MACH-CONT\">", outfile) ;
1306 if (echo) mb_echohead("[[") ;
1310 mb_strcode("</KEY>", outfile) ;
1311 if (echo) mb_echohead("]]") ;
1313 indexchar(m_textchar) ;
1315 esoutchar(m_textchar) ;
1319 char *first, *loose, *wrap;
1322 if (listitems[list].firstitem)
1327 fputs("<FDATA>\n", outfile);
1331 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1332 wrap = (listitems[list].longlabel == WRAP) ? "" : " TYPE=\"LINED\"";
1333 labelid[list] = NextId();
1335 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"%s%s-LABEL\">\n",
1340 fprintf(outfile, "<P%s>", wrap);
1342 char *first, *loose;
1343 char ssi[BIGBUF], labelId[BIGBUF];
1345 fputs("</P>\n</BLOCK>\n", outfile);
1348 if (listitems[list].firstitem)
1351 listitems[list].firstitem = FALSE;
1353 loose = lablisttight[list] ? "TIGHT" : "LOOSE";
1354 sprintf(ssi, "%s%s", first, loose);
1356 sprintf(labelId, "%s%d", sdlReservedName, labelid[list]);
1358 PushForm2("ITEM", ssi, labelId, NULL);
1362 if (listitems[list].firstitem)
1364 listitems[list].firstitem = FALSE;
1366 labhid[list] = NextId();
1369 fputs("<FDATA>\n", outfile);
1373 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABH-%s\">\n",
1376 lablisttight[list] ? "TIGHT" : "LOOSE");
1377 fputs("<P TYPE=\"LINED\">", outfile);
1379 fputs("</P>\n</BLOCK>\n", outfile);
1383 labhtextid[list] = NextId();
1385 "<BLOCK ID=\"%s%d\" CLASS=\"ITEM\" SSI=\"LABHTEXT-%s\">\n",
1388 lablisttight[list] ? "TIGHT" : "LOOSE");
1389 fputs("<P TYPE=\"LINED\">", outfile);
1391 char labh_id[SDLNAMESIZ + 10], labhtext_id[SDLNAMESIZ + 10];
1393 fputs("</P>\n</BLOCK>\n", outfile);
1395 strcpy(labh_id, sdlReservedName);
1396 m_itoa(labhid[list], labh_id + SDLNAMESIZ - 1);
1397 strcpy(labhtext_id, sdlReservedName);
1398 m_itoa(labhtextid[list], labhtext_id + SDLNAMESIZ - 1);
1399 Add2ToRowVec(&formStackTop->vecLen,
1400 &formStackTop->rowVec,
1408 longlabel = LONGLABEL (QWRAP = WRAP,
1410 spacing = SPACING (QTIGHT = TIGHT,
1413 StartLabList(spacing, longlabel);
1418 <ELEMENT LABLISTITEM>
1424 char mb_xrefstring[400];
1428 "Preparing cross-reference to a line in an example without line numbers"
1430 sprintf(mb_xrefstring, "%d", exLineNum) ;
1431 mbstowcs(xrefstring, mb_xrefstring, 400);
1432 xstrlen = w_strlen(xrefstring) ;
1433 m_getline(&xrffile, &xrfline) ;
1434 if (xrffile == NULL) {
1435 /* set to primary input */
1436 xrffile = inputname;
1447 char *mb_id, buffer[BIGBUF];
1449 mb_id = MakeMByteString(id);
1450 sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1451 mb_strcode(buffer, outfile);
1452 m_free(mb_id,"multi-byte string");
1457 hyperlink = HYPERLINK ;
1458 type = TYPE (QJUMP = JUMP,
1459 QJUMPNEWVIEW = JUMPNEWVIEW,
1460 QDEFINITION = DEFINITION,
1462 QAPPDEFINED = APPDEFINED,
1464 description = DESCRIPTION ;
1466 HandleLink(hyperlink, type, description);
1468 /* reset link type to default. This is braindead, but enough.
1472 <link foo DEFINITION><XREF bar></link>
1474 will do the right thing (remember that xref turns to an implicit link).
1475 Right_thing => xref becomes definition link.
1479 <link foo DEFINITION> <link fub> Test </link> <xref bar> </link>
1481 the xref will think that is supposed to become a link of type jump,
1482 not definition. This case is odd, so we won't worry about it.
1484 global_linktype = 0;
1485 mb_strcode("</LINK>", outfile);
1489 type = TYPE (QORDER = ORDER,
1494 order = ORDERTYPE (QUALPHA = UALPHA,
1499 spacing = SPACING (QTIGHT = TIGHT,
1503 StartList(type, order, spacing, cont) ;
1514 char buffer[BIGBUF];
1516 mb_id = MakeMByteString(id);
1517 sprintf(buffer, "<ANCHOR ID=\"%s\">", mb_id);
1518 mb_strcode(buffer, outfile);
1519 m_free(mb_id,"multi-byte string");
1521 savid = checkid(id);
1528 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1531 "Too many characters in corresponding cross-reference",
1547 if (m_textchar == '"')
1548 { /* handle funny quote in memo bug */
1552 outchar(m_textchar, outfile);
1556 /* could need to handle calculator context sensitive entities
1557 * here if needed to reduce tex macro count
1561 outpi(m_enttype, m_pi, m_entname) ;
1567 mb_starthelpnode("MESSAGE", "", thisnodelevel);
1569 fprintf(stderr, "\nMessages.\n") ;
1570 emsghead = DEFHEAD ;
1579 PushForm(NULL, "MSG", NULL);
1586 fputs("<HEAD SSI=\"MSGNUM\">", outfile);
1588 fputs("</HEAD>\n", outfile);
1595 PushForm(NULL, NULL, NULL);
1598 savid = checkid(NULL) ; /* hook for possible future ID */
1606 StartBlock(NULL, "MSGTEXT", NULL);
1607 fputs("<P>", outfile);
1610 fputs("</P>\n", outfile);
1613 <START-CODE * TITLE, * HEAD, * ABBREV, * CAPTION>
1614 mb_strcode("\n", outfile);
1616 fputs("&\n", outfile) ;
1625 fputs("[", outfile);
1627 fputs("]", outfile);
1629 <ELEMENT OTHERFRONT>
1638 mb_id = MakeMByteString(id);
1639 mb_starthelpnode("METAINFO", mb_id, 0);
1641 m_free(mb_id, "multi-byte string");
1642 had_an_otherfront_head = FALSE;
1643 savid = checkid(id) ;
1647 if (id && !had_an_otherfront_head) {
1648 m_errline("You must use a <HEAD> tag after <OTHERFRONT>\n");
1653 PushForm(NULL, "OTHERHEAD", NULL);
1661 gposition = GPOSITION (QLEFT = LEFT,
1663 ghyperlink = GHYPERLINK ;
1664 glinktype = GLINKTYPE (QJUMP = JUMP,
1665 QJUMPNEWVIEW = JUMPNEWVIEW,
1666 QDEFINITION = DEFINITION,
1668 QAPPDEFINED = APPDEFINED,
1670 gdescription = GDESCRIPTION ;
1682 fputs("\n</P>\n", outfile);
1685 <START-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
1689 wc_image = MakeWideCharString("IMAGE");
1690 handle_link_and_graphic(wc_image,
1696 m_free(wc_image,"wide character string");
1701 savid = NULL; /* in case there was no head */
1709 <END-CODE INDEXPRIMARY, INDEXSUB, * ABBREV>
1710 <END-CODE HEAD CHAPHEAD,
1714 putc('\n', stderr) ;
1716 <END-CODE HEAD ABSTRACT>
1717 putc('\n', stderr) ;
1724 mbtowc(&wc_nl, "\n", 1);
1725 if (m_textchar == wc_nl)
1726 fputs("&\n", outfile);
1728 outchar(m_textchar, outfile);
1729 <TEXT-CODE CAPTION FIGURE>
1732 mbtowc(&wc_nl, "\n", 1);
1733 if (m_textchar == wc_nl)
1736 (sizeof(savehead) / sizeof(M_WCHAR)),
1738 "Too many characters in head or caption",
1741 outchar(m_textchar, outfile);
1742 <TEXT-CODE HEAD CHAPHEAD, HEAD OTHERFRONT>
1745 mbtowc(&wc_nl, "\n", 1);
1746 if (m_textchar == wc_nl) {
1747 fputs(" ", stderr) ;
1748 mb_strcode("\n", outfile) ;
1749 if (savid) shchar(' ',
1751 (sizeof(xrefstring) / sizeof(M_WCHAR)),
1754 "Too many characters in corresponding cross-reference",
1758 (sizeof(savehead) / sizeof(M_WCHAR)),
1761 "Too many characters in head or caption",
1765 outchar(m_textchar, outfile);
1769 mbtowc(&wc_nl, "\n", 1);
1770 if (m_textchar == wc_nl)
1771 fputs("\n", outfile) ;
1773 outchar(m_textchar, outfile);
1774 <TEXT-CODE HEAD P, HEAD IMAGE, HEAD LIST,
1775 HEAD EX, HEAD SYNTAX, HEAD LABLIST>
1778 mbtowc(&wc_nl, "\n", 1);
1779 if (m_textchar == wc_nl)
1780 fputc('\n', outfile) ;
1782 outchar(m_textchar, outfile);
1786 PushForm("TEXT", "PROCEDURE", NULL);
1791 <START-CODE * ABBREV>
1792 mb_strcode("``", outfile) ;
1793 if (echo) putc('"', stderr) ;
1795 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"OPEN\"></KEY>", outfile) ;
1796 if (echo) putc('"', stderr) ;
1798 mb_strcode("''", outfile) ;
1799 if (echo) putc('"', stderr) ;
1801 mb_strcode("<KEY CLASS=\"QUOTE\" SSI=\"CLOSE\"></KEY>", outfile) ;
1802 if (echo) putc('"', stderr) ;
1809 indexchar(m_textchar) ;
1814 fputs("{", outfile);
1816 fputs("}", outfile);
1822 M_WCHAR *wc_rsect, *wc_helpvolume;
1824 wc_rsect = MakeWideCharString("RSECT");
1825 wc_helpvolume = MakeWideCharString("HELPVOLUME");
1828 assert_hometopic_exists();
1829 if (!rsectseq) thisnodelevel = thisnodelevel + 1;
1830 if (w_strcmp(m_parent(1), wc_helpvolume) != 0)
1833 starthelpnode(wc_rsect, id, thisnodelevel);
1836 starthelpnode(wc_rsect, id, 2);
1837 m_free(wc_rsect, "wide character string");
1838 m_free(wc_helpvolume, "wide character string");
1841 M_WCHAR *wc_helpvolume;
1843 wc_helpvolume = MakeWideCharString("HELPVOLUME");
1844 if (w_strcmp(m_parent(1), wc_helpvolume) == 0)
1846 m_free(wc_helpvolume, "wide character string");
1850 PushForm(NULL, NULL, NULL);
1852 PushForm(NULL, NULL, NULL);
1859 <START-CODE HELPVOLUME>
1862 wc_s1 = MakeWideCharString("S1");
1864 assert_hometopic_exists();
1866 starthelpnode(wc_s1, id, thisnodelevel);
1867 m_free(wc_s1, "wide character string");
1870 savid = checkid(id) ;
1875 wc_s1 = MakeWideCharString("S1");
1877 assert_hometopic_exists();
1880 starthelpnode(wc_s1, id, thisnodelevel);
1881 m_free(wc_s1, "wide character string");
1884 savid = checkid(id) ;
1886 <END-CODE HELPVOLUME>
1900 wc_s2 = MakeWideCharString("S2");
1904 starthelpnode(wc_s2, id, thisnodelevel);
1905 m_free(wc_s2, "wide character string");
1907 savid = checkid(id) ;
1919 wc_s3 = MakeWideCharString("S3");
1923 starthelpnode(wc_s3, id, thisnodelevel);
1924 m_free(wc_s3, "wide character string");
1926 savid = checkid(id) ;
1938 wc_s4 = MakeWideCharString("S4");
1942 starthelpnode(wc_s4, id, thisnodelevel);
1943 m_free(wc_s4, "wide character string");
1945 savid = checkid(id) ;
1957 wc_s5 = MakeWideCharString("S5");
1961 starthelpnode(wc_s5, id, thisnodelevel);
1962 m_free(wc_s5, "wide character string");
1964 savid = checkid(id) ;
1976 wc_s6 = MakeWideCharString("S6");
1980 starthelpnode(wc_s6, id, thisnodelevel);
1981 m_free(wc_s6, "wide character string");
1983 savid = checkid(id) ;
1995 wc_s7 = MakeWideCharString("S7");
1999 starthelpnode(wc_s7, id, thisnodelevel);
2000 m_free(wc_s7, "wide character string");
2002 savid = checkid(id) ;
2014 wc_s8 = MakeWideCharString("S8");
2018 starthelpnode(wc_s8, id, thisnodelevel);
2019 m_free(wc_s8, "wide character string");
2021 savid = checkid(id) ;
2033 wc_s9 = MakeWideCharString("S9");
2037 starthelpnode(wc_s9, id, thisnodelevel);
2038 m_free(wc_s9, "wide character string");
2040 savid = checkid(id) ;
2047 <START-CODE INDEXPRIMARY>
2049 idxsav[idxsavlen] = M_EOS;
2050 w_strcpy(print, idxsav);
2052 <END-CODE INDEXPRIMARY>
2053 idxsav[idxsavlen] = M_EOS;
2054 w_strcpy(sort, idxsav);
2055 <START-CODE INDEXSUB>
2057 idxsav[idxsavlen] = M_EOS;
2058 w_strcpy(subprint, idxsav);
2061 idxsav[idxsavlen] = M_EOS;
2062 w_strcpy(subsort, idxsav);
2069 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUB\">", outfile);
2070 mb_strcode("<SPHRASE CLASS=\"SUB\">", outfile);
2071 if (echo) mb_echohead("__") ;
2074 mb_strcode("</SPHRASE></KEY>", outfile);
2075 if (echo) mb_echohead("__") ;
2076 <TEXT-CODE * COMPUTER>
2077 outchar(m_textchar, outfile) ;
2079 indexchar(m_textchar) ;
2081 outchar(m_textchar, outfile) ;
2086 mb_strcode("<KEY CLASS=\"UDEFKEY\" SSI=\"SUPER\">", outfile);
2087 mb_strcode("<SPHRASE CLASS=\"SUPER\">", outfile);
2088 if (echo) mb_echohead("^^") ;
2091 mb_strcode("</SPHRASE></KEY>", outfile);
2092 if (echo) mb_echohead("^^") ;
2093 <TEXT-CODE * COMPUTER>
2094 outchar(m_textchar, outfile) ;
2096 indexchar(m_textchar) ;
2098 outchar(m_textchar, outfile) ;
2101 <START-CODE OPTBLOCK, REQBLOCK>
2103 fputs("\n", outfile);
2105 <END-CODE OPTBLOCK, REQBLOCK>
2107 fputs("\n", outfile);
2109 outchar(m_textchar, outfile) ;
2115 StartBlock(NULL, NULL, NULL);
2116 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"SYNTAX\">");
2119 fputs("</P>\n", outfile);
2121 outchar(m_textchar, outfile) ;
2126 gloss = GLOSS (QGLOSS = GLOSS,
2127 QNOGLOSS = NOGLOSS) ;
2132 if (echo) mb_echohead("++") ;
2133 <END-CODE * GLOSSARY>
2134 endterm(base, gloss, "current"); /* don't use definition window for link */
2136 endterm(base, gloss, "popup"); /* use definition window for link */
2138 termchar(m_textchar) ;
2140 termpi(m_enttype, m_pi, m_entname) ;
2144 StartNCWtext("NOTE",
2145 "NoteElementDefaultIconFile",
2146 "NoteElementDefaultHeadingString");
2147 <START-CODE CAUTION>
2148 StartNCWtext("CAUTION",
2149 "CautionElementDefaultIconFile",
2150 "CautionElementDefaultHeadingString");
2151 <START-CODE WARNING>
2152 StartNCWtext("WARNING",
2153 "WarningElementDefaultIconFile",
2154 "WarningElementDefaultHeadingString");
2155 <START-CODE MESSAGE>
2156 PushForm(NULL, "MESSAGE", NULL);
2159 PushForm(NULL, "MSGSUB", NULL);
2160 <START-CODE ABSTRACT>
2161 if (needabstracthead)
2163 fputs("<HEAD SSI=\"CHAPHEAD\">", outfile);
2165 needabstracthead = FALSE;
2167 <START-CODE DEFINITION>
2169 char id[SDLNAMESIZ+10];
2171 sprintf(id, "%s%d", sdlReservedName, lastTermId);
2172 PushForm(NULL, NULL, id);
2173 StartBlock(NULL, "TERM", NULL);
2174 mb_strcode("<P SSI=\"P\">", outfile);
2175 strcode(term, outfile);
2176 mb_strcode("</P>\n", outfile);
2177 PushForm(NULL, "DEFINITION", NULL);
2179 <END-CODE DEFINITION>
2180 PopForm(); PopForm();
2182 if (formStackBase && (formStackTop >= formStackBase))
2184 if (formStackTop->vecLen == 1)
2185 StartBlock(NULL, NULL, NULL);
2190 fputs("</BLOCK>\n", outfile);
2196 fputs("<HEAD TYPE=\"LINED\" SSI=\"TITLE\">", outfile);
2203 char *mb_savehead, *ssi;
2204 static char title_string[] = "-TITLE";
2205 char id[SDLNAMESIZ+sizeof(title_string)];
2209 m_error("Error collecting title characters.");
2213 fputs("</HEAD>\n", outfile);
2215 sprintf(id, "%s%s", sdlReservedName, title_string);
2216 mb_starthelpnode("_TITLE", id, 0);
2218 ssi = MakeMByteString(m_parent(1));
2219 fprintf(outfile, "<HEAD TYPE=\"LINED\" SSI=\"%s\">", ssi);
2220 savehead[svheadlen] = M_EOS ;
2221 mb_savehead = MakeMByteString(savehead);
2222 fputs(mb_savehead, outfile);
2223 m_free(mb_savehead,"multi-byte string");
2224 m_free(ssi,"multi-byte string");
2225 fputs("</HEAD>\n", outfile);
2228 savedtitle = (M_WCHAR *) m_malloc(w_strlen(savehead) + 1, "saved title");
2229 w_strcpy(savedtitle, savehead);
2234 mb_echohead(m_stago) ;
2235 echohead(m_parent(0)) ;
2236 mb_echohead(m_net) ;
2238 mb_strcode("<KEY CLASS=\"MACH-IN\">", outfile) ;
2240 esoutchar(m_textchar) ;
2242 if (echo) mb_echohead(m_net) ;
2243 mb_strcode("</KEY>", outfile) ;
2244 <TEXT-CODE * EXAMPLESEG>
2245 exoutchar(m_textchar) ;
2250 indexchar(m_textchar) ;
2254 mb_strcode("<KEY CLASS=\"NAME\">", outfile) ;
2255 if (echo) mb_echohead("%%") ;
2257 mb_strcode("</KEY>", outfile) ;
2258 if (echo) mb_echohead("%%") ;
2263 indexchar(m_textchar) ;
2265 <END-CODE * EXAMPLESEG, * IMAGE, * SYNEL>
2266 mb_strcode("</KEY>", outfile) ;
2268 /* added to fix calculator computer chars */
2270 if (m_textchar == M_SPACE) fputs("\\ ", outfile) ;
2271 else outchar(m_textchar, outfile) ;
2275 textsize = TEXTSIZE (QNORMAL = NORMAL,
2277 QSMALLEST = SMALLEST) ;
2283 StartBlock(NULL, "EX", NULL);
2284 tsize = vextextsize(textsize);
2285 if (tsize == SMALLEST)
2287 else if (tsize == SMALLER)
2291 fprintf(outfile, "<P TYPE=\"LITERAL\" SSI=\"EX-%s\">", ssi);
2294 fputs("</P>\n", outfile);
2295 fputs("</BLOCK>\n", outfile);
2298 vexoutchar(m_textchar) ;
2302 StartNCW("WARNING");
2305 /* Cross-referencing that allows forward references is inherently a two-pass
2306 process. However, this interface assumes a two-pass process. MARKUP
2307 provides the first pass and TeX the second. MARKUP can therefore define
2308 a TeX macro for every cross-reference and write a file of definitions of
2309 these macros that is read at the beginning of the TeX pass. In fact,
2310 information about cross-references is stored in a trie by MARKUP. Data is
2311 entered into this structure both when a cross-reference is defined (with
2312 an id parameter on a chapter, figure, etc.) and when it is used (with the
2313 xref element). At the end of the manual, the file xref.tex is written
2314 with definitions of macros corresponding to all cross-references defined
2315 or accessed. In addition, the file xreftbl is written to save this
2316 information in a form that can be read to initialize the trie the next
2317 time the manual is processed. Saving cross-reference information across
2318 runs of MARKUP allows a manual to be processed a chapter at a time without
2319 invalidating interchapter references. The file xreftbl should be
2320 deleted before final processing, however, to verify that no cross-references
2321 remain to an id that existed at one time and was deleted. Such an id could
2322 remain in the cross-reference table indefinitely.
2328 indexchar(m_textchar) ;