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:18:34 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 */
51 #define MAXHEADLINES 3
55 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
71 #if defined(FUTURE_FEATURE)
76 #endif /* FUTURE_FEATURE */
80 EXTERN int optval INIT(M_NULLVAL) ;
82 EXTERN char *optkey[NUMOPTIONS]
100 #if defined(FUTURE_FEATURE)
105 #endif /* FUTURE_FEATURE */
110 /* Processing options */
111 EXTERN LOGICAL final INIT(FALSE) ;
112 EXTERN LOGICAL memo INIT(FALSE) ;
113 EXTERN int rebuild INIT(FALSE) ;
115 EXTERN LOGICAL stoponerror INIT(TRUE) ;
117 #if defined(FUTURE_FEATURE)
118 EXTERN LOGICAL prntrevs INIT(FALSE) ;
119 #endif /* FUTURE_FEATURE */
121 /* Flag for filelist vs. Tag to SDL translator */
122 EXTERN LOGICAL filelist INIT(FALSE) ;
124 EXTERN M_WCHAR *helpcharset INIT(NULL);
125 EXTERN M_WCHAR *helplang INIT(NULL);
126 EXTERN char *docId INIT("SDL-RESERVED0");
127 EXTERN char sdlReservedName[] INIT("SDL-RESERVED");
128 #define SDLNAMESIZ sizeof("SDL-RESERVED")
129 EXTERN char *pubId INIT("CDE 1.0");
131 /* Working directory, input directory, installation directory,
133 EXTERN LOGICAL defaultext ;
134 EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
136 EXTERN char *baseext ;
137 EXTERN char *nodirbase ;
138 EXTERN char *work INIT("") ;
139 EXTERN char *indir INIT(NULL) ;
140 EXTERN char *install INIT(NULL) ;
141 typedef struct search SEARCH ;
146 EXTERN SEARCH *path INIT(NULL) ;
147 EXTERN SEARCH **endpath INIT(&path) ;
148 EXTERN char dirsep INIT('/') ;
153 /* True within a sequence of rsect's */
154 EXTERN LOGICAL rsectseq INIT(FALSE) ;
156 /* True if SAMEPAGE for this rsect sequence */
157 EXTERN LOGICAL rsectsame ;
159 /* True if this manual has a glossary */
160 EXTERN LOGICAL glossary INIT(FALSE) ;
162 /* True while processing a note if a head was encountered */
163 EXTERN LOGICAL notehead ;
165 /* File pointer for cross-reference file */
168 /* global link type pointer, used in xref to match latest link type */
169 EXTERN int global_linktype INIT (0);
171 /* pointers to image parameters for use in imagetext */
172 EXTERN M_WCHAR *indentp;
173 EXTERN M_WCHAR *imagegentityp;
174 EXTERN M_WCHAR *imagegpositionp;
175 EXTERN M_WCHAR *imageghyperlinkp;
176 EXTERN M_WCHAR *imageglinktypep;
177 EXTERN M_WCHAR *imagegdescription;
179 LOGICAL inParText INIT(FALSE);
180 LOGICAL inSdlP INIT(FALSE);
182 /* Save these ids and reuse them on the current virpage.
183 * We need two of each (except for the first) so we can alternate to
184 * avoid <form> thinking it is supposed to span them. The bullet id
185 * indexes will flip back and forth between 0 and 1 to pick an id.
187 int bulletId[2], looseBulletId[2], firstBulletId, firstLooseBulletId;
188 int bulletIdIndex INIT(1);
189 int looseBulletIdIndex INIT(1);
191 /* save the textsize to emit it on the <p> tag; this allows us to have
192 * a single ssi= for the "ex" <block> and modify the text size individually
195 EXTERN int exTextSize;
197 /* File offset after preamble, and before \bye. Used to determine
198 whether content found in the document */
199 EXTERN long postpreamble INIT(0L) ;
200 EXTERN long prebye INIT(0L) ;
201 EXTERN LOGICAL filefound INIT(FALSE) ;
203 /* Chapter or appendix number */
204 EXTERN int part INIT(0) ;
205 EXTERN int chapter INIT(0) ;
206 EXTERN int chapinc INIT(0) ;
207 EXTERN char chapstring[15] INIT("0") ;
209 #define NODEID_LENGTH 204
210 /* name of current node */
211 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
212 /* Node level variables */
213 EXTERN int thisnodelevel INIT(0);
214 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
215 /* flag for omitting first newline in topic map file */
216 EXTERN LOGICAL nohometopic INIT(TRUE);
217 EXTERN int parTextId INIT(0);
218 EXTERN char *helpbase INIT(NULL);
219 EXTERN char *helpext;
221 /* Should we use these BASENAME_LIMIT on the size of file names? */
222 LOGICAL usingshortnames INIT(FALSE);
223 /* Limit on how long the basename can be for a .ht file */
224 #define BASENAME_LIMIT 6
225 /* limit on how many additional character are allowed before the ext */
226 /* (How many chapter numbers foo``12''.ht */
227 #define PRE_EXTENSION_LIMIT 2
230 EXTERN FILE *indexfp;
232 /* Whether have processed anything in chapter or appendix */
233 EXTERN LOGICAL chapst INIT(FALSE) ;
235 /* TRUE for chapter, FALSE for appendix */
236 EXTERN LOGICAL inchapter INIT(TRUE) ;
238 /* Figure number within this chapter or appendix */
241 /* Options on a particular figure */
242 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
245 /* Place to hold <snb> entries until after a <virpage><head>, if any,
246 * is seen. Also, an integer value of the offset into the file to the
247 * point immediately after either <virpage> or <virpage><head> - the
248 * place to put the <snb>.
250 EXTERN char *savesnb INIT(NULL);
251 EXTERN int snbstart INIT(0);
253 /* Table number within this chapter or appendix */
256 /* footnote number */
257 EXTERN int footnoteno INIT(0);
259 /* True while processing abbrev head for page footer */
260 EXTERN LOGICAL fabbrev INIT(FALSE) ;
262 EXTERN FILE *outfile ;
264 /* True if a figure or table has a caption */
265 EXTERN LOGICAL figcaption ;
266 EXTERN LOGICAL tabcaption ;
267 EXTERN char *capposition; /* left/center/right position of the caption */
269 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
272 EXTERN int sklines, skchars ;
274 /* contains current m_textchar, used to see if we need to issue an italic
275 correction. Issue italic correction everywhere except after commas
277 EXTERN M_WCHAR cur_char INIT(' ') ;
279 /* Special characters */
284 /* Error _CoeMessage section */
285 EXTERN LOGICAL emsghead INIT(FALSE) ;
286 /* emsghead has three possible values:
287 DEFHEAD : use default error message title
288 USERHEAD : user specified
289 FALSE : do not process head (assume define is not equal to
295 /* declarations for the <form> stack */
296 typedef struct forminfo FORMINFO;
301 EXTERN FORMINFO *formStackBase INIT(NULL);
302 EXTERN FORMINFO *formStackTop INIT(NULL);
303 EXTERN FORMINFO *formStackMax INIT(NULL);
305 /* flag that we have output an SDL <block> for <partext> */
306 EXTERN LOGICAL inBlock INIT(FALSE);
308 /* flag that we need to output an <fdata> for a <form> */
309 EXTERN LOGICAL needFData INIT(FALSE);
312 #define FIGDEFWH "3in"
313 #define MAXNORMROWS 55
314 #define MAXSMALROWS 75
315 #define MAXTINYROWS 100
316 #define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
317 #define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
319 EXTERN LOGICAL fignote ;
320 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
321 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
322 EXTERN LOGICAL file_ent ;
323 EXTERN M_WCHAR *f_content ;
324 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
325 EXTERN M_WCHAR *f_file ;
327 /* callouts -- entfile and lineno */
328 EXTERN M_WCHAR *figinpath ;
329 EXTERN int figline INIT(0) ;
332 #define BYTE unsigned char
338 typedef struct tagFPOINT {
342 typedef struct tagPwT {
353 #define AN_hasbros 32
364 #define UNPK(c,an,sh) ((c&an)>>sh)
366 EXTERN FILE *calfile ;
368 EXTERN LOGICAL okcallout ;
369 /* -- end callout -- */
371 EXTERN FILE *pclfile ;
373 #define VERSION "Version"
374 EXTERN char *version INIT(NULL) ;
376 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
378 /* Code for standard library function "access" */
381 /* Allowable units on dimensions */
382 #define SPperPT 65536.0
383 #define PTperIN 72.27
387 EXTERN char *dimarray[5]
398 EXTERN int newhline INIT(0) ;
399 EXTERN int synelcnt INIT(0);
401 /* Cross-Reference Declarations */
402 /* do we have foreward references? */
403 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
404 EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
405 EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
406 EXTERN M_TRIE xtree ;
408 M_WCHAR *textptr ; /* Pointer to expansion of xref */
409 LOGICAL defined ; /* Whether the xref has been defined */
410 LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
411 LOGICAL retrieved ; /* Whether the value has been used */
412 LOGICAL csensitive ; /* Whether the value is chapter sensitive */
413 LOGICAL xrefable; /* can this be xref'd to legally? */
414 char *chapstring ; /* Number of chapter or appendix where it occurs */
415 LOGICAL inchapter ; /* Whether in chapter or appendix */
416 M_WCHAR *file ; /* File and line # where first referred to or */
417 int line ; /* first defined for error reports */
419 /* Value of one particular cross-reference */
420 EXTERN M_WCHAR xrefstring[400] ;
421 EXTERN int xstrlen INIT(0) ;
422 /* Pointer to the id */
423 EXTERN M_WCHAR *savid ;
424 EXTERN LOGICAL iderr ;
425 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
427 /* Save head for page header in rsect and table of contents string*/
428 EXTERN M_WCHAR savehead[400] ;
429 EXTERN M_WCHAR savetabcap[400] ;
430 EXTERN int svheadlen ;
432 EXTERN LOGICAL savhd ;
433 EXTERN LOGICAL savtc ;
434 EXTERN LOGICAL hderr ;
435 EXTERN LOGICAL echo ;
436 EXTERN LOGICAL tooutput INIT(TRUE) ;
438 /* Save example until we see an annotation (which will behave like a head */
441 EXTERN char *saveexseg;
442 EXTERN int svexseglen;
443 EXTERN LOGICAL savex;
444 EXTERN LOGICAL stackex;
445 EXTERN LOGICAL firstAnnot;
446 EXTERN LOGICAL tonumexlines;
447 EXTERN int exLineNum;
448 EXTERN int oldExLineNum;
450 /* Glossary Declarations */
451 EXTERN M_TRIE gtree ;
453 EXTERN M_WCHAR term[MAXTERM + 1] ;
454 EXTERN M_WCHAR *termp ;
455 EXTERN LOGICAL wsterm ;
456 EXTERN int lastTermId;
458 /* Saved document title */
459 EXTERN M_WCHAR *savedtitle;
461 /* tell whether .hmi should have generic info put into it */
462 EXTERN LOGICAL hadtitle INIT(FALSE);
463 EXTERN LOGICAL hadabstract INIT(FALSE);
465 /* emit an empty abstract title if no head specified */
466 EXTERN LOGICAL needabstracthead INIT(FALSE);
468 /* Numeric codes corresponding to keyword parameter values */
479 /* Note that the definition of BOX was chosen so that the border
480 parameter on both figure and table could use it, even though these
481 parameters do not share all possible values */
496 /* IMPORTANT: "FIG..." values should not be */
497 /* changed (eg. see proc "checkmargin") */
507 /* text size macros */
561 #define NOAUTOSCALE 2
563 /* the values for these elements are significant...they are used to set
564 * TeX register values which are later tested by macros
569 /* the values for these elements are significant...they are used to set
570 * TeX register values which are later tested by macros
577 /* values for ctable tracking */
579 EXTERN int ctbldisplines;
580 EXTERN int ctblgraphics;
582 /* Declarations for lists */
584 /* FIRST => first paragraph in list item. The one following the label.
585 FOLLOW => immediately after a figure, note, caution, warning, ex or vex
586 INSIDE => at least one previous paragraph
588 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
589 EXTERN LOGICAL firstPInBlock; /* give the first para a different ssi= */
591 EXTERN LOGICAL lablisttight[MAXLISTLEV];
592 EXTERN int labhid[MAXLISTLEV];
593 EXTERN int labhtextid[MAXLISTLEV];
594 EXTERN int labelid[MAXLISTLEV];
595 EXTERN int labeltextid[MAXLISTLEV];
596 EXTERN int list INIT(0) ;
597 typedef struct contchain CONTCHAIN ;
602 typedef struct list LIST ;
608 unsigned char punct ;
609 unsigned char started ;
610 unsigned char where ;
616 = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
619 EXTERN LIST *lastlist INIT(&outlist) ;
620 EXTERN int bulcount INIT(0) ;
622 typedef struct rowvec ROWVEC;
624 unsigned char firstitem;
625 unsigned char longlabel;
627 EXTERN ROWVEC listitems[MAXLISTLEV+1];
629 /* save area for index processing */
630 EXTERN M_WCHAR idxsav[400] ;
631 /* Sort form of an index term */
632 EXTERN M_WCHAR sort[400] ;
633 /* Sort form of an index sub term */
634 EXTERN M_WCHAR subsort[400] ;
635 /* print form of index term */
636 EXTERN M_WCHAR print[400] ;
637 /* print form of index sub term */
638 EXTERN M_WCHAR subprint[400] ;
639 EXTERN int idxsavlen ;
640 EXTERN LOGICAL didsort ;
641 EXTERN LOGICAL didsubsort ;
643 /* Strings for constructing error messages */
644 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
645 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
646 EXTERN char infile[] INIT("file %s, ") ;
647 EXTERN char online[] INIT("line %d)\n") ;
648 EXTERN char offile[] INIT(" of file: %s") ;
649 /* Whitemenu supported only in calculator, issue message only once */
650 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
652 /* Pop the stack of font changes */
654 /* For index entries */
657 #define IDXSTRT IDXSTRT1 IDXSTRT2
662 #define IDXEND IDXEND1 IDXEND2 IDXEND3
664 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
665 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
667 /* flag for leaders within <LIST PLAIN> only */
668 EXTERN LOGICAL leaderok INIT(FALSE) ;
670 /* Direct debugging trace output to stdout or outfile */
671 EXTERN LOGICAL tracetostd INIT(FALSE) ;
673 /* Function prototypes */
676 /* Declarations for handling special characters */
679 /* Declarations for handling special characters for calculators*/
680 EXTERN char ccoutbuf[128] ;
682 /* Character conversion tables */
683 #include "charconv.h"