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:51 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(__osf__) || defined(linux) || defined(CSRG_BASED)
52 #define MAXHEADLINES 3
57 /* substitute for m_ctupper; we don't cast x into (int), thereby
58 avoiding any problems of high order bit. This is in response
59 to "Entity no allowed in ART" messages by cupertino. However,
60 this more of a loose deduction, and really needs confirmation. */
61 #define ctupper(x) (m_ctarray[x].upper)
64 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
80 #if defined(FUTURE_FEATURE)
85 #endif /* FUTURE_FEATURE */
89 EXTERN int optval INIT(M_NULLVAL) ;
91 EXTERN char *optkey[NUMOPTIONS]
109 #if defined(FUTURE_FEATURE)
114 #endif /* FUTURE_FEATURE */
119 /* Processing options */
120 EXTERN LOGICAL final INIT(FALSE) ;
121 EXTERN LOGICAL memo INIT(FALSE) ;
122 EXTERN int rebuild INIT(FALSE) ;
124 EXTERN LOGICAL stoponerror INIT(TRUE) ;
126 #if defined(FUTURE_FEATURE)
127 EXTERN LOGICAL prntrevs INIT(FALSE) ;
128 #endif /* FUTURE_FEATURE */
130 /* variables for index sorting and tagging in the scripts */
131 /* we create a child directory for processing the index, so as not
132 to clobber any files with the same base name. However, this will
133 affect search paths that are relative; those that are relative
134 need to have parent level prepended. This is done only when
135 "parentsrch" is set to TRUE; done only when we process indexes. */
136 EXTERN LOGICAL parentsrch INIT(FALSE) ;
137 EXTERN char *idxfile INIT(NULL) ; /* index file name only */
138 EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
139 EXTERN char *idxbase INIT(NULL) ; /* index base name only */
141 /* TeX counter for chapter number */
143 #define APPCOUNT 1000
144 #define TOCCOUNT 2000
145 #define MSGCOUNT 3000
146 #define BIBCOUNT 4000
147 #define GLOSSCOUNT 5000
148 #define INDEXCOUNT 6000
150 /* Flag for filelist vs. Tag to SDL translator */
151 EXTERN LOGICAL filelist INIT(FALSE) ;
153 EXTERN M_WCHAR *helpcharset INIT(NULL);
154 EXTERN M_WCHAR *helplang INIT(NULL);
155 EXTERN char *docId INIT("SDL-RESERVED0");
156 EXTERN char sdlReservedName[] INIT("SDL-RESERVED");
157 #define SDLNAMESIZ sizeof("SDL-RESERVED")
158 EXTERN char *pubId INIT("CDE 1.0");
160 /* Working directory, input directory, installation directory,
162 EXTERN LOGICAL defaultext ;
163 EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
165 EXTERN char *baseext ;
166 EXTERN char *nodirbase ;
167 EXTERN char *work INIT("") ;
168 EXTERN char *indir INIT(NULL) ;
169 EXTERN char *install INIT(NULL) ;
170 typedef struct search SEARCH ;
175 EXTERN SEARCH *path INIT(NULL) ;
176 EXTERN SEARCH **endpath INIT(&path) ;
181 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
184 ****define directory separator here****
189 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
197 ****define directory separator here****
201 /* Location in .TEX file of two \wlog messages */
204 /* True if have encountered idx or idxsyn */
205 EXTERN LOGICAL have_index INIT(FALSE) ;
206 EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
208 /* True within a sequence of rsect's */
209 EXTERN LOGICAL rsectseq INIT(FALSE) ;
211 /* True if this manual has a glossary */
212 EXTERN LOGICAL glossary INIT(FALSE) ;
214 /* True while processing a note if a head was encountered */
215 EXTERN LOGICAL notehead ;
217 /* File address for "Generated TeX file complete" message */
218 EXTERN long texcomplete ;
220 /* File pointer for cross-reference file */
223 /* global link type pointer, used in xref to match latest link type */
224 EXTERN int global_linktype INIT (0);
226 /* pointers to image parameters for use in imagetext */
227 EXTERN M_WCHAR *indentp;
228 EXTERN M_WCHAR *imagegentityp;
229 EXTERN M_WCHAR *imagegpositionp;
230 EXTERN M_WCHAR *imageghyperlinkp;
231 EXTERN M_WCHAR *imageglinktypep;
232 EXTERN M_WCHAR *imagegdescription;
234 /* stuff used to build a list of SDL <block> element so we can restart
235 * a block with the previous "class" and "ssi" attributes so
236 * formatting will be correct.
238 typedef struct _block BLOCK;
239 typedef BLOCK *PBLOCK;
245 PBLOCK blockinfo INIT(NULL);
247 LOGICAL inParText INIT(FALSE);
248 LOGICAL inSdlP INIT(FALSE);
250 /* Save these ids and reuse them on the current virpage.
251 * We need two of each (except for the first) so we can alternate to
252 * avoid <form> thinking it is supposed to span them. The bullet id
253 * indexes will flip back and forth between 0 and 1 to pick an id.
255 int bulletId[2], looseBulletId[2], firstBulletId, firstLooseBulletId;
256 int bulletIdIndex INIT(1);
257 int looseBulletIdIndex INIT(1);
259 /* indent for p, image, ex, vex, based on plain list */
260 #define LISTFIRSTINDENT 2
261 #define LISTITEMINDENT 2
262 #define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
263 /* save the textsize to emit it on the <p> tag; this allows us to have
264 * a single ssi= for the "ex" <block> and modify the text size individually
267 EXTERN int exTextSize;
269 #define ORDEREDLISTFIRSTINDENT 1
270 #define ORDEREDLISTITEMINDENT 3
271 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
273 /* File offset after preamble, and before \bye. Used to determine
274 whether content found in the document */
275 EXTERN long postpreamble INIT(0L) ;
276 EXTERN long prebye INIT(0L) ;
277 EXTERN LOGICAL filefound INIT(FALSE) ;
279 /* Chapter or appendix number */
280 EXTERN int part INIT(0) ;
281 EXTERN int chapter INIT(0) ;
282 EXTERN int chapinc INIT(0) ;
283 EXTERN char chapstring[15] INIT("0") ;
285 #define NODEID_LENGTH 204
286 /* name of current node */
287 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
288 /* Node level variables */
289 EXTERN int thisnodelevel INIT(0);
290 /* Offset of node from beginning of file */
291 EXTERN long int nodeoffset INIT(0);
292 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
293 /* flag for omitting first newline in topic map file */
294 EXTERN LOGICAL nohometopic INIT(TRUE);
295 EXTERN int parTextId INIT(0);
296 EXTERN long topicoffset INIT(0L);
297 EXTERN int htfileno INIT(1);
298 /* The first tag in the front section should trigger the node */
299 EXTERN LOGICAL have_a_frontnode INIT(FALSE);
300 EXTERN char *helpbase INIT(NULL);
301 EXTERN char *helpext;
302 /* small buffer for scratch work */
303 EXTERN char helptmpbuf[2] INIT("0");
305 /* Should we use these BASENAME_LIMIT on the size of file names? */
306 LOGICAL usingshortnames INIT(FALSE);
307 /* Limit on how long the basename can be for a .ht file */
308 #define BASENAME_LIMIT 6
309 /* limit on how many additional character are allowed before the ext */
310 /* (How many chapter numbers foo``12''.ht */
311 #define PRE_EXTENSION_LIMIT 2
314 EXTERN FILE *indexfp;
316 /* Whether have processed anything in chapter or appendix */
317 EXTERN LOGICAL chapst INIT(FALSE) ;
319 /* TRUE for chapter, FALSE for appendix */
320 EXTERN LOGICAL inchapter INIT(TRUE) ;
322 /* Figure number within this chapter or appendix */
325 /* Options on a particular figure */
326 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
329 /* Place to hold <snb> entries until after a <virpage><head>, if any,
330 * is seen. Also, an integer value of the offset into the file to the
331 * point immediately after either <virpage> or <virpage><head> - the
332 * place to put the <snb>.
334 EXTERN char *savesnb INIT(NULL);
335 EXTERN int snbstart INIT(0);
337 /* Table number within this chapter or appendix */
340 /* footnote number */
341 EXTERN int footnoteno INIT(0);
343 EXTERN FILE *outfile ;
345 /* True if a figure or table has a caption */
346 EXTERN LOGICAL figcaption ;
347 EXTERN LOGICAL tabcaption ;
348 EXTERN char *capposition; /* left/center/right position of the caption */
350 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
352 /* contains current m_textchar, used to see if we need to issue an italic
353 correction. Issue italic correction everywhere except after commas
355 EXTERN M_WCHAR cur_char INIT(' ') ;
357 /* Special characters */
362 /* Error Message section */
363 EXTERN LOGICAL emsghead INIT(FALSE) ;
364 /* emsghead has three possible values:
365 DEFHEAD : use default error message title
366 USERHEAD : user specified
367 FALSE : do not process head (assume define is not equal to
373 /* declarations for the <form> stack */
374 typedef struct forminfo FORMINFO;
379 EXTERN FORMINFO *formStackBase INIT(NULL);
380 EXTERN FORMINFO *formStackTop INIT(NULL);
381 EXTERN FORMINFO *formStackMax INIT(NULL);
383 /* flag that we have output an SDL <block> for <partext> */
384 EXTERN LOGICAL inBlock INIT(FALSE);
386 /* flag that we need to output an <fdata> for a <form> */
387 EXTERN LOGICAL needFData INIT(FALSE);
390 #define FIGDEFWH "3in"
391 #define MAXNORMROWS 55
392 #define MAXSMALROWS 75
393 #define MAXTINYROWS 100
394 #define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
395 #define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
397 EXTERN LOGICAL fignote ;
398 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
399 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
400 EXTERN LOGICAL file_ent ;
401 EXTERN M_WCHAR *f_content ;
402 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
403 EXTERN M_WCHAR *f_file ;
405 /* callouts -- entfile and lineno */
406 EXTERN M_WCHAR *figinpath ;
407 EXTERN int figline INIT(0) ;
410 #define BYTE unsigned char
416 typedef struct tagFPOINT {
420 typedef struct tagPwT {
431 #define AN_hasbros 32
442 #define UNPK(c,an,sh) ((c&an)>>sh)
444 EXTERN FILE *calfile ;
446 EXTERN LOGICAL okcallout ;
447 /* -- end callout -- */
449 EXTERN FILE *pclfile ;
451 #define VERSION "Version"
452 EXTERN char *version INIT(NULL) ;
454 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
456 /* Code for standard library function "access" */
459 /* Allowable units on dimensions */
460 #define SPperPT 65536.0
461 #define PTperIN 72.27
465 EXTERN char *dimarray[5]
476 EXTERN int newhline INIT(0) ;
477 EXTERN int synelcnt INIT(0);
479 /* Cross-Reference Declarations */
480 /* do we have foreward references? */
481 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
482 EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
483 EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
484 EXTERN M_TRIE xtree ;
486 M_WCHAR *textptr ; /* Pointer to expansion of xref */
487 LOGICAL defined ; /* Whether the xref has been defined */
488 LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
489 LOGICAL retrieved ; /* Whether the value has been used */
490 LOGICAL csensitive ; /* Whether the value is chapter sensitive */
491 LOGICAL xrefable; /* can this be xref'd to legally? */
492 char *chapstring ; /* Number of chapter or appendix where it occurs */
493 LOGICAL inchapter ; /* Whether in chapter or appendix */
494 M_WCHAR *file ; /* File and line # where first referred to or */
495 int line ; /* first defined for error reports */
497 /* Value of one particular cross-reference */
498 EXTERN M_WCHAR xrefstring[400] ;
499 EXTERN int xstrlen INIT(0) ;
500 /* Pointer to the id */
501 EXTERN M_WCHAR *savid ;
502 EXTERN LOGICAL iderr ;
503 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
505 /* Save head for page header in rsect and table of contents string*/
506 EXTERN M_WCHAR savehead[400] ;
507 EXTERN M_WCHAR savetabcap[400] ;
508 EXTERN int svheadlen ;
510 EXTERN LOGICAL savhd ;
511 EXTERN LOGICAL savtc ;
512 EXTERN LOGICAL hderr ;
513 EXTERN LOGICAL echo ;
514 EXTERN LOGICAL tooutput INIT(TRUE) ;
516 /* Save example until we see an annotation (which will behave like a head */
519 EXTERN char *saveexseg;
520 EXTERN int svexseglen;
521 EXTERN LOGICAL savex;
522 EXTERN LOGICAL stackex;
524 /* Glossary Declarations */
525 EXTERN M_TRIE gtree ;
527 EXTERN M_WCHAR term[MAXTERM + 1] ;
528 EXTERN M_WCHAR *termp ;
529 EXTERN LOGICAL wsterm ;
530 EXTERN int lastTermId;
532 EXTERN LOGICAL firstAnnot;
533 EXTERN int exLineNum;
534 EXTERN LOGICAL tonumexlines;
535 EXTERN int oldExLineNum;
537 /* Saved document title */
538 EXTERN M_WCHAR *savedtitle;
540 /* tell whether .hmi should have generic info put into it */
541 EXTERN LOGICAL hadtitle INIT(FALSE);
542 EXTERN LOGICAL hadabstract INIT(FALSE);
544 /* emit an empty abstract title if no head specified */
545 EXTERN LOGICAL needabstracthead INIT(FALSE);
547 /* Numeric codes corresponding to keyword parameter values */
558 /* Note that the definition of BOX was chosen so that the border
559 parameter on both figure and table could use it, even though these
560 parameters do not share all possible values */
575 /* IMPORTANT: "FIG..." values should not be */
576 /* changed (eg. see proc "checkmargin") */
586 /* text size macros */
640 #define NOAUTOSCALE 2
642 /* the values for these elements are significant...they are used to set
643 * TeX register values which are later tested by macros
648 /* the values for these elements are significant...they are used to set
649 * TeX register values which are later tested by macros
656 /* values for ctable tracking */
658 EXTERN int ctbldisplines;
659 EXTERN int ctblgraphics;
661 /* Declarations for lists */
663 /* FIRST => first paragraph in list item. The one following the label.
664 FOLLOW => immediately after a figure, note, caution, warning, ex or vex
665 INSIDE => at least one previous paragraph
667 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
668 EXTERN LOGICAL firstPInBlock; /* give the first para a different ssi= */
670 EXTERN LOGICAL lablisttight[MAXLISTLEV];
671 EXTERN int labhid[MAXLISTLEV];
672 EXTERN int labhtextid[MAXLISTLEV];
673 EXTERN int labelid[MAXLISTLEV];
674 EXTERN int labeltextid[MAXLISTLEV];
675 EXTERN int list INIT(0) ;
676 typedef struct contchain CONTCHAIN ;
681 typedef struct list LIST ;
687 unsigned char punct ;
688 unsigned char started ;
689 unsigned char where ;
695 = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
698 EXTERN LIST *lastlist INIT(&outlist) ;
699 EXTERN int bulcount INIT(0) ;
701 typedef struct rowvec ROWVEC;
703 unsigned char firstitem;
704 unsigned char longlabel;
706 EXTERN ROWVEC listitems[MAXLISTLEV+1];
708 /* save area for index processing */
709 EXTERN M_WCHAR idxsav[400] ;
710 /* Sort form of an index term */
711 EXTERN M_WCHAR sort[400] ;
712 /* Sort form of an index sub term */
713 EXTERN M_WCHAR subsort[400] ;
714 /* print form of index term */
715 EXTERN M_WCHAR print[400] ;
716 /* print form of index sub term */
717 EXTERN M_WCHAR subprint[400] ;
718 EXTERN int idxsavlen ;
719 EXTERN LOGICAL didsort ;
720 EXTERN LOGICAL didsubsort ;
722 /* Strings for constructing error messages */
723 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
724 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
725 EXTERN char infile[] INIT("file %s, ") ;
726 EXTERN char online[] INIT("line %d)\n") ;
727 EXTERN char offile[] INIT(" of file: %s") ;
728 /* Whitemenu supported only in calculator, issue message only once */
729 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
731 /* For index entries */
734 #define IDXSTRT IDXSTRT1 IDXSTRT2
739 #define IDXEND IDXEND1 IDXEND2 IDXEND3
741 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
742 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
744 /* Direct debugging trace output to stdout or outfile */
745 EXTERN LOGICAL tracetostd INIT(FALSE) ;
747 /* Function prototypes */
750 /* Declarations for handling special characters */
753 /* Declarations for handling special characters for calculators*/
754 EXTERN char ccoutbuf[128] ;
756 /* Character conversion tables */
757 #include "charconv.h"