b4dead17f2fbffc4eff418690972afe1fadc6ebd
[oweals/cde.git] / cde / programs / dthelp / parser / canon1 / helptag / global.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
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)
10  * any later version.
11  *
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
16  * details.
17  *
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
22  */
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 */
27
28 #if defined(DEFINE)
29 #define EXTERN
30 #define INIT(a) = a
31 #else
32 #define EXTERN extern
33 #define INIT(a)
34 #endif
35
36 #include <stdlib.h>
37 #include <string.h>
38 #include <time.h>
39 #if defined(MSDOS)
40 #include <io.h>
41 #include <process.h>
42 #include <direct.h>
43 #endif
44 #include <ctype.h>
45
46 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
47 #include <unistd.h>
48 #include <locale.h>
49 #include <fcntl.h>
50 #endif
51
52 #define MAXHEADLINES 3
53 #define FNAMELEN 513
54 #define BIGBUF 1024
55
56
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)
62
63
64 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
65 #define DRAFT         1
66 #define FINAL         2
67 #define MEMO          3
68 #define NOMEMO        4
69 #define SEARCHKEY     5
70 #define CLEARSEARCH   6
71 #define LONGFILES     7
72 #define LONGFILE      8
73 #define LONG          9
74 #define SHORTFILES   10
75 #define SHORTFILE    11
76 #define SHORT        12
77 #define CHARSET      13
78 #define ONERROR      14
79
80 #if defined(FUTURE_FEATURE)
81 #define GRAPHICS     15
82 #define NOGRAPHICS   16
83 #define REV          17
84 #define NOREV        18
85 #endif /* FUTURE_FEATURE */
86
87 #define NUMOPTIONS 14
88
89 EXTERN int optval INIT(M_NULLVAL) ;
90
91 EXTERN char *optkey[NUMOPTIONS]
92 #if defined(DEFINE)
93   = {
94       "draft",
95       "final",
96       "memo",
97       "nomemo",
98       "search",
99       "clearsearch",
100       "longfiles",
101       "longfile",
102       "long",
103       "shortfiles",
104       "shortfile",
105       "short",
106       "charset",
107       "onerror",
108
109 #if defined(FUTURE_FEATURE)
110       "graphics",
111       "nographics",
112       "rev",
113       "norev",
114 #endif /* FUTURE_FEATURE */
115       }
116 #endif
117   ;
118
119 /* Processing options */
120 EXTERN LOGICAL final INIT(FALSE) ;
121 EXTERN LOGICAL memo INIT(FALSE) ;
122 EXTERN int rebuild INIT(FALSE) ;
123
124 EXTERN LOGICAL stoponerror INIT(TRUE) ;
125
126 #if defined(FUTURE_FEATURE)
127 EXTERN LOGICAL prntrevs INIT(FALSE) ;
128 #endif /* FUTURE_FEATURE */
129
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 */
140
141 /* TeX counter for chapter number */
142 #define FRONTCOUNT 0
143 #define APPCOUNT 1000
144 #define TOCCOUNT 2000
145 #define MSGCOUNT 3000
146 #define BIBCOUNT 4000
147 #define GLOSSCOUNT 5000
148 #define INDEXCOUNT 6000
149
150 /* Flag for filelist vs. Tag to SDL translator */
151 EXTERN LOGICAL filelist INIT(FALSE) ;
152
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");
159
160 /* Working directory, input directory, installation directory,
161    and search paths */
162 EXTERN LOGICAL defaultext ;
163 EXTERN M_WCHAR *inputname;    /* pointer to name of main input file */
164 EXTERN char *base ;
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 ;
171 struct search {
172   char *directory ;
173   SEARCH *next ;
174   } ;
175 EXTERN SEARCH *path INIT(NULL) ;
176 EXTERN SEARCH **endpath INIT(&path) ;
177 EXTERN char dirsep
178 #if defined(MSDOS)
179 INIT('\\')
180 #else
181 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
182 INIT('/')
183 #else
184 ****define directory separator here****
185 #endif
186 #endif
187   ;
188
189 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__osf__) || defined(linux) || defined(CSRG_BASED)
190 #define CSEP '/'
191 #define SSEP "/"
192 #else
193 #if defined(MSDOS)
194 #define CSEP '\\'
195 #define SSEP "\\"
196 #else
197 ****define directory separator here****
198 #endif
199 #endif
200
201 /* Location in .TEX file of two \wlog messages */
202 EXTERN long wlog ;
203
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 */
207
208 /* True within a sequence of rsect's */
209 EXTERN LOGICAL rsectseq INIT(FALSE) ;
210
211 /* True if this manual has a glossary */
212 EXTERN LOGICAL glossary INIT(FALSE) ;
213
214 /* True while processing a note if a head was encountered */
215 EXTERN LOGICAL notehead ;
216
217 /* File address for "Generated TeX file complete" message */
218 EXTERN long texcomplete ;
219
220 /* File pointer for cross-reference file */
221 EXTERN FILE *xrf ;
222
223 /* global link type pointer, used in xref to match latest link type */
224 EXTERN int global_linktype INIT (0);
225
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;
233
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.
237 */
238 typedef struct _block  BLOCK;
239 typedef BLOCK         *PBLOCK;
240 struct _block {
241     char   *pclass;
242     char   *pssi;
243     PBLOCK  pprev;
244 } block, *pblock;
245 PBLOCK blockinfo INIT(NULL);
246
247 LOGICAL inParText INIT(FALSE);
248 LOGICAL inSdlP    INIT(FALSE);
249
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.
254 */
255 int bulletId[2], looseBulletId[2], firstBulletId, firstLooseBulletId;
256 int bulletIdIndex INIT(1);
257 int looseBulletIdIndex INIT(1);
258
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 
265  * in the "ex" <p>
266 */
267 EXTERN int exTextSize;
268
269 #define ORDEREDLISTFIRSTINDENT 1
270 #define ORDEREDLISTITEMINDENT  3
271 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
272
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) ;
278
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") ;
284
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");
304
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
312
313 EXTERN FILE *snbfp;
314 EXTERN FILE *indexfp;
315
316 /* Whether have processed anything in chapter or appendix */
317 EXTERN LOGICAL chapst INIT(FALSE) ; 
318
319 /* TRUE for chapter, FALSE for appendix */
320 EXTERN LOGICAL inchapter INIT(TRUE) ;
321
322 /* Figure number within this chapter or appendix */
323 EXTERN int figno ;
324
325 /* Options on a particular figure */
326 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
327            fmaxlistrows ;
328
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>.
333 */
334 EXTERN char *savesnb  INIT(NULL);
335 EXTERN int   snbstart INIT(0);
336
337 /* Table number within this chapter or appendix */
338 EXTERN int tableno ;
339
340 /* footnote number */
341 EXTERN int footnoteno INIT(0);
342
343 EXTERN FILE *outfile ;
344
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 */
349
350 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
351
352 /* contains current m_textchar, used to see if we need to issue an italic
353    correction.  Issue italic correction everywhere except after commas
354    and periods.  */
355 EXTERN M_WCHAR cur_char INIT(' ') ;
356
357 /* Special characters */
358 #define O_BR  '{'
359 #define C_BR  '}'
360 #define ESCAPE 27
361
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
368                                DEFHEAD or USERHEAD)
369 */
370 #define DEFHEAD  2
371 #define USERHEAD 3
372
373 /* declarations for the <form> stack */
374 typedef struct forminfo FORMINFO;
375 struct forminfo {
376   char *rowVec;
377   int   vecLen;
378   };
379 EXTERN FORMINFO *formStackBase INIT(NULL);
380 EXTERN FORMINFO *formStackTop  INIT(NULL);
381 EXTERN FORMINFO *formStackMax  INIT(NULL);
382
383 /* flag that we have output an SDL <block> for <partext> */
384 EXTERN LOGICAL inBlock INIT(FALSE);
385
386 /* flag that we need to output an <fdata> for a <form> */
387 EXTERN LOGICAL needFData INIT(FALSE);
388
389 /* Figure stuff */
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 */
396
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 ;
404
405 /* callouts -- entfile and lineno */
406 EXTERN M_WCHAR *figinpath ;
407 EXTERN int figline INIT(0) ;
408
409 /* -- callouts -- */
410 #define BYTE       unsigned char
411 #define NEWPT      0
412 #define NEWGROUP   1
413 #define NEWLINE    2
414 #define NEWCALLOUT 3
415
416 typedef struct tagFPOINT {
417 float   x,y;
418 } FPOINT ;
419
420 typedef struct tagPwT {
421 FPOINT  coord;
422 char    ew[2],
423         ns[2],
424         lcr[2];
425 } PTWTXT ;
426
427 #define AN_desc         3
428 #define AN_nsew         60
429 #define AN_text         12
430 #define AN_isbros               16
431 #define AN_hasbros      32
432 #define AN_sf1                  64
433 #define AN_sf2                  128
434 #define SH_desc         0
435 #define SH_nsew         2
436 #define SH_text         2
437 #define SH_isbros               4
438 #define SH_hasbros      5
439 #define SH_sf1                  6
440 #define SH_sf2                  7
441
442 #define UNPK(c,an,sh)   ((c&an)>>sh)
443
444 EXTERN FILE *calfile ;
445 EXTERN int maxct;
446 EXTERN LOGICAL okcallout ;
447 /* -- end callout -- */
448
449 EXTERN FILE *pclfile ;
450
451 #define VERSION "Version"
452 EXTERN char *version INIT(NULL) ;
453
454 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
455
456 /* Code for standard library function "access" */
457 #define READABLE 04
458
459 /* Allowable units on dimensions */
460 #define SPperPT 65536.0
461 #define PTperIN 72.27
462 #define CMperIN 2.54
463 #define MMperIN 25.4
464 #define PTperPC 12.0
465 EXTERN char *dimarray[5] 
466 #if defined(DEFINE)
467  = {  "in",
468       "cm",
469       "mm",
470       "pc",
471       "pt" }
472 #endif
473  ;
474
475 /* misc */
476 EXTERN int newhline INIT(0) ;
477 EXTERN int synelcnt INIT(0);
478
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 ;
485 struct xref {
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   */
496     } ;
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" */
504
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 ;
509 EXTERN int     svtclen ;
510 EXTERN LOGICAL savhd ;
511 EXTERN LOGICAL savtc ;
512 EXTERN LOGICAL hderr ;
513 EXTERN LOGICAL echo ;
514 EXTERN LOGICAL tooutput INIT(TRUE) ;
515
516 /* Save example until we see an annotation (which will behave like a head */
517 EXTERN char    *saveex;
518 EXTERN int      svexlen;
519 EXTERN char    *saveexseg;
520 EXTERN int      svexseglen;
521 EXTERN LOGICAL  savex;
522 EXTERN LOGICAL  stackex;
523
524 /* Glossary Declarations */
525 EXTERN M_TRIE gtree ;
526 #define MAXTERM 200
527 EXTERN M_WCHAR term[MAXTERM + 1] ;
528 EXTERN M_WCHAR *termp ;
529 EXTERN LOGICAL wsterm ;
530 EXTERN int     lastTermId;
531
532 EXTERN LOGICAL  firstAnnot;
533 EXTERN int      exLineNum;
534 EXTERN LOGICAL  tonumexlines;
535 EXTERN int      oldExLineNum;
536
537 /* Saved document title */
538 EXTERN M_WCHAR *savedtitle;
539
540 /* tell whether .hmi should have generic info put into it */
541 EXTERN LOGICAL hadtitle INIT(FALSE);
542 EXTERN LOGICAL hadabstract INIT(FALSE);
543
544 /* emit an empty abstract title if no head specified */
545 EXTERN LOGICAL needabstracthead INIT(FALSE);
546      
547 /* Numeric codes corresponding to keyword parameter values */
548
549 #define FIXED 1
550 #define FLOAT 2
551
552 #define SIDE 1
553 #define STACK 2
554
555 #define COMPUTER 1
556 #define DISPLAY  2
557
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 */
561 #define BOX 1
562 #define TOP 2
563 #define BOTTOM 3
564 #define NOBORDER 4
565 #define SCREEN 5
566 #define NOBOX 2
567
568 #define ART 1
569 #define PCL 2
570 #define TIFF 3
571 #define LISTING 4
572 #define TEXT 5
573 #define HPGL 7
574
575 /* IMPORTANT: "FIG..." values should not be          */
576 /*             changed (eg. see proc "checkmargin")  */
577 #define FIGTOP    0
578 #define FIGRIGHT  1
579 #define FIGBOTTOM 2
580 #define FIGLEFT   3
581 #define NFIGSIDES 4
582
583 #define WRAP 1
584 #define NOWRAP 2
585
586 /* text size macros */
587 #define NORMAL 1
588 #define SMALLER 2
589 #define SMALLEST 3
590
591 #define NUMBER 1
592 #define NONUMBER 2
593
594 #define LEFT 1
595 #define INDENT 2
596 #define CENTER 3
597 #define RIGHT 4
598
599 #define TIGHT 1
600 #define LOOSE 2
601
602 #define NORULE 1
603 #define HEADRULE 2
604 #define GRID 3
605
606 #define ORDER 0
607 #define BULLET 1
608 #define PLAIN 2
609 #define MILSPEC 3
610 #define LABEL 4
611 #define CHECK 5
612
613 #define UROMAN 0
614 #define UALPHA 1
615 #define ARABIC 2
616 #define LALPHA 3
617 #define LROMAN 4
618
619 #define DOTPUNCT 0
620 #define PARENPUNCT 1
621
622 #define NEWPAGE 0
623 #define SAMEPAGE 1
624
625 #define GLOSS 1
626 #define NOGLOSS 2
627
628 #define INVERSE 1
629 #define NOINVERSE 2
630
631 #define STRIP 1
632 #define NOSTRIP 2
633
634 #define DPENWDVAL 1
635
636 #define SNAP 1
637 #define NOSNAP 2
638
639 #define AUTOSCALE 1
640 #define NOAUTOSCALE 2
641
642 /* the values for these elements are significant...they are used to set
643  * TeX register values which are later tested by  macros
644  */
645 #define COMMAND 1
646 #define KEYS2 2
647
648 /* the values for these elements are significant...they are used to set
649  * TeX register values which are later tested by  macros
650  */
651 #define TWO 2
652 #define FOUR 4
653 #define EIGHT 8
654 #define OTHER 0
655
656 /* values for ctable tracking */
657 EXTERN int ctbltype;
658 EXTERN int ctbldisplines;
659 EXTERN int ctblgraphics;
660
661 /* Declarations for lists */
662 #define MAXLISTLEV 8
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
666 */
667 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
668 EXTERN LOGICAL firstPInBlock; /* give the first para a different ssi= */
669
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 ;
677 struct contchain {
678   long where ;
679   CONTCHAIN *next ;
680   } ;
681 typedef struct list LIST ;
682 struct list {
683   int type ;
684   int order ;
685   int count ;
686   int space ;
687   unsigned char punct ;
688   unsigned char started ;
689   unsigned char where ; 
690   LIST *lastlist ;
691   CONTCHAIN *chain ; 
692   } ;
693 EXTERN LIST outlist 
694 #if defined(DEFINE)
695   = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
696 #endif
697   ;
698 EXTERN LIST *lastlist INIT(&outlist) ;
699 EXTERN int bulcount INIT(0) ;
700
701 typedef struct rowvec ROWVEC;
702 struct rowvec {
703   unsigned char firstitem;
704   unsigned char longlabel;
705   };
706 EXTERN ROWVEC listitems[MAXLISTLEV+1];
707
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 ;
721
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) ;
730
731 /* For index entries */
732 #define IDXSTRT1 {}
733 #define IDXSTRT2 {}
734 #define IDXSTRT IDXSTRT1 IDXSTRT2
735
736 #define IDXEND1 {}
737 #define IDXEND2 {}
738 #define IDXEND3 {}
739 #define IDXEND IDXEND1 IDXEND2 IDXEND3
740
741 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
742 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
743
744 /* Direct debugging trace output to stdout or outfile */
745 EXTERN LOGICAL tracetostd INIT(FALSE) ;
746
747 /* Function prototypes */
748 #include "fproto.h"
749
750 /* Declarations for handling special characters */
751 #include "roman8.h"
752
753 /* Declarations for handling special characters for calculators*/
754 EXTERN char ccoutbuf[128] ;
755
756 /* Character conversion tables */
757 #include "charconv.h"