/* Copyright (c) 1986, 1987, 1988, 1989, 1990 Hewlett-Packard Co. */ /* Interface definition for HP Tag/TeX translator */ /* Things to watch out for: 1. Index processing. Notice for a number of tags ( for example), there is specific code when the tag is in : , etc. Many tags don't have empty <* IDX> string-code processing, to save on executable size. Therefore, when you add string-code processing to a tag, make sure you add empty string-code for <* IDX>. 2. Index processing for , , . They all have hardcoded default values for their parameters to save on program size (otherwise we have to uncomment parameter code). This is not a problem since parameters is unimplemented. Need to watch out for this when we do implement. */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOtech */ /* ISOtech */ /* ISOtech */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOpub */ /* ISOpub */ /* ellipsis followed by a period? */ /* ISOtech */ /* ISOtech */ /* ISOnum */ /* ISOpub */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOnum */ /* ISOnum */ time_t nseconds; struct tm *timefoo; int maxsize = 20; char s[20]; nseconds = time(NULL); timefoo = localtime(&nseconds); strftime(s, maxsize, "%x", timefoo); fprintf(outfile, "%s\n", s); time_t nseconds; struct tm *timefoo; int maxsize = 20; char s[20]; nseconds = time(NULL); timefoo = localtime(&nseconds); strftime(s, maxsize, "%X", timefoo); fprintf(outfile, "%s\n", s); /* Code entities for toggling debugging traces */ m_malftrace = (LOGICAL) ! m_malftrace ; m_chtrace = (LOGICAL) ! m_chtrace ; m_cdtrace = (LOGICAL) ! m_cdtrace ; m_heapchk = (LOGICAL) ! m_heapchk ; tracetostd = (LOGICAL) ! tracetostd ; /* This option pertains to automatic index processing only (called by the scripts only), so we don't need it in pi's. parentsrch = (LOGICAL) ! parentsrch ; */ m_scantrace = (LOGICAL) ! m_scantrace ; m_tagtrace = (LOGICAL) ! m_tagtrace ; /* Code entities for MARKUP and HP Tag versions */ { M_WCHAR *wc_1, *wc_2; wc_1 = MakeWideCharString(M_VERSION); wc_2 = MakeWideCharString("m-markup-ver"); m_piaction(wc_1, wc_2, M_SDATA) ; m_free(wc_1,"wide character string"); m_free(wc_2,"wide character string"); } { M_WCHAR *wc_1, *wc_2; wc_1 = MakeWideCharString(version); wc_2 = MakeWideCharString("m-tagver"); m_piaction(wc_1, wc_2, M_SDATA) ; m_free(wc_1,"wide character string"); m_free(wc_2,"wide character string"); } #if defined(hpux) { M_WCHAR *wc_1, *wc_2; wc_1 = MakeWideCharString("HPUX"); wc_2 = MakeWideCharString("m-machine"); m_piaction(wc_1, wc_2, M_SDATA) ; m_free(wc_1,"wide character string"); m_free(wc_2,"wide character string"); } #else #if defined(_AIX) { M_WCHAR *wc_1, *wc_2; wc_1 = MakeWideCharString("AIX"); wc_2 = MakeWideCharString("m-machine"); m_piaction(wc_1, wc_2, M_SDATA) ; m_free(wc_1,"wide character string"); m_free(wc_2,"wide character string"); } #else #if defined(sun) { M_WCHAR *wc_1, *wc_2; wc_1 = MakeWideCharString("SUN"); wc_2 = MakeWideCharString("m-machine"); m_piaction(wc_1, wc_2, M_SDATA) ; m_free(wc_1,"wide character string"); m_free(wc_2,"wide character string"); } #else m_piaction("UNDEFINED MACHINE", "m-machine", M_SDATA) ; #endif #endif #endif CDE HelpTag Formatting System. - Version C.00.00 (DTD Version A.01.3) #define DEFINE #include "global.h" #include "htag.tss" static char ident1[]="@(#)CDE Help Tag Parser"; static char ident2[]="@(#)Version Number: C.00.00"; static char ident3[]="@(#) (c) Copyright 1993, 1994 Hewlett-Packard Company"; static char ident4[]="@(#) (c) Copyright 1993, 1994 International Business Machines Corp."; static char ident5[]="@(#) (c) Copyright 1993, 1994 Sun Microsystems, Inc."; static char ident6[]="@(#) (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of Novell, Inc."; #include "global.h" #include "htag.tss" SEARCH *new ; char *p ; char *q ; /* Pick version number out of sign-on message */ if (p = strstr(m_signon, VERSION)) { p += strlen(VERSION) + 1 ; for (q = p ; *q && *q != '\n'; q++) ; if (*q == '\n') { version = (char *) m_malloc(q - p + 1, "version") ; *q = M_EOS ; strcpy(version, p) ; *q = '\n' ; } } /* Following: please refer to comments in custom.c, m_setoptions() */ if (m_argc > 2) { if ((strchr(m_argv[2], 'p')) || (strchr(m_argv[2], 'P'))) parentsrch = TRUE ; /* Implies we are processing indexes */ } fbasename(); options(FALSE) ; if (m_errexit && stoponerror) m_exit(m_errexit) ; if (indir) { new = (SEARCH *) m_malloc(sizeof(SEARCH), "search path") ; new->directory = indir ; new->next = path ; path = new ; } int i; if (outfile) { prebye = ftell(outfile) ; fseek(outfile, texcomplete, SEEK_SET) ; fseek(outfile, 0L, SEEK_END) ; dumpxref() ; if (glossary) checkgloss() ; /* warn if we have forward xrefs */ if (have_forward_xrefs) { m_exit(77); } } outchar(m_textchar, outfile) ; outpi(m_enttype, m_pi, m_entname) ; savhd = FALSE; tooutput = TRUE; fputs(" ABBREV=\"", outfile); fputs(" ABBREV=\"", outfile); M_WCHAR *wc_stago, *wc_tagc; wc_stago = MakeWideCharString(m_stago); wc_tagc = MakeWideCharString(m_tagc); m_err2("Unimplemented %sABBREV%s reached", wc_stago, wc_tagc); m_free(wc_stago,"wide character string"); m_free(wc_tagc,"wide character string"); fputs("\"", outfile); static char abstract[] = "-ABSTRACT"; char id[SDLNAMESIZ+sizeof(abstract)]; hadabstract = TRUE; needabstracthead = TRUE; sprintf(id, "%s%s", sdlReservedName, abstract); mb_starthelpnode("_ABSTRACT", id, 0); CloseVirpage(); outchar(m_textchar, outfile); mb_strcode("", outfile) ; if (echo) { mb_echohead(m_stago); echohead(m_parent(0)) ; mb_echohead(m_net); } mb_strcode("", outfile) ; if (echo) mb_echohead(m_net) ; indexchar(m_textchar) ; outchar(wc_toupper(m_textchar), outfile) ; if (!firstAnnot) { exLineNum++; } firstAnnot = FALSE; savhd = TRUE; hderr = FALSE; tooutput = FALSE; mb_strcode("" : "SIDE\">", outfile); mb_strcode("", outfile); savehead[svheadlen] = '\0'; savhd = FALSE; tooutput = TRUE; mb_strcode("", outfile) ; if (echo) { mb_echohead(m_stago) ; echohead(m_parent(0)) ; mb_echohead(m_net) ; } mb_strcode("", outfile) ; if (echo) mb_echohead(m_net) ; indexchar(m_textchar) ; figcaption = TRUE ; newhline = 0 ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; tooutput = FALSE; if (ftonumber) fputs(" savehead[svheadlen] = M_EOS ; savhd = FALSE ; tooutput = TRUE; mb_strcode(">", outfile); strcode(savehead, outfile); if (ftonumber) fputs("", outfile); ftonumber = 0; StartNCW("CAUTION"); emsghead = USERHEAD ; /* Node headings */ endhead() ; mb_strcode(">", outfile); strcode(savehead, outfile); chksnb(); /* Non node headings */ endhead() ; mb_strcode(">", outfile); strcode(savehead, outfile); fputs("\n", outfile); /* Non node headings */ endhead() ; fputs("\n", outfile); id = ID ; M_WCHAR *wc_chapter; wc_chapter = MakeWideCharString("CHAPTER"); assert_hometopic_exists(); chapstart(id); thisnodelevel = 2; starthelpnode(wc_chapter, id, thisnodelevel); m_free(wc_chapter, "wide character string"); CloseVirpage(); rseqend() ; thisnodelevel = 0; indexchar('('); indexchar(m_textchar) ; indexchar(')'); if (echo) mb_echohead("((") ; mb_strcode("(", outfile) ; outchar (m_textchar, outfile) ; mb_strcode(")", outfile) ; if (echo) mb_echohead("))") ; mb_strcode("", outfile) ; if (echo) mb_echohead("``") ; mb_strcode("", outfile) ; if (echo) mb_echohead("''") ; indexchar(m_textchar) ; exoutchar(m_textchar) ; esoutchar(m_textchar) ; static char copyright[] = "-COPYRIGHT"; char id[SDLNAMESIZ+sizeof(copyright)]; sprintf(id, "%s%s", sdlReservedName, copyright); mb_starthelpnode("_COPYRIGHT", id, 0); /* No Head. Let author have a clean slate. */ CloseVirpage(); termp = term; tooutput = FALSE; char *mb_nodeid; tooutput = TRUE; *termp = M_EOS ; /* trim possible (perhaps) last space */ if (termp - term > 1 && *(termp-1) == ' ') { *(termp-1) = M_EOS; } if (!(lastTermId = (int)(intptr_t) m_lookfortrie(term, >ree))) { lastTermId = NextId(); m_ntrtrie(term, >ree, (void *)(intptr_t) -lastTermId); } else if (lastTermId > 0) { if (!m_resettrie(>ree, term, (void *)(intptr_t) -lastTermId)) { m_error("Internal error. Can't reset glossary trie") ; m_exit(TRUE) ; } } else lastTermId = -lastTermId; termchar(m_textchar) ; termpi(m_enttype, m_pi, m_entname) ; mb_strcode("", outfile) ; if (echo) mb_echohead("!!") ; mb_strcode("", outfile) ; if (echo) mb_echohead("!!") ; indexchar(m_textchar) ; if (echo) { mb_echohead(m_stago) ; echohead(m_parent(0)) ; mb_echohead(m_net) ; } if (echo) mb_echohead(m_net) ; indexchar(m_textchar) ; static M_WCHAR ch[2]; ch[0] = m_textchar; strcode(ch, outfile); notes = NOTES (QSIDE = SIDE, QSTACK = STACK) ; lines = LINES (QNUMBER = NUMBER, QNONUMBER = NONUMBER) ; textsize = TEXTSIZE (QNORMAL = NORMAL, QSMALLER = SMALLER, QSMALLEST = SMALLEST) ; StartEx(notes, lines, textsize); EndEx(); tonumexlines = FALSE; fputs(saveex, outfile); fputs("\n", outfile); inBlock = FALSE; outchar(m_textchar, outfile) ; if (exLineNum > 1) EndEx(); inSdlP = TRUE; savex = TRUE; tooutput = FALSE; saveexseg = mb_malloc(1); svexseglen = 1; svheadlen = 0; /* we save any text in "savehead" */ savex = FALSE; tooutput = TRUE; exoutchar(m_textchar); PushForm(NULL, "EXPLAIN", NULL); number = NUMBER ; tonumber = TONUMBER (QNUMBER = NUMBER, QNONUMBER = NONUMBER) ; file = ENTITY ; id = ID ; figpos = FIGPOS (QLEFT = LEFT, QCENTER = CENTER, QRIGHT = RIGHT) ; cappos = CAPPOS ; ghyperlink = GHYPERLINK ; glinktype = GLINKTYPE (QJUMP = JUMP, QJUMPNEWVIEW = JUMPNEWVIEW, QDEFINITION = DEFINITION, QEXECUTE = EXECUTE, QAPPDEFINED = APPDEFINED, QMAN = MAN) ; gdescription = GDESCRIPTION ; if (cappos) cappos += 3; /* bump over the "CAP" */ figure(number, tonumber, id, file, figpos, cappos, ghyperlink, glinktype, gdescription); if (ftonumber | (svheadlen != 0)) { fputs("", outfile); ftonumber = 0; } fputs("\n\n", outfile); if (ghyperlink) { fputs("\n", outfile); } inSdlP = FALSE; fputs("

