2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $TOG: global.h /main/4 1998/04/06 13:17:04 mgreess $ */
24 /* Copyright (c) 1988, 1989 Hewlett-Packard Co. */
25 /* Global definitions for HP Tag/TeX translator */
26 /* When changing this file, check "grphpar.h" for conflicts */
46 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(linux)
51 #define MAXHEADLINES 3
56 /* substitute for m_ctupper; we don't cast x into (int), thereby
57 avoiding any problems of high order bit. This is in response
58 to "Entity no allowed in ART" messages by cupertino. However,
59 this more of a loose deduction, and really needs confirmation. */
60 #define ctupper(x) (m_ctarray[x].upper)
63 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
79 #if defined(FUTURE_FEATURE)
84 #endif /* FUTURE_FEATURE */
88 EXTERN int optval INIT(M_NULLVAL) ;
90 EXTERN char *optkey[NUMOPTIONS]
108 #if defined(FUTURE_FEATURE)
113 #endif /* FUTURE_FEATURE */
118 /* Processing options */
119 EXTERN LOGICAL final INIT(FALSE) ;
120 EXTERN LOGICAL memo INIT(FALSE) ;
121 EXTERN int rebuild INIT(FALSE) ;
123 EXTERN LOGICAL stoponerror INIT(TRUE) ;
125 #if defined(FUTURE_FEATURE)
126 EXTERN LOGICAL prntrevs INIT(FALSE) ;
127 #endif /* FUTURE_FEATURE */
129 /* variables for index sorting and tagging in the scripts */
130 /* we create a child directory for processing the index, so as not
131 to clobber any files with the same base name. However, this will
132 affect search paths that are relative; those that are relative
133 need to have parent level prepended. This is done only when
134 "parentsrch" is set to TRUE; done only when we process indexes. */
135 EXTERN LOGICAL parentsrch INIT(FALSE) ;
136 EXTERN char *idxfile INIT(NULL) ; /* index file name only */
137 EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
138 EXTERN char *idxbase INIT(NULL) ; /* index base name only */
140 /* TeX counter for chapter number */
142 #define APPCOUNT 1000
143 #define TOCCOUNT 2000
144 #define MSGCOUNT 3000
145 #define BIBCOUNT 4000
146 #define GLOSSCOUNT 5000
147 #define INDEXCOUNT 6000
149 /* flag for TeX output while in HelpTag parser */
150 EXTERN LOGICAL texoutput INIT(FALSE);
152 /* Flag for filelist vs. Tag to TeX translator */
153 EXTERN LOGICAL filelist INIT(FALSE) ;
155 /* NOTE: If driver is redimensioned, a change is needed in texinit() */
156 EXTERN char driver[20]
181 EXTERN M_WCHAR *helpcharset INIT(NULL);
183 /* Working directory, input directory, installation directory,
185 EXTERN LOGICAL defaultext ;
186 EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
188 EXTERN char *baseext ;
189 EXTERN char *nodirbase ;
190 EXTERN char *work INIT("") ;
191 EXTERN char *indir INIT(NULL) ;
192 EXTERN char *install INIT(NULL) ;
193 typedef struct search SEARCH ;
198 EXTERN SEARCH *path INIT(NULL) ;
199 EXTERN SEARCH **endpath INIT(&path) ;
204 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
207 ****define directory separator here****
212 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
220 ****define directory separator here****
224 /* Location in .TEX file of two \wlog messages */
227 /* True if have encountered idx or idxsyn */
228 EXTERN LOGICAL have_index INIT(FALSE) ;
229 EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
231 /* True within a sequence of rsect's */
232 EXTERN LOGICAL rsectseq INIT(FALSE) ;
234 /* True if SAMEPAGE for this rsect sequence */
235 EXTERN LOGICAL rsectsame ;
237 /* True if have encountered <NEWPAGE> in a SAMEPAGE <RSECT>*/
238 EXTERN LOGICAL rsectholdnew ;
240 /* True in an rsect that has an abbreviated head */
241 EXTERN LOGICAL didabbrev ;
243 /* True if this manual has a glossary */
244 EXTERN LOGICAL glossary INIT(FALSE) ;
246 /* True while processing a note if a head was encountered */
247 EXTERN LOGICAL notehead ;
249 /* String emitted at start of note, caution or warning */
250 EXTERN char ncwStart[] INIT("<PARAGRAPH %s after 0 left 5 first 5 right 0>\n\
251 <TYPE serif><WEIGHT bold>");
253 /* String emitted at end of note, caution or warning */
254 EXTERN char ncwEnd[] INIT("%s</WEIGHT></TYPE></PARAGRAPH>\n\
255 <PARAGRAPH before 0 after 0 left 5 right 0>\n");
257 /* String emitted if a graphic is present for note, caution or warning */
258 EXTERN char ncwGraphic[] INIT("<LABEL><GRAPHIC file %s></LABEL>\n");
260 /* String emitted to position note, caution or warning in a tight list */
261 EXTERN char *ncwTightList INIT("");
263 /* File address for "Generated TeX file complete" message */
264 EXTERN long texcomplete ;
266 /* File pointer for cross-reference file */
269 /* global link type pointer, used in xref to match latest link type */
270 EXTERN int global_linktype INIT (0);
272 /* pointers to image parameters for use in imagetext */
273 EXTERN M_WCHAR *indentp;
274 EXTERN M_WCHAR *imagegentityp;
275 EXTERN M_WCHAR *imagegpositionp;
276 EXTERN M_WCHAR *imageghyperlinkp;
277 EXTERN M_WCHAR *imageglinktypep;
278 EXTERN M_WCHAR *imagegdescription;
280 /* indent for p, image, ex, vex, based on plain list */
281 #define LISTFIRSTINDENT 2
282 #define LISTITEMINDENT 2
283 #define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
285 #define ORDEREDLISTFIRSTINDENT 1
286 #define ORDEREDLISTITEMINDENT 3
287 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
289 /* File offset after preamble, and before \bye. Used to determine
290 whether content found in the document */
291 EXTERN long postpreamble INIT(0L) ;
292 EXTERN long prebye INIT(0L) ;
293 EXTERN LOGICAL filefound INIT(FALSE) ;
295 /* Chapter or appendix number */
296 EXTERN int part INIT(0) ;
297 EXTERN int chapter INIT(0) ;
298 EXTERN int chapinc INIT(0) ;
299 EXTERN char chapstring[15] INIT("0") ;
301 #define NODEID_LENGTH 204
302 /* name of current node */
303 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
304 /* Node number for autogenerated node id */
305 EXTERN int autonodenumber INIT(1);
306 EXTERN char nodestring[15] INIT("0");
307 /* Node level variables */
308 EXTERN int lastnodelevel INIT(0);
309 EXTERN int thisnodelevel INIT(0);
310 /* Offset of node from beginning of file */
311 EXTERN long int nodeoffset INIT(0);
312 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
313 /* is this the first node of a .ht file? */
314 EXTERN LOGICAL firstnode INIT(TRUE);
315 /* flag for omitting first newline in topic map file */
316 EXTERN LOGICAL isfirsttopicmap INIT(TRUE);
317 EXTERN LOGICAL nohometopic INIT(TRUE);
318 EXTERN long topicoffset INIT(0L);
319 EXTERN int htfileno INIT(1);
320 /* The first tag in the front section should trigger the node */
321 EXTERN LOGICAL have_a_frontnode INIT(FALSE);
322 EXTERN char *helpbase INIT(NULL);
323 EXTERN char *helpext;
324 /* small buffer for scratch work */
325 EXTERN char helptmpbuf[2] INIT("0");
327 /* Should we use these BASENAME_LIMIT on the size of file names? */
328 LOGICAL usingshortnames INIT(FALSE);
329 /* Limit on how long the basename can be for a .ht file */
330 #define BASENAME_LIMIT 6
331 /* limit on how many additional character are allowed before the ext */
332 /* (How many chapter numbers foo``12''.ht */
333 #define PRE_EXTENSION_LIMIT 2
335 EXTERN FILE *indexfp;
336 EXTERN FILE *docregfp;
337 EXTERN FILE *idtablefp;
338 EXTERN FILE *topicmapfp;
340 /* Whether have processed anything in chapter or appendix */
341 EXTERN LOGICAL chapst INIT(FALSE) ;
343 /* Whether have just started a fourth-level section */
344 EXTERN LOGICAL st4 INIT(FALSE) ;
346 /* TRUE for chapter, FALSE for appendix */
347 EXTERN LOGICAL inchapter INIT(TRUE) ;
349 /* Figure number within this chapter or appendix */
352 /* Options on a particular figure */
353 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
356 /* Table number within this chapter or appendix */
359 /* footnote number */
360 EXTERN int footnoteno INIT(0);
362 /* True while processing abbrev head for page footer */
363 EXTERN LOGICAL fabbrev INIT(FALSE) ;
364 EXTERN LOGICAL abbrev INIT(FALSE) ;
366 EXTERN FILE *outfile ;
367 /* re-directing output to nothing, eg. used for unimplemented tags */
368 EXTERN FILE *nullfile ;
369 /* save the old outfile when redirecting data to nullfile */
370 EXTERN FILE *CDROMsaveoutfile ;
371 /* save the old outfile when redirecting header/footer data to nullfile */
372 EXTERN FILE *HFsaveoutfile;
374 /* True if a figure or table has a caption */
375 EXTERN LOGICAL figcaption ;
376 EXTERN LOGICAL tabcaption ;
378 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
381 EXTERN int sklines, skchars ;
383 /* contains current m_textchar, used to see if we need to issue an italic
384 correction. Issue italic correction everywhere except after commas
386 EXTERN M_WCHAR cur_char INIT(' ') ;
388 /* Special characters */
393 /* Error _DtMessage section */
394 EXTERN LOGICAL emsghead INIT(FALSE) ;
395 /* emsghead has three possible values:
396 DEFHEAD : use default error message title
397 USERHEAD : user specified
398 FALSE : do not process head (assume define is not equal to
405 #define FIGDEFWH "3in"
406 #define MAXNORMROWS 55
407 #define MAXSMALROWS 75
408 #define MAXTINYROWS 100
409 #define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
410 #define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
412 EXTERN LOGICAL fignote ;
413 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
414 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
415 EXTERN LOGICAL file_ent ;
416 EXTERN M_WCHAR *f_content ;
417 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
418 EXTERN M_WCHAR *f_file ;
420 /* callouts -- entfile and lineno */
421 EXTERN M_WCHAR *figinpath ;
422 EXTERN int figline INIT(0) ;
425 #define BYTE unsigned char
431 typedef struct tagFPOINT {
435 typedef struct tagPwT {
446 #define AN_hasbros 32
457 #define UNPK(c,an,sh) ((c&an)>>sh)
459 EXTERN FILE *calfile ;
461 EXTERN LOGICAL okcallout ;
462 /* -- end callout -- */
464 EXTERN FILE *pclfile ;
466 #define VERSION "Version"
467 EXTERN char *version INIT(NULL) ;
469 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
471 /* Code for standard library function "access" */
474 /* Allowable units on dimensions */
475 #define SPperPT 65536.0
476 #define PTperIN 72.27
480 EXTERN char *dimarray[5]
491 EXTERN LOGICAL unleaded INIT(FALSE) ;
492 EXTERN int newhline INIT(0) ;
493 EXTERN int synelcnt INIT(0);
495 /* Cross-Reference Declarations */
496 /* do we have foreward references? */
497 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
498 EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
499 EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
500 EXTERN M_TRIE xtree ;
502 M_WCHAR *textptr ; /* Pointer to expansion of xref */
503 LOGICAL defined ; /* Whether the xref has been defined */
504 LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
505 LOGICAL retrieved ; /* Whether the value has been used */
506 LOGICAL csensitive ; /* Whether the value is chapter sensitive */
507 LOGICAL xrefable; /* can this be xref'd to legally? */
508 char *chapstring ; /* Number of chapter or appendix where it occurs */
509 LOGICAL inchapter ; /* Whether in chapter or appendix */
510 M_WCHAR *file ; /* File and line # where first referred to or */
511 int line ; /* first defined for error reports */
513 /* Value of one particular cross-reference */
514 EXTERN M_WCHAR xrefstring[400] ;
515 EXTERN int xstrlen INIT(0) ;
516 /* Pointer to the id */
517 EXTERN M_WCHAR *savid ;
518 EXTERN LOGICAL iderr ;
519 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
521 /* Save head for page header in rsect and table of contents string*/
522 EXTERN M_WCHAR savehead[400] ;
523 EXTERN M_WCHAR savetabcap[400] ;
524 EXTERN int svheadlen ;
526 EXTERN LOGICAL savhd ;
527 EXTERN LOGICAL savtc ;
528 EXTERN LOGICAL hderr ;
529 EXTERN LOGICAL echo ;
530 EXTERN LOGICAL tooutput INIT(TRUE) ;
532 /* Glossary Declarations */
533 EXTERN M_TRIE gtree ;
535 EXTERN M_WCHAR term[MAXTERM + 1] ;
536 EXTERN M_WCHAR *termp ;
537 EXTERN LOGICAL wsterm ;
541 EXTERN int exlineno ;
542 EXTERN LOGICAL tonumexlines ;
544 /* Saved document title */
545 EXTERN M_WCHAR *savedtitle;
547 /* tell whether .hmi should have generic info put into it */
548 EXTERN LOGICAL hadtitle INIT(FALSE);
549 EXTERN LOGICAL hadabstract INIT(FALSE);
551 /* emit an empty abstract title if no head specified */
552 EXTERN LOGICAL needabstracthead INIT(FALSE);
554 /* Numeric codes corresponding to keyword parameter values */
565 /* Note that the definition of BOX was chosen so that the border
566 parameter on both figure and table could use it, even though these
567 parameters do not share all possible values */
582 /* IMPORTANT: "FIG..." values should not be */
583 /* changed (eg. see proc "checkmargin") */
593 /* text size macros */
647 #define NOAUTOSCALE 2
649 /* the values for these elements are significant...they are used to set
650 * TeX register values which are later tested by macros
655 /* the values for these elements are significant...they are used to set
656 * TeX register values which are later tested by macros
663 /* values for ctable tracking */
665 EXTERN int ctbldisplines;
666 EXTERN int ctblgraphics;
668 /* Declarations for lists */
670 /* FIRST => first paragraph in list item. The one following the label.
671 FOLLOW => immediately after a figure, note, caution, warning, ex or vex
672 INSIDE => at least one previous paragraph
674 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
676 EXTERN LOGICAL lablistindented[MAXLISTLEV];
677 EXTERN int list INIT(0) ;
678 typedef struct contchain CONTCHAIN ;
683 typedef struct list LIST ;
689 unsigned char punct ;
690 unsigned char started ;
691 unsigned char where ;
697 = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
700 EXTERN LIST *lastlist INIT(&outlist) ;
701 EXTERN int bulcount INIT(0) ;
703 /* Volume name for index */
704 EXTERN M_WCHAR volume[M_NAMELEN + 1] ;
705 /* save area for index processing */
706 EXTERN M_WCHAR idxsav[400] ;
707 /* Sort form of an index term */
708 EXTERN M_WCHAR sort[400] ;
709 /* Sort form of an index sub term */
710 EXTERN M_WCHAR subsort[400] ;
711 /* print form of index term */
712 EXTERN M_WCHAR print[400] ;
713 /* print form of index sub term */
714 EXTERN M_WCHAR subprint[400] ;
715 EXTERN int idxsavlen ;
716 EXTERN LOGICAL didsort ;
717 EXTERN LOGICAL didsubsort ;
719 /* Strings for constructing error messages */
720 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
721 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
722 EXTERN char infile[] INIT("file %s, ") ;
723 EXTERN char online[] INIT("line %d)\n") ;
724 EXTERN char offile[] INIT(" of file: %s") ;
725 /* Whitemenu supported only in calculator, issue message only once */
726 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
728 /* Repeated code at start of each text block */
729 #define STARTSTUFF {}
731 /* Pop the stack of font changes */
733 /* For index entries */
736 #define IDXSTRT IDXSTRT1 IDXSTRT2
741 #define IDXEND IDXEND1 IDXEND2 IDXEND3
743 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
744 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
746 /* flag for leaders within <LIST PLAIN> only */
747 EXTERN LOGICAL leaderok INIT(FALSE) ;
749 /* Direct debugging trace output to stdout or outfile */
750 EXTERN LOGICAL tracetostd INIT(FALSE) ;
752 /* show memory available */
753 EXTERN LOGICAL showmem INIT(FALSE);
755 /* Function prototypes */
758 /* Declarations for handling special characters */
761 /* Declarations for handling special characters for calculators*/
762 EXTERN char ccoutbuf[128] ;
764 /* Character conversion tables */
765 #include "charconv.h"