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 libraries 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 */
45 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(linux) || defined(CSRG_BASED)
50 #define MAXHEADLINES 3
55 /* substitute for m_ctupper; we don't cast x into (int), thereby
56 avoiding any problems of high order bit. This is in response
57 to "Entity no allowed in ART" messages by cupertino. However,
58 this more of a loose deduction, and really needs confirmation. */
59 #define ctupper(x) (m_ctarray[x].upper)
62 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
78 #if defined(FUTURE_FEATURE)
83 #endif /* FUTURE_FEATURE */
87 EXTERN int optval INIT(M_NULLVAL) ;
89 EXTERN char *optkey[NUMOPTIONS]
107 #if defined(FUTURE_FEATURE)
112 #endif /* FUTURE_FEATURE */
117 /* Processing options */
118 EXTERN LOGICAL final INIT(FALSE) ;
119 EXTERN LOGICAL memo INIT(FALSE) ;
120 EXTERN int rebuild INIT(FALSE) ;
122 EXTERN LOGICAL stoponerror INIT(TRUE) ;
124 #if defined(FUTURE_FEATURE)
125 EXTERN LOGICAL prntrevs INIT(FALSE) ;
126 #endif /* FUTURE_FEATURE */
128 /* variables for index sorting and tagging in the scripts */
129 /* we create a child directory for processing the index, so as not
130 to clobber any files with the same base name. However, this will
131 affect search paths that are relative; those that are relative
132 need to have parent level prepended. This is done only when
133 "parentsrch" is set to TRUE; done only when we process indexes. */
134 EXTERN LOGICAL parentsrch INIT(FALSE) ;
135 EXTERN char *idxfile INIT(NULL) ; /* index file name only */
136 EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
137 EXTERN char *idxbase INIT(NULL) ; /* index base name only */
139 /* TeX counter for chapter number */
141 #define APPCOUNT 1000
142 #define TOCCOUNT 2000
143 #define MSGCOUNT 3000
144 #define BIBCOUNT 4000
145 #define GLOSSCOUNT 5000
146 #define INDEXCOUNT 6000
148 /* flag for TeX output while in HelpTag parser */
149 EXTERN LOGICAL texoutput INIT(FALSE);
151 /* Flag for filelist vs. Tag to TeX translator */
152 EXTERN LOGICAL filelist INIT(FALSE) ;
154 /* NOTE: If driver is redimensioned, a change is needed in texinit() */
155 EXTERN char driver[20]
177 EXTERN M_WCHAR *helpcharset INIT(NULL);
179 /* Working directory, input directory, installation directory,
181 EXTERN LOGICAL defaultext ;
182 EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
184 EXTERN char *baseext ;
185 EXTERN char *nodirbase ;
186 EXTERN char *work INIT("") ;
187 EXTERN char *indir INIT(NULL) ;
188 EXTERN char *install INIT(NULL) ;
189 typedef struct search SEARCH ;
194 EXTERN SEARCH *path INIT(NULL) ;
195 EXTERN SEARCH **endpath INIT(&path) ;
200 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL)
203 ****define directory separator here****
208 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL)
216 ****define directory separator here****
220 /* Location in .TEX file of two \wlog messages */
223 /* True if have encountered idx or idxsyn */
224 EXTERN LOGICAL have_index INIT(FALSE) ;
225 EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
227 /* True within a sequence of rsect's */
228 EXTERN LOGICAL rsectseq INIT(FALSE) ;
230 /* True if SAMEPAGE for this rsect sequence */
231 EXTERN LOGICAL rsectsame ;
233 /* True if have encountered <NEWPAGE> in a SAMEPAGE <RSECT>*/
234 EXTERN LOGICAL rsectholdnew ;
236 /* True in an rsect that has an abbreviated head */
237 EXTERN LOGICAL didabbrev ;
239 /* True if this manual has a glossary */
240 EXTERN LOGICAL glossary INIT(FALSE) ;
242 /* True while processing a note if a head was encountered */
243 EXTERN LOGICAL notehead ;
245 /* String emitted at start of note, caution or warning */
246 EXTERN char ncwStart[] INIT("<PARAGRAPH %s after 0 left 5 first 5 right 0>\n\
247 <TYPE serif><WEIGHT bold>");
249 /* String emitted at end of note, caution or warning */
250 EXTERN char ncwEnd[] INIT("%s</WEIGHT></TYPE></PARAGRAPH>\n\
251 <PARAGRAPH before 0 after 0 left 5 right 0>\n");
253 /* String emitted if a graphic is present for note, caution or warning */
254 EXTERN char ncwGraphic[] INIT("<LABEL><GRAPHIC file %s></LABEL>\n");
256 /* String emitted to position note, caution or warning in a tight list */
257 EXTERN char *ncwTightList INIT("");
259 /* File address for "Generated TeX file complete" message */
260 EXTERN long texcomplete ;
262 /* File pointer for cross-reference file */
265 /* global link type pointer, used in xref to match latest link type */
266 EXTERN int global_linktype INIT (0);
268 /* pointers to image parameters for use in imagetext */
269 EXTERN M_WCHAR *indentp;
270 EXTERN M_WCHAR *imagegentityp;
271 EXTERN M_WCHAR *imagegpositionp;
272 EXTERN M_WCHAR *imageghyperlinkp;
273 EXTERN M_WCHAR *imageglinktypep;
274 EXTERN M_WCHAR *imagegdescription;
276 /* indent for p, image, ex, vex, based on plain list */
277 #define LISTFIRSTINDENT 2
278 #define LISTITEMINDENT 2
279 #define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
281 #define ORDEREDLISTFIRSTINDENT 1
282 #define ORDEREDLISTITEMINDENT 3
283 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
285 /* File offset after preamble, and before \bye. Used to determine
286 whether content found in the document */
287 EXTERN long postpreamble INIT(0L) ;
288 EXTERN long prebye INIT(0L) ;
289 EXTERN LOGICAL filefound INIT(FALSE) ;
291 /* Chapter or appendix number */
292 EXTERN int part INIT(0) ;
293 EXTERN int chapter INIT(0) ;
294 EXTERN int chapinc INIT(0) ;
295 EXTERN char chapstring[15] INIT("0") ;
297 #define NODEID_LENGTH 204
298 /* name of current node */
299 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
300 /* Node number for autogenerated node id */
301 EXTERN int autonodenumber INIT(1);
302 EXTERN char nodestring[15] INIT("0");
303 /* Node level variables */
304 EXTERN int lastnodelevel INIT(0);
305 EXTERN int thisnodelevel INIT(0);
306 /* Offset of node from beginning of file */
307 EXTERN long int nodeoffset INIT(0);
308 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
309 /* is this the first node of a .ht file? */
310 EXTERN LOGICAL firstnode INIT(TRUE);
311 /* flag for omitting first newline in topic map file */
312 EXTERN LOGICAL isfirsttopicmap INIT(TRUE);
313 EXTERN LOGICAL nohometopic INIT(TRUE);
314 EXTERN long topicoffset INIT(0L);
315 EXTERN int htfileno INIT(1);
316 /* The first tag in the front section should trigger the node */
317 EXTERN LOGICAL have_a_frontnode INIT(FALSE);
318 EXTERN char *helpbase INIT(NULL);
319 EXTERN char *helpext;
320 /* small buffer for scratch work */
321 EXTERN char helptmpbuf[2] INIT("0");
323 /* Should we use these BASENAME_LIMIT on the size of file names? */
324 LOGICAL usingshortnames INIT(FALSE);
325 /* Limit on how long the basename can be for a .ht file */
326 #define BASENAME_LIMIT 6
327 /* limit on how many additional character are allowed before the ext */
328 /* (How many chapter numbers foo``12''.ht */
329 #define PRE_EXTENSION_LIMIT 2
331 EXTERN FILE *indexfp;
332 EXTERN FILE *docregfp;
333 EXTERN FILE *idtablefp;
334 EXTERN FILE *topicmapfp;
336 /* Whether have processed anything in chapter or appendix */
337 EXTERN LOGICAL chapst INIT(FALSE) ;
339 /* Whether have just started a fourth-level section */
340 EXTERN LOGICAL st4 INIT(FALSE) ;
342 /* TRUE for chapter, FALSE for appendix */
343 EXTERN LOGICAL inchapter INIT(TRUE) ;
345 /* Figure number within this chapter or appendix */
348 /* Options on a particular figure */
349 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
352 /* Table number within this chapter or appendix */
355 /* footnote number */
356 EXTERN int footnoteno INIT(0);
358 /* True while processing abbrev head for page footer */
359 EXTERN LOGICAL fabbrev INIT(FALSE) ;
360 EXTERN LOGICAL abbrev INIT(FALSE) ;
362 EXTERN FILE *outfile ;
363 /* re-directing output to nothing, eg. used for unimplemented tags */
364 EXTERN FILE *nullfile ;
365 /* save the old outfile when redirecting data to nullfile */
366 EXTERN FILE *CDROMsaveoutfile ;
367 /* save the old outfile when redirecting header/footer data to nullfile */
368 EXTERN FILE *HFsaveoutfile;
370 /* True if a figure or table has a caption */
371 EXTERN LOGICAL figcaption ;
372 EXTERN LOGICAL tabcaption ;
374 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
377 EXTERN int sklines, skchars ;
379 /* contains current m_textchar, used to see if we need to issue an italic
380 correction. Issue italic correction everywhere except after commas
382 EXTERN M_WCHAR cur_char INIT(' ') ;
384 /* Special characters */
389 /* Error _DtMessage section */
390 EXTERN LOGICAL emsghead INIT(FALSE) ;
391 /* emsghead has three possible values:
392 DEFHEAD : use default error message title
393 USERHEAD : user specified
394 FALSE : do not process head (assume define is not equal to
401 #define FIGDEFWH "3in"
402 #define MAXNORMROWS 55
403 #define MAXSMALROWS 75
404 #define MAXTINYROWS 100
405 #define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
406 #define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
408 EXTERN LOGICAL fignote ;
409 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
410 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
411 EXTERN LOGICAL file_ent ;
412 EXTERN M_WCHAR *f_content ;
413 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
414 EXTERN M_WCHAR *f_file ;
416 /* callouts -- entfile and lineno */
417 EXTERN M_WCHAR *figinpath ;
418 EXTERN int figline INIT(0) ;
421 #define BYTE unsigned char
427 typedef struct tagFPOINT {
431 typedef struct tagPwT {
442 #define AN_hasbros 32
453 #define UNPK(c,an,sh) ((c&an)>>sh)
455 EXTERN FILE *calfile ;
457 EXTERN LOGICAL okcallout ;
458 /* -- end callout -- */
460 EXTERN FILE *pclfile ;
462 #define VERSION "Version"
463 EXTERN char *version INIT(NULL) ;
465 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
467 /* Code for standard library function "access" */
470 /* Allowable units on dimensions */
471 #define SPperPT 65536.0
472 #define PTperIN 72.27
476 EXTERN char *dimarray[5]
487 EXTERN LOGICAL unleaded INIT(FALSE) ;
488 EXTERN int newhline INIT(0) ;
489 EXTERN int synelcnt INIT(0);
491 /* Cross-Reference Declarations */
492 /* do we have foreward references? */
493 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
494 EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
495 EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
496 EXTERN M_TRIE xtree ;
498 M_WCHAR *textptr ; /* Pointer to expansion of xref */
499 LOGICAL defined ; /* Whether the xref has been defined */
500 LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
501 LOGICAL retrieved ; /* Whether the value has been used */
502 LOGICAL csensitive ; /* Whether the value is chapter sensitive */
503 LOGICAL xrefable; /* can this be xref'd to legally? */
504 char *chapstring ; /* Number of chapter or appendix where it occurs */
505 LOGICAL inchapter ; /* Whether in chapter or appendix */
506 M_WCHAR *file ; /* File and line # where first referred to or */
507 int line ; /* first defined for error reports */
509 /* Value of one particular cross-reference */
510 EXTERN M_WCHAR xrefstring[400] ;
511 EXTERN int xstrlen INIT(0) ;
512 /* Pointer to the id */
513 EXTERN M_WCHAR *savid ;
514 EXTERN LOGICAL iderr ;
515 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
517 /* Save head for page header in rsect and table of contents string*/
518 EXTERN M_WCHAR savehead[400] ;
519 EXTERN M_WCHAR savetabcap[400] ;
520 EXTERN int svheadlen ;
522 EXTERN LOGICAL savhd ;
523 EXTERN LOGICAL savtc ;
524 EXTERN LOGICAL hderr ;
525 EXTERN LOGICAL echo ;
526 EXTERN LOGICAL tooutput INIT(TRUE) ;
528 /* Glossary Declarations */
529 EXTERN M_TRIE gtree ;
531 EXTERN M_WCHAR term[MAXTERM + 1] ;
532 EXTERN M_WCHAR *termp ;
533 EXTERN LOGICAL wsterm ;
537 EXTERN int exlineno ;
538 EXTERN LOGICAL tonumexlines ;
540 /* Saved document title */
541 EXTERN M_WCHAR *savedtitle;
543 /* tell whether .hmi should have generic info put into it */
544 EXTERN LOGICAL hadtitle INIT(FALSE);
545 EXTERN LOGICAL hadabstract INIT(FALSE);
547 /* emit an empty abstract title if no head specified */
548 EXTERN LOGICAL needabstracthead INIT(FALSE);
550 /* Numeric codes corresponding to keyword parameter values */
561 /* Note that the definition of BOX was chosen so that the border
562 parameter on both figure and table could use it, even though these
563 parameters do not share all possible values */
578 /* IMPORTANT: "FIG..." values should not be */
579 /* changed (eg. see proc "checkmargin") */
589 /* text size macros */
643 #define NOAUTOSCALE 2
645 /* the values for these elements are significant...they are used to set
646 * TeX register values which are later tested by macros
651 /* the values for these elements are significant...they are used to set
652 * TeX register values which are later tested by macros
659 /* values for ctable tracking */
661 EXTERN int ctbldisplines;
662 EXTERN int ctblgraphics;
664 /* Declarations for lists */
666 /* FIRST => first paragraph in list item. The one following the label.
667 FOLLOW => immediately after a figure, note, caution, warning, ex or vex
668 INSIDE => at least one previous paragraph
670 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
672 EXTERN LOGICAL lablistindented[MAXLISTLEV];
673 EXTERN int list INIT(0) ;
674 typedef struct contchain CONTCHAIN ;
679 typedef struct list LIST ;
685 unsigned char punct ;
686 unsigned char started ;
687 unsigned char where ;
693 = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
696 EXTERN LIST *lastlist INIT(&outlist) ;
697 EXTERN int bulcount INIT(0) ;
699 /* Volume name for index */
700 EXTERN M_WCHAR volume[M_NAMELEN + 1] ;
701 /* save area for index processing */
702 EXTERN M_WCHAR idxsav[400] ;
703 /* Sort form of an index term */
704 EXTERN M_WCHAR sort[400] ;
705 /* Sort form of an index sub term */
706 EXTERN M_WCHAR subsort[400] ;
707 /* print form of index term */
708 EXTERN M_WCHAR print[400] ;
709 /* print form of index sub term */
710 EXTERN M_WCHAR subprint[400] ;
711 EXTERN int idxsavlen ;
712 EXTERN LOGICAL didsort ;
713 EXTERN LOGICAL didsubsort ;
715 /* Strings for constructing error messages */
716 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
717 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
718 EXTERN char infile[] INIT("file %s, ") ;
719 EXTERN char online[] INIT("line %d)\n") ;
720 EXTERN char offile[] INIT(" of file: %s") ;
721 /* Whitemenu supported only in calculator, issue message only once */
722 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
724 /* Repeated code at start of each text block */
725 #define STARTSTUFF {}
727 /* Pop the stack of font changes */
729 /* For index entries */
732 #define IDXSTRT IDXSTRT1 IDXSTRT2
737 #define IDXEND IDXEND1 IDXEND2 IDXEND3
739 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
740 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
742 /* flag for leaders within <LIST PLAIN> only */
743 EXTERN LOGICAL leaderok INIT(FALSE) ;
745 /* Direct debugging trace output to stdout or outfile */
746 EXTERN LOGICAL tracetostd INIT(FALSE) ;
748 /* show memory available */
749 EXTERN LOGICAL showmem INIT(FALSE);
751 /* Function prototypes */
754 /* Declarations for handling special characters */
757 /* Declarations for handling special characters for calculators*/
758 EXTERN char ccoutbuf[128] ;
760 /* Character conversion tables */
761 #include "charconv.h"