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: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 */
47 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__) || defined(linux)
53 #define MAXHEADLINES 3
58 /* substitute for m_ctupper; we don't cast x into (int), thereby
59 avoiding any problems of high order bit. This is in response
60 to "Entity no allowed in ART" messages by cupertino. However,
61 this more of a loose deduction, and really needs confirmation. */
62 #define ctupper(x) (m_ctarray[x].upper)
65 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
81 #if defined(FUTURE_FEATURE)
86 #endif /* FUTURE_FEATURE */
90 EXTERN int optval INIT(M_NULLVAL) ;
92 EXTERN char *optkey[NUMOPTIONS]
110 #if defined(FUTURE_FEATURE)
115 #endif /* FUTURE_FEATURE */
120 /* Processing options */
121 EXTERN LOGICAL final INIT(FALSE) ;
122 EXTERN LOGICAL memo INIT(FALSE) ;
123 EXTERN int rebuild INIT(FALSE) ;
125 EXTERN LOGICAL stoponerror INIT(TRUE) ;
127 #if defined(FUTURE_FEATURE)
128 EXTERN LOGICAL prntrevs INIT(FALSE) ;
129 #endif /* FUTURE_FEATURE */
131 /* variables for index sorting and tagging in the scripts */
132 /* we create a child directory for processing the index, so as not
133 to clobber any files with the same base name. However, this will
134 affect search paths that are relative; those that are relative
135 need to have parent level prepended. This is done only when
136 "parentsrch" is set to TRUE; done only when we process indexes. */
137 EXTERN LOGICAL parentsrch INIT(FALSE) ;
138 EXTERN char *idxfile INIT(NULL) ; /* index file name only */
139 EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
140 EXTERN char *idxbase INIT(NULL) ; /* index base name only */
142 /* TeX counter for chapter number */
144 #define APPCOUNT 1000
145 #define TOCCOUNT 2000
146 #define MSGCOUNT 3000
147 #define BIBCOUNT 4000
148 #define GLOSSCOUNT 5000
149 #define INDEXCOUNT 6000
151 /* Flag for filelist vs. Tag to SDL translator */
152 EXTERN LOGICAL filelist INIT(FALSE) ;
154 EXTERN M_WCHAR *helpcharset INIT(NULL);
155 EXTERN M_WCHAR *helplang INIT(NULL);
156 EXTERN char *docId INIT("SDL-RESERVED0");
157 EXTERN char sdlReservedName[] INIT("SDL-RESERVED");
158 #define SDLNAMESIZ sizeof("SDL-RESERVED")
159 EXTERN char *pubId INIT("CDE 1.0");
161 /* Working directory, input directory, installation directory,
163 EXTERN LOGICAL defaultext ;
164 EXTERN M_WCHAR *inputname; /* pointer to name of main input file */
166 EXTERN char *baseext ;
167 EXTERN char *nodirbase ;
168 EXTERN char *work INIT("") ;
169 EXTERN char *indir INIT(NULL) ;
170 EXTERN char *install INIT(NULL) ;
171 typedef struct search SEARCH ;
176 EXTERN SEARCH *path INIT(NULL) ;
177 EXTERN SEARCH **endpath INIT(&path) ;
182 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__) || defined(__osf__) || defined(linux)
185 ****define directory separator here****
190 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)|| defined(__osf__) || defined(linux)
198 ****define directory separator here****
202 /* Location in .TEX file of two \wlog messages */
205 /* True if have encountered idx or idxsyn */
206 EXTERN LOGICAL have_index INIT(FALSE) ;
207 EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
209 /* True within a sequence of rsect's */
210 EXTERN LOGICAL rsectseq INIT(FALSE) ;
212 /* True if this manual has a glossary */
213 EXTERN LOGICAL glossary INIT(FALSE) ;
215 /* True while processing a note if a head was encountered */
216 EXTERN LOGICAL notehead ;
218 /* File address for "Generated TeX file complete" message */
219 EXTERN long texcomplete ;
221 /* File pointer for cross-reference file */
224 /* global link type pointer, used in xref to match latest link type */
225 EXTERN int global_linktype INIT (0);
227 /* pointers to image parameters for use in imagetext */
228 EXTERN M_WCHAR *indentp;
229 EXTERN M_WCHAR *imagegentityp;
230 EXTERN M_WCHAR *imagegpositionp;
231 EXTERN M_WCHAR *imageghyperlinkp;
232 EXTERN M_WCHAR *imageglinktypep;
233 EXTERN M_WCHAR *imagegdescription;
235 /* stuff used to build a list of SDL <block> element so we can restart
236 * a block with the previous "class" and "ssi" attributes so
237 * formatting will be correct.
239 typedef struct _block BLOCK;
240 typedef BLOCK *PBLOCK;
246 PBLOCK blockinfo INIT(NULL);
248 LOGICAL inParText INIT(FALSE);
249 LOGICAL inSdlP INIT(FALSE);
251 /* Save these ids and reuse them on the current virpage.
252 * We need two of each (except for the first) so we can alternate to
253 * avoid <form> thinking it is supposed to span them. The bullet id
254 * indexes will flip back and forth between 0 and 1 to pick an id.
256 int bulletId[2], looseBulletId[2], firstBulletId, firstLooseBulletId;
257 int bulletIdIndex INIT(1);
258 int looseBulletIdIndex INIT(1);
260 /* indent for p, image, ex, vex, based on plain list */
261 #define LISTFIRSTINDENT 2
262 #define LISTITEMINDENT 2
263 #define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
264 /* save the textsize to emit it on the <p> tag; this allows us to have
265 * a single ssi= for the "ex" <block> and modify the text size individually
268 EXTERN int exTextSize;
270 #define ORDEREDLISTFIRSTINDENT 1
271 #define ORDEREDLISTITEMINDENT 3
272 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
274 /* File offset after preamble, and before \bye. Used to determine
275 whether content found in the document */
276 EXTERN long postpreamble INIT(0L) ;
277 EXTERN long prebye INIT(0L) ;
278 EXTERN LOGICAL filefound INIT(FALSE) ;
280 /* Chapter or appendix number */
281 EXTERN int part INIT(0) ;
282 EXTERN int chapter INIT(0) ;
283 EXTERN int chapinc INIT(0) ;
284 EXTERN char chapstring[15] INIT("0") ;
286 #define NODEID_LENGTH 204
287 /* name of current node */
288 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];
289 /* Node level variables */
290 EXTERN int thisnodelevel INIT(0);
291 /* Offset of node from beginning of file */
292 EXTERN long int nodeoffset INIT(0);
293 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
294 /* flag for omitting first newline in topic map file */
295 EXTERN LOGICAL nohometopic INIT(TRUE);
296 EXTERN int parTextId INIT(0);
297 EXTERN long topicoffset INIT(0L);
298 EXTERN int htfileno INIT(1);
299 /* The first tag in the front section should trigger the node */
300 EXTERN LOGICAL have_a_frontnode INIT(FALSE);
301 EXTERN char *helpbase INIT(NULL);
302 EXTERN char *helpext;
303 /* small buffer for scratch work */
304 EXTERN char helptmpbuf[2] INIT("0");
306 /* Should we use these BASENAME_LIMIT on the size of file names? */
307 LOGICAL usingshortnames INIT(FALSE);
308 /* Limit on how long the basename can be for a .ht file */
309 #define BASENAME_LIMIT 6
310 /* limit on how many additional character are allowed before the ext */
311 /* (How many chapter numbers foo``12''.ht */
312 #define PRE_EXTENSION_LIMIT 2
315 EXTERN FILE *indexfp;
317 /* Whether have processed anything in chapter or appendix */
318 EXTERN LOGICAL chapst INIT(FALSE) ;
320 /* TRUE for chapter, FALSE for appendix */
321 EXTERN LOGICAL inchapter INIT(TRUE) ;
323 /* Figure number within this chapter or appendix */
326 /* Options on a particular figure */
327 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
330 /* Place to hold <snb> entries until after a <virpage><head>, if any,
331 * is seen. Also, an integer value of the offset into the file to the
332 * point immediately after either <virpage> or <virpage><head> - the
333 * place to put the <snb>.
335 EXTERN char *savesnb INIT(NULL);
336 EXTERN int snbstart INIT(0);
338 /* Table number within this chapter or appendix */
341 /* footnote number */
342 EXTERN int footnoteno INIT(0);
344 EXTERN FILE *outfile ;
346 /* True if a figure or table has a caption */
347 EXTERN LOGICAL figcaption ;
348 EXTERN LOGICAL tabcaption ;
349 EXTERN char *capposition; /* left/center/right position of the caption */
351 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
353 /* contains current m_textchar, used to see if we need to issue an italic
354 correction. Issue italic correction everywhere except after commas
356 EXTERN M_WCHAR cur_char INIT(' ') ;
358 /* Special characters */
363 /* Error Message section */
364 EXTERN LOGICAL emsghead INIT(FALSE) ;
365 /* emsghead has three possible values:
366 DEFHEAD : use default error message title
367 USERHEAD : user specified
368 FALSE : do not process head (assume define is not equal to
374 /* declarations for the <form> stack */
375 typedef struct forminfo FORMINFO;
380 EXTERN FORMINFO *formStackBase INIT(NULL);
381 EXTERN FORMINFO *formStackTop INIT(NULL);
382 EXTERN FORMINFO *formStackMax INIT(NULL);
384 /* flag that we have output an SDL <block> for <partext> */
385 EXTERN LOGICAL inBlock INIT(FALSE);
387 /* flag that we need to output an <fdata> for a <form> */
388 EXTERN LOGICAL needFData INIT(FALSE);
391 #define FIGDEFWH "3in"
392 #define MAXNORMROWS 55
393 #define MAXSMALROWS 75
394 #define MAXTINYROWS 100
395 #define MAXPENS 8 /* when changing, check prfigpenwidths() ! */
396 #define MAXPENWIDTH 1864680 /* approx 1cm in scaled points */
398 EXTERN LOGICAL fignote ;
399 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
400 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
401 EXTERN LOGICAL file_ent ;
402 EXTERN M_WCHAR *f_content ;
403 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
404 EXTERN M_WCHAR *f_file ;
406 /* callouts -- entfile and lineno */
407 EXTERN M_WCHAR *figinpath ;
408 EXTERN int figline INIT(0) ;
411 #define BYTE unsigned char
417 typedef struct tagFPOINT {
421 typedef struct tagPwT {
432 #define AN_hasbros 32
443 #define UNPK(c,an,sh) ((c&an)>>sh)
445 EXTERN FILE *calfile ;
447 EXTERN LOGICAL okcallout ;
448 /* -- end callout -- */
450 EXTERN FILE *pclfile ;
452 #define VERSION "Version"
453 EXTERN char *version INIT(NULL) ;
455 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
457 /* Code for standard library function "access" */
460 /* Allowable units on dimensions */
461 #define SPperPT 65536.0
462 #define PTperIN 72.27
466 EXTERN char *dimarray[5]
477 EXTERN int newhline INIT(0) ;
478 EXTERN int synelcnt INIT(0);
480 /* Cross-Reference Declarations */
481 /* do we have foreward references? */
482 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
483 EXTERN M_WCHAR *xrffile ; /* Save file and line number for error messages */
484 EXTERN int xrfline INIT(0) ; /* --used to store into structure "xref" */
485 EXTERN M_TRIE xtree ;
487 M_WCHAR *textptr ; /* Pointer to expansion of xref */
488 LOGICAL defined ; /* Whether the xref has been defined */
489 LOGICAL wheredef ; /* Whether defined in this pass or a previous one */
490 LOGICAL retrieved ; /* Whether the value has been used */
491 LOGICAL csensitive ; /* Whether the value is chapter sensitive */
492 LOGICAL xrefable; /* can this be xref'd to legally? */
493 char *chapstring ; /* Number of chapter or appendix where it occurs */
494 LOGICAL inchapter ; /* Whether in chapter or appendix */
495 M_WCHAR *file ; /* File and line # where first referred to or */
496 int line ; /* first defined for error reports */
498 /* Value of one particular cross-reference */
499 EXTERN M_WCHAR xrefstring[400] ;
500 EXTERN int xstrlen INIT(0) ;
501 /* Pointer to the id */
502 EXTERN M_WCHAR *savid ;
503 EXTERN LOGICAL iderr ;
504 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
506 /* Save head for page header in rsect and table of contents string*/
507 EXTERN M_WCHAR savehead[400] ;
508 EXTERN M_WCHAR savetabcap[400] ;
509 EXTERN int svheadlen ;
511 EXTERN LOGICAL savhd ;
512 EXTERN LOGICAL savtc ;
513 EXTERN LOGICAL hderr ;
514 EXTERN LOGICAL echo ;
515 EXTERN LOGICAL tooutput INIT(TRUE) ;
517 /* Save example until we see an annotation (which will behave like a head */
520 EXTERN char *saveexseg;
521 EXTERN int svexseglen;
522 EXTERN LOGICAL savex;
523 EXTERN LOGICAL stackex;
525 /* Glossary Declarations */
526 EXTERN M_TRIE gtree ;
528 EXTERN M_WCHAR term[MAXTERM + 1] ;
529 EXTERN M_WCHAR *termp ;
530 EXTERN LOGICAL wsterm ;
531 EXTERN int lastTermId;
533 EXTERN LOGICAL firstAnnot;
534 EXTERN int exLineNum;
535 EXTERN LOGICAL tonumexlines;
536 EXTERN int oldExLineNum;
538 /* Saved document title */
539 EXTERN M_WCHAR *savedtitle;
541 /* tell whether .hmi should have generic info put into it */
542 EXTERN LOGICAL hadtitle INIT(FALSE);
543 EXTERN LOGICAL hadabstract INIT(FALSE);
545 /* emit an empty abstract title if no head specified */
546 EXTERN LOGICAL needabstracthead INIT(FALSE);
548 /* Numeric codes corresponding to keyword parameter values */
559 /* Note that the definition of BOX was chosen so that the border
560 parameter on both figure and table could use it, even though these
561 parameters do not share all possible values */
576 /* IMPORTANT: "FIG..." values should not be */
577 /* changed (eg. see proc "checkmargin") */
587 /* text size macros */
641 #define NOAUTOSCALE 2
643 /* the values for these elements are significant...they are used to set
644 * TeX register values which are later tested by macros
649 /* the values for these elements are significant...they are used to set
650 * TeX register values which are later tested by macros
657 /* values for ctable tracking */
659 EXTERN int ctbldisplines;
660 EXTERN int ctblgraphics;
662 /* Declarations for lists */
664 /* FIRST => first paragraph in list item. The one following the label.
665 FOLLOW => immediately after a figure, note, caution, warning, ex or vex
666 INSIDE => at least one previous paragraph
668 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
669 EXTERN LOGICAL firstPInBlock; /* give the first para a different ssi= */
671 EXTERN LOGICAL lablisttight[MAXLISTLEV];
672 EXTERN int labhid[MAXLISTLEV];
673 EXTERN int labhtextid[MAXLISTLEV];
674 EXTERN int labelid[MAXLISTLEV];
675 EXTERN int labeltextid[MAXLISTLEV];
676 EXTERN int list INIT(0) ;
677 typedef struct contchain CONTCHAIN ;
682 typedef struct list LIST ;
688 unsigned char punct ;
689 unsigned char started ;
690 unsigned char where ;
696 = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
699 EXTERN LIST *lastlist INIT(&outlist) ;
700 EXTERN int bulcount INIT(0) ;
702 typedef struct rowvec ROWVEC;
704 unsigned char firstitem;
705 unsigned char longlabel;
707 EXTERN ROWVEC listitems[MAXLISTLEV+1];
709 /* save area for index processing */
710 EXTERN M_WCHAR idxsav[400] ;
711 /* Sort form of an index term */
712 EXTERN M_WCHAR sort[400] ;
713 /* Sort form of an index sub term */
714 EXTERN M_WCHAR subsort[400] ;
715 /* print form of index term */
716 EXTERN M_WCHAR print[400] ;
717 /* print form of index sub term */
718 EXTERN M_WCHAR subprint[400] ;
719 EXTERN int idxsavlen ;
720 EXTERN LOGICAL didsort ;
721 EXTERN LOGICAL didsubsort ;
723 /* Strings for constructing error messages */
724 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
725 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
726 EXTERN char infile[] INIT("file %s, ") ;
727 EXTERN char online[] INIT("line %d)\n") ;
728 EXTERN char offile[] INIT(" of file: %s") ;
729 /* Whitemenu supported only in calculator, issue message only once */
730 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
732 /* For index entries */
735 #define IDXSTRT IDXSTRT1 IDXSTRT2
740 #define IDXEND IDXEND1 IDXEND2 IDXEND3
742 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
743 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
745 /* Direct debugging trace output to stdout or outfile */
746 EXTERN LOGICAL tracetostd INIT(FALSE) ;
748 /* Function prototypes */
751 /* Declarations for handling special characters */
754 /* Declarations for handling special characters for calculators*/
755 EXTERN char ccoutbuf[128] ;
757 /* Character conversion tables */
758 #include "charconv.h"