\n", outfile); /* When implementing, check conditionals of in

*/ outchar(m_textchar, outfile) ; footnoteno++; if (!had_an_otherfront_head) { endhead(); } PushForm(NULL, NULL, NULL); PushForm(NULL, NULL, NULL); char *string = GetDefaultHeaderString("GlossaryElementDefaultHeadingString", M_SDATA, "Glossary"); static char glossary_string[] = "-GLOSSARY"; char id[SDLNAMESIZ+sizeof(glossary_string)]; thisnodelevel = 2; sprintf(id, "%s%s", sdlReservedName, glossary_string); mb_starthelpnode("_GLOSSARY", id, thisnodelevel); if (strlen(string) + 1 > sizeof(chapstring)) { m_error("Program error: exceeded chapstring") ; m_exit(TRUE) ; } snprintf(chapstring, sizeof(chapstring), "%s", string) ; fputs("\nGlossary\n", stderr) ; glossary = TRUE ; fprintf(outfile, "%s\n", string); m_free(string, "default header string return"); CloseVirpage(); thisnodelevel = 0; id = ID ; file = ENTITY ; unsigned char etype, wheredef ; /* Code from figstart */ if (id) { mbstowcs(xrefstring, "\\", 400); xstrlen = w_strlen(xrefstring) ; m_getline(&xrffile, &xrfline) ; if (xrffile == NULL) { /* set to primary input source */ xrffile = inputname; } setid(id, TRUE, FALSE, inchapter, chapstring, xrffile, xrfline, FALSE) ; } /* initialize some stuff first: - file is the entity name, - f_file is the content of the entity, used only if f_content nonNULL - f_content is f_file with the relative pathname, initialized to NULL, - f_contqual is fully qualified f_file, assigned ONLY IF f_content nonNULL */ file_ent = FALSE ; f_content = NULL ; f_contqual[0] = M_EOS ; /* check ENTITY and determine the figure type */ if (file) { m_lookent(file, &etype, &f_file, &wheredef) ; if (etype != M_SYSTEM) { M_WCHAR *wc_stago, *wc_tagc, *wc_entsystem, *wc_entkw; wc_stago = MakeWideCharString(m_stago); wc_tagc = MakeWideCharString(m_tagc); wc_entsystem = MakeWideCharString(m_entsystem); wc_entkw = MakeWideCharString(m_entkw); m_err6("%s not a %s %s, as required for the ENTITY parameter of %s%s%s", file, wc_entsystem, wc_entkw, wc_stago, m_parent(0), wc_tagc) ; m_free(wc_stago,"wide character string"); m_free(wc_tagc,"wide character string"); m_free(wc_entsystem,"wide character string"); m_free(wc_entkw,"wide character string"); } else { file_ent = TRUE ; f_content = searchforfile(f_file) ; if (f_content) { if (getqualified(f_contqual, f_content)) { /* unsuccessful qual */ if (w_strlen(f_content) < FNAMELEN) w_strcpy(f_contqual, f_content) ; else { m_err1("Internal error. File name too long: %s", f_content) ; m_exit(m_errexit) ; } } } else { m_err2("Can't find file %s (declared in entity %s)", f_file, file) ; } } } { char *mb_content, snb_id[32]; char buffer[BIGBUF]; static M_WCHAR empty[1]; empty[0] = M_EOS; if (!f_content) f_content = empty; mb_content = MakeMByteString(f_content); sprintf(snb_id, "%s%d", sdlReservedName, NextId()); mb_strcode("\n\n", snb_id); mb_strcode(buffer, outfile); AddToSNB(snb_id, mb_content); m_free(mb_content,"multi-byte string"); } /* Accent headings */ notehead = TRUE ; newhline = 0 ; fputs("", outfile); /* Other headings */ char *ssi; ssi = MakeMByteString(m_parent(1)); newhline = 0 ; fprintf(outfile, "", ssi); m_free(ssi, "multi-byte string"); /* Node headings */ char *ssi; ssi = MakeMByteString(m_parent(1)); newhline = 0 ; echo = TRUE ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; savesnb = mb_malloc(1); *savesnb = '\0'; tooutput = FALSE; fprintf(outfile, " char *ssi; ssi = MakeMByteString(m_parent(1)); newhline = 0 ; echo = TRUE ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; tooutput = FALSE; fprintf(outfile, " newhline = 0 ; echo = TRUE ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; tooutput = FALSE; fputs(" char *ssi; ssi = MakeMByteString(m_parent(1)); newhline = 0 ; echo = TRUE ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; fprintf(outfile, "", ssi); m_free(ssi, "multi-byte string"); /* Other headings */ M_WCHAR *wc_stago, *wc_tagc; wc_stago = MakeWideCharString(m_stago); wc_tagc = MakeWideCharString(m_tagc); m_err2("Unimplemented %sCHAPHEAD%s reached", wc_stago, wc_tagc); m_free(wc_stago,"wide character string"); m_free(wc_tagc,"wide character string"); /* Non-node headings */ char *ssi; ssi = MakeMByteString(m_parent(1)); echo = TRUE ; newhline = 0 ; fprintf(outfile, "", ssi); m_free(ssi, "multi-byte string"); /* Non-node headings */ echo = TRUE ; newhline = 0 ; needabstracthead = FALSE; fputs("", outfile); /* Node headings */ had_an_otherfront_head = TRUE; newhline = 0 ; echo = TRUE ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; fputs("", outfile); /* Other headings (mixed content) */ endhead(); fputs("", outfile); /* Accent and Other headings (no mixed content) */ fputs("\n", outfile); /* Non node headings */ echo = FALSE ; chksnb(); /* Node headings */ echo = FALSE; savhd = FALSE; savehead[svheadlen] = '\0'; tooutput = TRUE; /* Non node headings */ echo = FALSE; savhd = FALSE; savehead[svheadlen] = '\0'; tooutput = TRUE; /* Non node headings */ endhead() ; fputs("\n", outfile); /* Node headings. */ endhead() ; chksnb(); /* Other headings. */ fputs("", outfile); outchar(m_textchar, outfile) ; char hostname[BIGBUF]; char **tossline = toss; char *mb_language, *mb_charset; long timeStamp; ModifyEntities(); /* convert SDATA [......] to */ if (!getenv("_DTHELPTAG_NO_UNIQUE_ID")) { hostname[sizeof(hostname)-1] = '\0'; gethostname(hostname, sizeof(hostname)-1); docId = mb_malloc(strlen(hostname)+1); strcpy(docId, hostname); timeStamp = time(0); } else { docId = "test"; timeStamp = 0; } thisnodelevel = 0; fprintf(outfile, "\n", "SDLDTD", "1.1.1"); fprintf(outfile, "\n", docId); fputs("\n\n", outfile); IncludeToss(); fputs("\n", outfile); snbstart = ftell(outfile); assert_hometopic_exists(); fputs("\n", outfile); static char hometopic[] = "-HOMETOPIC"; char id[SDLNAMESIZ+sizeof(hometopic)]; sprintf(id, "%s%s", sdlReservedName, hometopic); mb_starthelpnode("_HOMETOPIC", id, 1); nohometopic = FALSE; CloseVirpage(); have_index = TRUE ; print[0] = '\0'; subprint[0] = '\0'; sort[0] = '\0'; subsort[0] = '\0'; /* ignore 's in cache creek */ { /* sort field */ char *mb_print, *mb_nospace1, *mb_nospace2, id[32]; M_WCHAR *pwc, wnl, wsp; mbtowc(&wnl, "\n", 1); mbtowc(&wsp, " ", 1); pwc = print; while (pwc = w_strchr(pwc, wnl)) *pwc = wsp; mb_print = MakeMByteString(print); if (w_strlen(sort) > 0) { /* use sort[] */ char *mb_sort; pwc = sort; while (pwc = w_strchr(pwc, wnl)) *pwc = wsp; mb_sort = MakeMByteString(sort); if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0) { /* append subsort or subprint */ char *mb_sub; M_WCHAR *pwcSub; pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint; pwc = pwcSub; while (pwc = w_strchr(pwc, wnl)) *pwc = wsp; mb_sub = MakeMByteString(pwcSub); /* strip trailing spaces */ mb_nospace1 = mb_sort; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; mb_nospace2 = mb_sub; while (*mb_nospace2++); --mb_nospace2; /* end of string */ while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_sort; while (*mb_nospace1++ == ' '); --mb_nospace1; mb_nospace2 = mb_sub; while (*mb_nospace2++ == ' '); --mb_nospace2; fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2); m_free(mb_sub,"multi-byte string"); } else { /* plain sort */ /* strip trailing spaces */ mb_nospace1 = mb_sort; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_sort; while (*mb_nospace1++ == ' '); --mb_nospace1; fprintf(indexfp, "%s", mb_nospace1); } m_free(mb_sort,"multi-byte string"); } else { /* use print field */ if (w_strlen(subsort) > 0 || w_strlen(subprint) > 0) { /* append subsort or subprint */ char *mb_sub; M_WCHAR *pwcSub; pwcSub = (w_strlen(subsort) > 0) ? subsort : subprint; pwc = pwcSub; while (pwc = w_strchr(pwc, wnl)) *pwc = wsp; mb_sub = MakeMByteString(pwcSub); /* strip trailing spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; mb_nospace2 = mb_sub; while (*mb_nospace2++); --mb_nospace2; /* end of string */ while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++ == ' '); --mb_nospace1; mb_nospace2 = mb_sub; while (*mb_nospace2++ == ' '); --mb_nospace2; fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2); m_free(mb_sub,"multi-byte string"); } else { /* plain print */ /* strip trailing spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++ == ' '); --mb_nospace1; fprintf(indexfp, "%s", mb_nospace1); } } putc('\036' /* ascii record separator */, indexfp); /* print field */ if (w_strlen(subprint) > 0) { char *mb_subprint; pwc = subprint; while (pwc = w_strchr(pwc, wnl)) *pwc = wsp; mb_subprint = MakeMByteString(subprint); /* strip trailing spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; mb_nospace2 = mb_subprint; while (*mb_nospace2++); --mb_nospace2; /* end of string */ while (*--mb_nospace2 == ' ') *mb_nospace2 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++ == ' '); --mb_nospace1; mb_nospace2 = mb_subprint; while (*mb_nospace2++ == ' '); --mb_nospace2; fprintf(indexfp, "%s, %s", mb_nospace1, mb_nospace2); m_free(mb_subprint,"multi-byte string"); } else { /* strip trailing spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++); --mb_nospace1; /* end of string */ while (*--mb_nospace1 == ' ') *mb_nospace1 = '\0'; /* strip leading spaces */ mb_nospace1 = mb_print; while (*mb_nospace1++ == ' '); --mb_nospace1; fprintf(indexfp, "%s", mb_nospace1); } m_free(mb_print,"multi-byte string"); putc('\036' /* ascii record separator */, indexfp); /* id field */ if (inSdlP) { if (inParText) { sprintf(id, "%s%d", sdlReservedName, NextId()); fprintf(outfile, "", id); fputs(id, indexfp); fputs("\n", indexfp); } else { if (!parTextId) parTextId = NextId(); sprintf(id, "%s%d", sdlReservedName, parTextId); fputs(id, indexfp); fputs("\n", indexfp); } } else if (*nodeid) { char *mb_nodeid; mb_nodeid = MakeMByteString(nodeid); fputs(mb_nodeid, indexfp); fputs("\n", indexfp); m_free(mb_nodeid,"multi-byte string"); } else fprintf(indexfp, "%s-HOMETOPIC\n", sdlReservedName); } indexchar(m_textchar) ; indent = INDENT ; gentity = GENTITY ; gposition = GPOSITION (QLEFT = LEFT, QRIGHT = RIGHT) ; ghyperlink = GHYPERLINK ; glinktype = GLINKTYPE (QJUMP = JUMP, QJUMPNEWVIEW = JUMPNEWVIEW, QDEFINITION = DEFINITION, QEXECUTE = EXECUTE, QAPPDEFINED = APPDEFINED, QMAN = MAN) ; gdescription = GDESCRIPTION ; id = ID; indentp = indent; imagegentityp = gentity; imagegpositionp = gposition; imageghyperlinkp = ghyperlink; imageglinktypep = glinktype; imagegdescription = gdescription; if (!inBlock) StartBlock(NULL, NULL, NULL); inSdlP = TRUE; fputs("

", outfile); inSdlP = FALSE; fputs("

\n", outfile); imoutchar(m_textchar) ; idxsavlen = 0; didsort = FALSE; /* capture saved term unless got it already */ if (! didsort) { idxsav[idxsavlen] = M_EOS; w_strcpy(print, idxsav); } else { /* save the sort field */ idxsav[idxsavlen] = M_EOS; w_strcpy(sort, idxsav); } idxsavlen = 0; didsubsort = FALSE; /* capture saved term unless got it already */ if (! didsubsort) { idxsav[idxsavlen] = M_EOS; w_strcpy(subprint, idxsav); } else { /* save the sort field */ idxsav[idxsavlen] = M_EOS; w_strcpy(subsort, idxsav); } id = ID ; Item(id) ; indexchar('['); mb_strcode("", outfile) ; if (echo) mb_echohead("[[") ; indexchar(']'); mb_strcode("", outfile) ; if (echo) mb_echohead("]]") ; indexchar(m_textchar) ; esoutchar(m_textchar) ; char *first, *loose, *wrap; first = ""; if (listitems[list].firstitem) { first = "FIRST-"; if (needFData) { fputs("\n", outfile); needFData = FALSE; } } loose = lablisttight[list] ? "TIGHT" : "LOOSE"; wrap = (listitems[list].longlabel == WRAP) ? "" : " TYPE=\"LINED\""; labelid[list] = NextId(); fprintf(outfile, "\n", sdlReservedName, labelid[list], first, loose); fprintf(outfile, "", wrap); char *first, *loose; char ssi[BIGBUF], labelId[BIGBUF]; fputs("

\n
\n", outfile); first = ""; if (listitems[list].firstitem) { first = "FIRST-"; listitems[list].firstitem = FALSE; } loose = lablisttight[list] ? "TIGHT" : "LOOSE"; sprintf(ssi, "%s%s", first, loose); sprintf(labelId, "%s%d", sdlReservedName, labelid[list]); PushForm2("ITEM", ssi, labelId, NULL); if (listitems[list].firstitem) { listitems[list].firstitem = FALSE; } labhid[list] = NextId(); if (needFData) { fputs("\n", outfile); needFData = FALSE; } fprintf(outfile, "\n", sdlReservedName, labhid[list], lablisttight[list] ? "TIGHT" : "LOOSE"); fputs("

", outfile); fputs("

\n
\n", outfile); labhtextid[list] = NextId(); fprintf(outfile, "\n", sdlReservedName, labhtextid[list], lablisttight[list] ? "TIGHT" : "LOOSE"); fputs("

", outfile); char labh_id[SDLNAMESIZ + 10], labhtext_id[SDLNAMESIZ + 10]; fputs("

\n
\n", outfile); strcpy(labh_id, sdlReservedName); m_itoa(labhid[list], labh_id + SDLNAMESIZ - 1); strcpy(labhtext_id, sdlReservedName); m_itoa(labhtextid[list], labhtext_id + SDLNAMESIZ - 1); Add2ToRowVec(&formStackTop->vecLen, &formStackTop->rowVec, labh_id, labhtext_id); longlabel = LONGLABEL (QWRAP = WRAP, QNOWRAP = NOWRAP) ; spacing = SPACING (QTIGHT = TIGHT, QLOOSE = LOOSE) ; StartLabList(spacing, longlabel); PopForm2(); list--; id = ID ; char mb_xrefstring[400]; if (! tonumexlines) m_error( "Preparing cross-reference to a line in an example without line numbers" ) ; sprintf(mb_xrefstring, "%d", exLineNum) ; mbstowcs(xrefstring, mb_xrefstring, 400); xstrlen = w_strlen(xrefstring) ; m_getline(&xrffile, &xrfline) ; if (xrffile == NULL) { /* set to primary input */ xrffile = inputname; } setid(id, TRUE, FALSE, inchapter, chapstring, xrffile, xrfline, TRUE) ; { char *mb_id, buffer[BIGBUF]; mb_id = MakeMByteString(id); sprintf(buffer, "", mb_id); mb_strcode(buffer, outfile); m_free(mb_id,"multi-byte string"); } hyperlink = HYPERLINK ; type = TYPE (QJUMP = JUMP, QJUMPNEWVIEW = JUMPNEWVIEW, QDEFINITION = DEFINITION, QEXECUTE = EXECUTE, QAPPDEFINED = APPDEFINED, QMAN = MAN) ; description = DESCRIPTION ; HandleLink(hyperlink, type, description); /* reset link type to default. This is braindead, but enough. E.g., will do the right thing (remember that xref turns to an implicit link). Right_thing => xref becomes definition link. However, in Test the xref will think that is supposed to become a link of type jump, not definition. This case is odd, so we won't worry about it. */ global_linktype = 0; mb_strcode("", outfile); type = TYPE (QORDER = ORDER, QBULLET = BULLET, QPLAIN = PLAIN, QMILSPEC = MILSPEC, QCHECK = CHECK) ; order = ORDERTYPE (QUALPHA = UALPHA, QLALPHA = LALPHA, QARABIC = ARABIC, QUROMAN = UROMAN, QLROMAN = LROMAN) ; spacing = SPACING (QTIGHT = TIGHT, QLOOSE = LOOSE) ; cont = CONTINUE ; StartList(type, order, spacing, cont) ; EndList(); id = ID ; if (id) { char *mb_id; char buffer[BIGBUF]; mb_id = MakeMByteString(id); sprintf(buffer, "", mb_id); mb_strcode(buffer, outfile); m_free(mb_id,"multi-byte string"); savid = checkid(id); } if (savid) { mb_shchar(M_EOS, &xstrlen, (sizeof(xrefstring) / sizeof(M_WCHAR)), xrefstring, idstring, "Too many characters in corresponding cross-reference", &iderr); setid(savid, TRUE, TRUE, inchapter, chapstring, xrffile, xrfline, TRUE); } if (memo && inSdlP) { if (m_textchar == '"') { /* handle funny quote in memo bug */ } else { outchar(m_textchar, outfile); } } /* could need to handle calculator context sensitive entities * here if needed to reduce tex macro count */ if (memo) { outpi(m_enttype, m_pi, m_entname) ; } thisnodelevel = 2; mb_starthelpnode("MESSAGE", "", thisnodelevel); chapst = FALSE ; fprintf(stderr, "\nMessages.\n") ; emsghead = DEFHEAD ; CloseVirpage(); thisnodelevel = 0; PushForm(NULL, "MSG", NULL); checkmsghead() ; PopForm(); fputs("", outfile); fputs("\n", outfile); include = INCLUDE ; exclude = EXCLUDE ; PushForm(NULL, NULL, NULL); checkmsghead() ; chapst = TRUE ; savid = checkid(NULL) ; /* hook for possible future ID */ iderr = FALSE ; PopForm(); inSdlP = TRUE; StartBlock(NULL, "MSGTEXT", NULL); fputs("

", outfile); inSdlP = FALSE; fputs("

\n", outfile); mb_strcode("\n", outfile); fputs("&\n", outfile) ; StartNCW("NOTE"); synelcnt = 0; fputs("[", outfile); fputs("]", outfile); id = ID ; char *mb_id; if (!id) mb_id = NULL; else mb_id = MakeMByteString(id); mb_starthelpnode("METAINFO", mb_id, 0); if (mb_id) m_free(mb_id, "multi-byte string"); had_an_otherfront_head = FALSE; savid = checkid(id) ; iderr = FALSE ; CloseVirpage(); if (id && !had_an_otherfront_head) { m_errline("You must use a tag after \n"); } PushForm(NULL, "OTHERHEAD", NULL); PopFormMaybe(); indent = INDENT ; gentity = GENTITY ; gposition = GPOSITION (QLEFT = LEFT, QRIGHT = RIGHT) ; ghyperlink = GHYPERLINK ; glinktype = GLINKTYPE (QJUMP = JUMP, QJUMPNEWVIEW = JUMPNEWVIEW, QDEFINITION = DEFINITION, QEXECUTE = EXECUTE, QAPPDEFINED = APPDEFINED, QMAN = MAN) ; gdescription = GDESCRIPTION ; id = ID; paragraph(indent, id, gentity, gposition, ghyperlink, glinktype, gdescription); inSdlP = FALSE; fputs("\n

\n", outfile); M_WCHAR *wc_image; wc_image = MakeWideCharString("IMAGE"); handle_link_and_graphic(wc_image, imagegentityp, imagegpositionp, imageghyperlinkp, imageglinktypep, imagegdescription); m_free(wc_image,"wide character string"); inParText++; if (tooutput) EmitSavedAnchors(); savid = NULL; /* in case there was no head */ inParText++; if (tooutput) EmitSavedAnchors(); inParText++; if (tooutput) EmitSavedAnchors(); putc('\n', stderr) ; --inParText; putc('\n', stderr) ; --inParText; --inParText; M_WCHAR wc_nl; mbtowc(&wc_nl, "\n", 1); if (m_textchar == wc_nl) fputs("&\n", outfile); else outchar(m_textchar, outfile); M_WCHAR wc_nl; mbtowc(&wc_nl, "\n", 1); if (m_textchar == wc_nl) mb_shstring("\n", &svheadlen, (sizeof(savehead) / sizeof(M_WCHAR)), savehead, "Too many characters in head or caption", &hderr) ; else outchar(m_textchar, outfile); M_WCHAR wc_nl; mbtowc(&wc_nl, "\n", 1); if (m_textchar == wc_nl) { fputs(" ", stderr) ; mb_strcode("\n", outfile) ; if (savid) shchar(' ', &xstrlen, (sizeof(xrefstring) / sizeof(M_WCHAR)), xrefstring, idstring, "Too many characters in corresponding cross-reference", &iderr) ; shchar(' ', &svheadlen, (sizeof(savehead) / sizeof(M_WCHAR)), savehead, svhdstring, "Too many characters in head or caption", &hderr) ; } else outchar(m_textchar, outfile); M_WCHAR wc_nl; mbtowc(&wc_nl, "\n", 1); if (m_textchar == wc_nl) fputs("\n", outfile) ; else outchar(m_textchar, outfile); M_WCHAR wc_nl; mbtowc(&wc_nl, "\n", 1); if (m_textchar == wc_nl) fputc('\n', outfile) ; else outchar(m_textchar, outfile); PushForm("TEXT", "PROCEDURE", NULL); PopFormMaybe(); mb_strcode("``", outfile) ; if (echo) putc('"', stderr) ; mb_strcode("", outfile) ; if (echo) putc('"', stderr) ; mb_strcode("''", outfile) ; if (echo) putc('"', stderr) ; mb_strcode("", outfile) ; if (echo) putc('"', stderr) ; indexchar('\"') ; indexchar('\"') ; indexchar(m_textchar) ; synelcnt = 0; fputs("{", outfile); fputs("}", outfile); id = ID ; M_WCHAR *wc_rsect, *wc_helpvolume; wc_rsect = MakeWideCharString("RSECT"); wc_helpvolume = MakeWideCharString("HELPVOLUME"); assert_hometopic_exists(); if (!rsectseq) thisnodelevel = thisnodelevel + 1; if (w_strcmp(m_parent(1), wc_helpvolume) != 0) { CloseVirpage(); starthelpnode(wc_rsect, id, thisnodelevel); } else starthelpnode(wc_rsect, id, 2); m_free(wc_rsect, "wide character string"); m_free(wc_helpvolume, "wide character string"); rsectstart(id) ; M_WCHAR *wc_helpvolume; wc_helpvolume = MakeWideCharString("HELPVOLUME"); if (w_strcmp(m_parent(1), wc_helpvolume) == 0) CloseVirpage(); m_free(wc_helpvolume, "wide character string"); PushForm(NULL, NULL, NULL); PushForm(NULL, NULL, NULL); PopFormMaybe(); id = ID ; M_WCHAR *wc_s1; wc_s1 = MakeWideCharString("S1"); assert_hometopic_exists(); thisnodelevel = 2; starthelpnode(wc_s1, id, thisnodelevel); m_free(wc_s1, "wide character string"); rsectseq = FALSE ; chapst = TRUE ; savid = checkid(id) ; iderr = FALSE ; M_WCHAR *wc_s1; wc_s1 = MakeWideCharString("S1"); assert_hometopic_exists(); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s1, id, thisnodelevel); m_free(wc_s1, "wide character string"); rsectseq = FALSE ; chapst = TRUE ; savid = checkid(id) ; iderr = FALSE ; CloseVirpage(); rseqend() ; thisnodelevel = 0; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s2; wc_s2 = MakeWideCharString("S2"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s2, id, thisnodelevel); m_free(wc_s2, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s3; wc_s3 = MakeWideCharString("S3"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s3, id, thisnodelevel); m_free(wc_s3, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s4; wc_s4 = MakeWideCharString("S4"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s4, id, thisnodelevel); m_free(wc_s4, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s5; wc_s5 = MakeWideCharString("S5"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s5, id, thisnodelevel); m_free(wc_s5, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s6; wc_s6 = MakeWideCharString("S6"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s6, id, thisnodelevel); m_free(wc_s6, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s7; wc_s7 = MakeWideCharString("S7"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s7, id, thisnodelevel); m_free(wc_s7, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s8; wc_s8 = MakeWideCharString("S8"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s8, id, thisnodelevel); m_free(wc_s8, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; id = ID ; M_WCHAR *wc_s9; wc_s9 = MakeWideCharString("S9"); thisnodelevel++; CloseVirpage(); starthelpnode(wc_s9, id, thisnodelevel); m_free(wc_s9, "wide character string"); rsectseq = FALSE ; savid = checkid(id) ; iderr = FALSE ; rseqend() ; --thisnodelevel; didsort = TRUE; idxsav[idxsavlen] = M_EOS; w_strcpy(print, idxsav); idxsavlen = 0; idxsav[idxsavlen] = M_EOS; w_strcpy(sort, idxsav); didsubsort = TRUE; idxsav[idxsavlen] = M_EOS; w_strcpy(subprint, idxsav); idxsavlen = 0; idxsav[idxsavlen] = M_EOS; w_strcpy(subsort, idxsav); mb_strcode("", outfile); mb_strcode("", outfile); if (echo) mb_echohead("__") ; mb_strcode("", outfile); if (echo) mb_echohead("__") ; outchar(m_textchar, outfile) ; indexchar(m_textchar) ; outchar(m_textchar, outfile) ; mb_strcode("", outfile); mb_strcode("", outfile); if (echo) mb_echohead("^^") ; mb_strcode("", outfile); if (echo) mb_echohead("^^") ; outchar(m_textchar, outfile) ; indexchar(m_textchar) ; outchar(m_textchar, outfile) ; if (synelcnt++) { fputs("\n", outfile); } fputs("\n", outfile); outchar(m_textchar, outfile) ; inSdlP = TRUE; if (!inBlock) StartBlock(NULL, NULL, NULL); fprintf(outfile, "

"); inSdlP = FALSE; fputs("

\n", outfile); outchar(m_textchar, outfile) ; base = BASE ; gloss = GLOSS (QGLOSS = GLOSS, QNOGLOSS = NOGLOSS) ; termp = term ; wsterm = FALSE ; tooutput = FALSE; if (echo) mb_echohead("++") ; endterm(base, gloss, "current"); /* don't use definition window for link */ endterm(base, gloss, "popup"); /* use definition window for link */ termchar(m_textchar) ; termpi(m_enttype, m_pi, m_entname) ; StartNCWtext("NOTE", "NoteElementDefaultIconFile", "NoteElementDefaultHeadingString"); StartNCWtext("CAUTION", "CautionElementDefaultIconFile", "CautionElementDefaultHeadingString"); StartNCWtext("WARNING", "WarningElementDefaultIconFile", "WarningElementDefaultHeadingString"); PushForm(NULL, "MESSAGE", NULL); checkmsghead() ; PushForm(NULL, "MSGSUB", NULL); if (needabstracthead) { fputs("", outfile); chksnb(); needabstracthead = FALSE; } M_WCHAR *p ; char id[SDLNAMESIZ+10]; sprintf(id, "%s%d", sdlReservedName, lastTermId); PushForm(NULL, NULL, id); StartBlock(NULL, "TERM", NULL); mb_strcode("

", outfile); strcode(term, outfile); mb_strcode("

\n", outfile); PushForm(NULL, "DEFINITION", NULL); PopForm(); PopForm(); if (formStackBase && (formStackTop >= formStackBase)) { if (formStackTop->vecLen == 1) StartBlock(NULL, NULL, NULL); PopForm(); } else if (inBlock) { fputs("\n", outfile); inBlock = FALSE; } fputs("", outfile); hadtitle = TRUE; newhline = 0 ; savhd = TRUE ; hderr = FALSE ; svheadlen = 0 ; char *mb_savehead, *ssi; static char title_string[] = "-TITLE"; char id[SDLNAMESIZ+sizeof(title_string)]; if (hderr) { m_error("Error collecting title characters."); } savhd = FALSE ; fputs("\n", outfile); sprintf(id, "%s%s", sdlReservedName, title_string); mb_starthelpnode("_TITLE", id, 0); ssi = MakeMByteString(m_parent(1)); fprintf(outfile, "", ssi); savehead[svheadlen] = M_EOS ; mb_savehead = MakeMByteString(savehead); fputs(mb_savehead, outfile); m_free(mb_savehead,"multi-byte string"); m_free(ssi,"multi-byte string"); fputs("\n", outfile); CloseVirpage(); savedtitle = (M_WCHAR *) m_malloc(w_strlen(savehead) + 1, "saved title"); w_strcpy(savedtitle, savehead); if (echo) { mb_echohead(m_stago) ; echohead(m_parent(0)) ; mb_echohead(m_net) ; } mb_strcode("", outfile) ; esoutchar(m_textchar) ; if (echo) mb_echohead(m_net) ; mb_strcode("", outfile) ; exoutchar(m_textchar) ; indexchar(m_textchar) ; mb_strcode("", outfile) ; if (echo) mb_echohead("%%") ; mb_strcode("", outfile) ; if (echo) mb_echohead("%%") ; indexchar(m_textchar) ; mb_strcode("", outfile) ; /* added to fix calculator computer chars */ if (m_textchar == M_SPACE) fputs("\\ ", outfile) ; else outchar(m_textchar, outfile) ; textsize = TEXTSIZE (QNORMAL = NORMAL, QSMALLER = SMALLER, QSMALLEST = SMALLEST) ; int tsize; char *ssi; inSdlP = TRUE; StartBlock(NULL, "EX", NULL); tsize = vextextsize(textsize); if (tsize == SMALLEST) ssi = "SMLST"; else if (tsize == SMALLER) ssi = "SMLR"; else ssi = "NML"; fprintf(outfile, "

", ssi); inSdlP = FALSE; fputs("

\n", outfile); fputs("\n", outfile); inBlock = FALSE; vexoutchar(m_textchar) ; StartNCW("WARNING"); /* Cross-referencing that allows forward references is inherently a two-pass process. However, this interface assumes a two-pass process. MARKUP provides the first pass and TeX the second. MARKUP can therefore define a TeX macro for every cross-reference and write a file of definitions of these macros that is read at the beginning of the TeX pass. In fact, information about cross-references is stored in a trie by MARKUP. Data is entered into this structure both when a cross-reference is defined (with an id parameter on a chapter, figure, etc.) and when it is used (with the xref element). At the end of the manual, the file xref.tex is written with definitions of macros corresponding to all cross-references defined or accessed. In addition, the file xreftbl is written to save this information in a form that can be read to initialize the trie the next time the manual is processed. Saving cross-reference information across runs of MARKUP allows a manual to be processed a chapter at a time without invalidating interchapter references. The file xreftbl should be deleted before final processing, however, to verify that no cross-references remain to an id that existed at one time and was deleted. Such an id could remain in the cross-reference table indefinitely. */ id = ID ; indexchar(m_textchar) ; xrefexpand(id) ;