Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / programs / dthelp / parser.ccdf / htag / 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 librararies 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: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 */
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 <malloc.h>
37 #include <string.h>
38 #if defined(MSDOS)
39 #include <io.h>
40 #include <stdlib.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(__uxp__) || defined(linux)
47 #include <unistd.h>
48 #include <locale.h>
49 #endif
50
51 #define MAXHEADLINES 3
52 #define FNAMELEN 513
53 #define BIGBUF 1024
54
55
56 /* substitute for m_ctupper; we don't cast x into (int), thereby
57    avoiding any problems of high order bit.  This is in response
58    to "Entity no allowed in ART" messages by cupertino.  However,
59    this more of a loose deduction, and really needs confirmation.  */
60 #define ctupper(x) (m_ctarray[x].upper)
61
62
63 /* Must be in same order as values in optkey, adjust NUMOPTIONS if changed*/
64 #define DRAFT         1
65 #define FINAL         2
66 #define MEMO          3
67 #define NOMEMO        4
68 #define SEARCHKEY     5
69 #define CLEARSEARCH   6
70 #define LONGFILES     7
71 #define LONGFILE      8
72 #define LONG          9
73 #define SHORTFILES   10
74 #define SHORTFILE    11
75 #define SHORT        12
76 #define CHARSET      13
77 #define ONERROR      14
78
79 #if defined(FUTURE_FEATURE)
80 #define GRAPHICS     15
81 #define NOGRAPHICS   16
82 #define REV          17
83 #define NOREV        18
84 #endif /* FUTURE_FEATURE */
85
86 #define NUMOPTIONS 14
87
88 EXTERN int optval INIT(M_NULLVAL) ;
89
90 EXTERN char *optkey[NUMOPTIONS]
91 #if defined(DEFINE)
92   = {
93       "draft",
94       "final",
95       "memo",
96       "nomemo",
97       "search",
98       "clearsearch",
99       "longfiles",
100       "longfile",
101       "long",
102       "shortfiles",
103       "shortfile",
104       "short",
105       "charset",
106       "onerror",
107
108 #if defined(FUTURE_FEATURE)
109       "graphics",
110       "nographics",
111       "rev",
112       "norev",
113 #endif /* FUTURE_FEATURE */
114       }
115 #endif
116   ;
117
118 /* Processing options */
119 EXTERN LOGICAL final INIT(FALSE) ;
120 EXTERN LOGICAL memo INIT(FALSE) ;
121 EXTERN int rebuild INIT(FALSE) ;
122
123 EXTERN LOGICAL stoponerror INIT(TRUE) ;
124
125 #if defined(FUTURE_FEATURE)
126 EXTERN LOGICAL prntrevs INIT(FALSE) ;
127 #endif /* FUTURE_FEATURE */
128
129 /* variables for index sorting and tagging in the scripts */
130        /* we create a child directory for processing the index, so as not
131           to clobber any files with the same base name.  However, this will
132           affect search paths that are relative; those that are relative
133           need to have parent level prepended.  This is done only when
134           "parentsrch" is set to TRUE; done only when we process indexes.  */
135 EXTERN LOGICAL parentsrch INIT(FALSE) ;
136 EXTERN char *idxfile INIT(NULL) ; /* index file name only */
137 EXTERN char *idxpath INIT(NULL) ; /* index file name w/path */
138 EXTERN char *idxbase INIT(NULL) ; /* index base name only */
139
140 /* TeX counter for chapter number */
141 #define FRONTCOUNT 0
142 #define APPCOUNT 1000
143 #define TOCCOUNT 2000
144 #define MSGCOUNT 3000
145 #define BIBCOUNT 4000
146 #define GLOSSCOUNT 5000
147 #define INDEXCOUNT 6000
148
149 /* flag for TeX output while in HelpTag parser */
150 EXTERN LOGICAL texoutput INIT(FALSE);
151
152 /* Flag for filelist vs. Tag to TeX translator */
153 EXTERN LOGICAL filelist INIT(FALSE) ;
154
155 /* NOTE: If driver is redimensioned, a change is needed in texinit() */
156 EXTERN char driver[20]
157 #if defined(MSDOS)
158   INIT("CDS") 
159 #else
160 #if defined(hpux)
161   INIT("HPUX")
162 #endif
163 #if defined(_AIX)
164   INIT("AIX")
165 #endif
166 #if defined(linux)
167   INIT("LINUX")
168 #endif
169 #if defined(sun)
170   INIT("SUN")
171 #endif
172 #if defined(USL)
173   INIT("USL")
174 #endif
175 #if defined(__uxp__)
176   INIT("UXP")
177 #endif
178 #endif
179   ;
180
181 EXTERN M_WCHAR *helpcharset INIT(NULL);
182
183 /* Working directory, input directory, installation directory,
184    and search paths */
185 EXTERN LOGICAL defaultext ;
186 EXTERN M_WCHAR *inputname;    /* pointer to name of main input file */
187 EXTERN char *base ;
188 EXTERN char *baseext ;
189 EXTERN char *nodirbase ;
190 EXTERN char *work INIT("") ;
191 EXTERN char *indir INIT(NULL) ;
192 EXTERN char *install INIT(NULL) ;
193 typedef struct search SEARCH ;
194 struct search {
195   char *directory ;
196   SEARCH *next ;
197   } ;
198 EXTERN SEARCH *path INIT(NULL) ;
199 EXTERN SEARCH **endpath INIT(&path) ;
200 EXTERN char dirsep
201 #if defined(MSDOS)
202 INIT('\\')
203 #else
204 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
205 INIT('/')
206 #else
207 ****define directory separator here****
208 #endif
209 #endif
210   ;
211
212 #if defined(hpux) || defined(_AIX) || defined(sun) || defined(USL) || defined(__uxp__)
213 #define CSEP '/'
214 #define SSEP "/"
215 #else
216 #if defined(MSDOS)
217 #define CSEP '\\'
218 #define SSEP "\\"
219 #else
220 ****define directory separator here****
221 #endif
222 #endif
223
224 /* Location in .TEX file of two \wlog messages */
225 EXTERN long wlog ;
226
227 /* True if have encountered idx or idxsyn */
228 EXTERN LOGICAL have_index INIT(FALSE) ; 
229 EXTERN long idxupdate INIT(0L) ; /* file/seek pointer for make facility */
230
231 /* True within a sequence of rsect's */
232 EXTERN LOGICAL rsectseq INIT(FALSE) ;
233
234 /* True if SAMEPAGE for this rsect sequence */
235 EXTERN LOGICAL rsectsame ;
236
237 /* True if have encountered <NEWPAGE> in a SAMEPAGE <RSECT>*/
238 EXTERN LOGICAL rsectholdnew ;
239
240 /* True in an rsect that has an abbreviated head */
241 EXTERN LOGICAL didabbrev ;
242
243 /* True if this manual has a glossary */
244 EXTERN LOGICAL glossary INIT(FALSE) ;
245
246 /* True while processing a note if a head was encountered */
247 EXTERN LOGICAL notehead ;
248
249 /* String emitted at start of note, caution or warning */
250 EXTERN char ncwStart[] INIT("<PARAGRAPH %s after 0 left 5 first 5 right 0>\n\
251 <TYPE serif><WEIGHT bold>");
252
253 /* String emitted at end of note, caution or warning */
254 EXTERN char ncwEnd[] INIT("%s</WEIGHT></TYPE></PARAGRAPH>\n\
255 <PARAGRAPH before 0 after 0 left 5 right 0>\n");
256
257 /* String emitted if a graphic is present for note, caution or warning */
258 EXTERN char ncwGraphic[] INIT("<LABEL><GRAPHIC file %s></LABEL>\n");
259
260 /* String emitted to position note, caution or warning in a tight list */
261 EXTERN char *ncwTightList INIT("");
262
263 /* File address for "Generated TeX file complete" message */
264 EXTERN long texcomplete ;
265
266 /* File pointer for cross-reference file */
267 EXTERN FILE *xrf ;
268
269 /* global link type pointer, used in xref to match latest link type */
270 EXTERN int global_linktype INIT (0);
271
272 /* pointers to image parameters for use in imagetext */
273 EXTERN M_WCHAR *indentp;
274 EXTERN M_WCHAR *imagegentityp;
275 EXTERN M_WCHAR *imagegpositionp;
276 EXTERN M_WCHAR *imageghyperlinkp;
277 EXTERN M_WCHAR *imageglinktypep;
278 EXTERN M_WCHAR *imagegdescription;
279
280 /* indent for p, image, ex, vex, based on plain list */
281 #define LISTFIRSTINDENT 2
282 #define LISTITEMINDENT  2
283 #define LEFTINDENT (LISTFIRSTINDENT + LISTITEMINDENT)
284
285 #define ORDEREDLISTFIRSTINDENT 1
286 #define ORDEREDLISTITEMINDENT  3
287 #define ORDEREDLEFTINDENT (ORDEREDLISTFIRSTINDENT + ORDEREDLISTITEMINDENT)
288
289 /* File offset after preamble, and before \bye.  Used to determine 
290    whether content found in the document */
291 EXTERN long postpreamble INIT(0L) ;
292 EXTERN long prebye INIT(0L) ;
293 EXTERN LOGICAL filefound INIT(FALSE) ;
294
295 /* Chapter or appendix number */
296 EXTERN int part INIT(0) ;
297 EXTERN int chapter INIT(0) ;
298 EXTERN int chapinc INIT(0) ;
299 EXTERN char chapstring[15] INIT("0") ;
300
301 #define NODEID_LENGTH 204
302 /* name of current node */
303 EXTERN M_WCHAR nodeid[NODEID_LENGTH+1];  
304 /* Node number for autogenerated node id */
305 EXTERN int autonodenumber INIT(1);
306 EXTERN char nodestring[15] INIT("0");
307 /* Node level variables */
308 EXTERN int lastnodelevel INIT(0);
309 EXTERN int thisnodelevel INIT(0);
310 /* Offset of node from beginning of file */
311 EXTERN long int nodeoffset INIT(0);
312 EXTERN M_WCHAR *savehelpfilename INIT(NULL);
313 /* is this the first node of a .ht file? */
314 EXTERN LOGICAL firstnode INIT(TRUE);
315 /* flag for omitting first newline in topic map file */
316 EXTERN LOGICAL isfirsttopicmap INIT(TRUE);
317 EXTERN LOGICAL nohometopic INIT(TRUE);
318 EXTERN long     topicoffset INIT(0L);
319 EXTERN int      htfileno INIT(1);
320 /* The first tag in the front section should trigger the node */
321 EXTERN LOGICAL have_a_frontnode INIT(FALSE);
322 EXTERN char *helpbase INIT(NULL);
323 EXTERN char *helpext;
324 /* small buffer for scratch work */
325 EXTERN char helptmpbuf[2] INIT("0");
326
327 /* Should we use these BASENAME_LIMIT on the size of file names? */
328 LOGICAL usingshortnames INIT(FALSE);
329 /* Limit on how long the basename can be for a .ht file */
330 #define BASENAME_LIMIT 6
331 /* limit on how many additional character are allowed before the ext */
332 /* (How many chapter numbers    foo``12''.ht */
333 #define PRE_EXTENSION_LIMIT 2
334
335 EXTERN FILE *indexfp;
336 EXTERN FILE *docregfp;
337 EXTERN FILE *idtablefp;
338 EXTERN FILE *topicmapfp;
339
340 /* Whether have processed anything in chapter or appendix */
341 EXTERN LOGICAL chapst INIT(FALSE) ; 
342
343 /* Whether have just started a fourth-level section */
344 EXTERN LOGICAL st4 INIT(FALSE) ;
345
346 /* TRUE for chapter, FALSE for appendix */
347 EXTERN LOGICAL inchapter INIT(TRUE) ;
348
349 /* Figure number within this chapter or appendix */
350 EXTERN int figno ;
351
352 /* Options on a particular figure */
353 EXTERN int ftype, fborder, ftonumber, fvideo, fstrip, fsnap, fautoscale,
354            fmaxlistrows ;
355
356 /* Table number within this chapter or appendix */
357 EXTERN int tableno ;
358
359 /* footnote number */
360 EXTERN int footnoteno INIT(0);
361
362 /* True while processing abbrev head for page footer */
363 EXTERN LOGICAL fabbrev INIT(FALSE) ;
364 EXTERN LOGICAL abbrev INIT(FALSE) ;
365
366 EXTERN FILE *outfile ;
367 /* re-directing output to nothing, eg. used for unimplemented tags */
368 EXTERN FILE *nullfile ;
369 /* save the old outfile when redirecting data to nullfile */
370 EXTERN FILE *CDROMsaveoutfile ;
371 /* save the old outfile when redirecting header/footer data to nullfile */
372 EXTERN FILE *HFsaveoutfile;
373
374 /* True if a figure or table has a caption */
375 EXTERN LOGICAL figcaption ;
376 EXTERN LOGICAL tabcaption ;
377
378 EXTERN LOGICAL had_an_otherfront_head INIT(FALSE);
379
380 /* For softkeys */
381 EXTERN int sklines, skchars ;
382
383 /* contains current m_textchar, used to see if we need to issue an italic
384    correction.  Issue italic correction everywhere except after commas
385    and periods.  */
386 EXTERN M_WCHAR cur_char INIT(' ') ;
387
388 /* Special characters */
389 #define O_BR  '{'
390 #define C_BR  '}'
391 #define ESCAPE 27
392
393 /* Error _DtMessage section */
394 EXTERN LOGICAL emsghead INIT(FALSE) ;
395 /* emsghead has three possible values:
396      DEFHEAD : use default error message title
397                  USERHEAD : user specified
398                  FALSE : do not process head (assume define is not equal to
399                                DEFHEAD or USERHEAD)
400 */
401 #define DEFHEAD  2
402 #define USERHEAD 3
403
404 /* Figure stuff */
405 #define FIGDEFWH "3in"
406 #define MAXNORMROWS 55
407 #define MAXSMALROWS 75
408 #define MAXTINYROWS 100
409 #define MAXPENS 8  /* when changing, check prfigpenwidths() ! */
410 #define MAXPENWIDTH 1864680    /* approx 1cm in scaled points */
411
412 EXTERN LOGICAL fignote ;
413 EXTERN int fignotePtr, in_graphic, nlines, blank_middle ;
414 EXTERN unsigned long ncolumns, max_columns, res_index, xx, ri ;
415 EXTERN LOGICAL file_ent ;
416 EXTERN M_WCHAR *f_content ;
417 EXTERN M_WCHAR f_contqual[FNAMELEN] ;
418 EXTERN M_WCHAR *f_file ;
419
420 /* callouts -- entfile and lineno */
421 EXTERN M_WCHAR *figinpath ;
422 EXTERN int figline INIT(0) ;
423
424 /* -- callouts -- */
425 #define BYTE       unsigned char
426 #define NEWPT      0
427 #define NEWGROUP   1
428 #define NEWLINE    2
429 #define NEWCALLOUT 3
430
431 typedef struct tagFPOINT {
432 float   x,y;
433 } FPOINT ;
434
435 typedef struct tagPwT {
436 FPOINT  coord;
437 char    ew[2],
438         ns[2],
439         lcr[2];
440 } PTWTXT ;
441
442 #define AN_desc         3
443 #define AN_nsew         60
444 #define AN_text         12
445 #define AN_isbros               16
446 #define AN_hasbros      32
447 #define AN_sf1                  64
448 #define AN_sf2                  128
449 #define SH_desc         0
450 #define SH_nsew         2
451 #define SH_text         2
452 #define SH_isbros               4
453 #define SH_hasbros      5
454 #define SH_sf1                  6
455 #define SH_sf2                  7
456
457 #define UNPK(c,an,sh)   ((c&an)>>sh)
458
459 EXTERN FILE *calfile ;
460 EXTERN int maxct;
461 EXTERN LOGICAL okcallout ;
462 /* -- end callout -- */
463
464 EXTERN FILE *pclfile ;
465
466 #define VERSION "Version"
467 EXTERN char *version INIT(NULL) ;
468
469 EXTERN char texdone[] INIT("TeX run completed successfully.") ;
470
471 /* Code for standard library function "access" */
472 #define READABLE 04
473
474 /* Allowable units on dimensions */
475 #define SPperPT 65536.0
476 #define PTperIN 72.27
477 #define CMperIN 2.54
478 #define MMperIN 25.4
479 #define PTperPC 12.0
480 EXTERN char *dimarray[5] 
481 #if defined(DEFINE)
482  = {  "in",
483       "cm",
484       "mm",
485       "pc",
486       "pt" }
487 #endif
488  ;
489
490 /* misc */
491 EXTERN LOGICAL unleaded INIT(FALSE) ;
492 EXTERN int newhline INIT(0) ;
493 EXTERN int synelcnt INIT(0);
494
495 /* Cross-Reference Declarations */
496 /* do we have foreward references? */
497 EXTERN LOGICAL have_forward_xrefs INIT(FALSE);
498 EXTERN M_WCHAR *xrffile ;    /* Save file and line number for error messages */
499 EXTERN int xrfline INIT(0) ;  /* --used to store into structure "xref"   */
500 EXTERN M_TRIE xtree ;
501 struct xref {
502     M_WCHAR *textptr ;       /* Pointer to expansion of xref */
503     LOGICAL defined ;     /* Whether the xref has been defined */
504     LOGICAL wheredef ;    /* Whether defined in this pass or a previous one */
505     LOGICAL retrieved ;   /* Whether the value has been used */
506     LOGICAL csensitive ;  /* Whether the value is chapter sensitive */
507     LOGICAL xrefable;     /* can this be xref'd to legally? */
508     char *chapstring ;    /* Number of chapter or appendix where it occurs */
509     LOGICAL inchapter ;   /* Whether in chapter or appendix */
510     M_WCHAR *file ;      /* File and line # where first referred to or  */
511     int line ;            /*   first defined for error reports   */
512     } ;
513   /* Value of one particular cross-reference */
514 EXTERN M_WCHAR xrefstring[400] ;
515 EXTERN int xstrlen INIT(0) ;
516   /* Pointer to the id */
517 EXTERN M_WCHAR *savid ;
518 EXTERN LOGICAL  iderr ;
519 EXTERN char *imageId INIT(NULL); /* "image" id saved for "imagetext" */
520
521 /* Save head for page header in rsect and table of contents string*/
522 EXTERN M_WCHAR savehead[400] ;
523 EXTERN M_WCHAR savetabcap[400] ;
524 EXTERN int svheadlen ;
525 EXTERN int svtclen ;
526 EXTERN LOGICAL savhd ;
527 EXTERN LOGICAL savtc ;
528 EXTERN LOGICAL hderr ;
529 EXTERN LOGICAL echo ;
530 EXTERN LOGICAL tooutput INIT(TRUE) ;
531
532 /* Glossary Declarations */
533 EXTERN M_TRIE gtree ;
534 #define MAXTERM 200
535 EXTERN M_WCHAR term[MAXTERM + 1] ;
536 EXTERN M_WCHAR *termp ;
537 EXTERN LOGICAL wsterm ;
538 #define ENTERTERM 1
539 #define DEFINETERM 2
540
541 EXTERN int exlineno ;
542 EXTERN LOGICAL tonumexlines ;
543
544 /* Saved document title */
545 EXTERN M_WCHAR *savedtitle;
546
547 /* tell whether .hmi should have generic info put into it */
548 EXTERN LOGICAL hadtitle INIT(FALSE);
549 EXTERN LOGICAL hadabstract INIT(FALSE);
550
551 /* emit an empty abstract title if no head specified */
552 EXTERN LOGICAL needabstracthead INIT(FALSE);
553      
554 /* Numeric codes corresponding to keyword parameter values */
555
556 #define FIXED 1
557 #define FLOAT 2
558
559 #define SIDE 1
560 #define STACK 2
561
562 #define COMPUTER 1
563 #define DISPLAY  2
564
565 /* Note that the definition of BOX was chosen so that the border
566 parameter on both figure and table could use it, even though these
567 parameters do not share all possible values */
568 #define BOX 1
569 #define TOP 2
570 #define BOTTOM 3
571 #define NOBORDER 4
572 #define SCREEN 5
573 #define NOBOX 2
574
575 #define ART 1
576 #define PCL 2
577 #define TIFF 3
578 #define LISTING 4
579 #define TEXT 5
580 #define HPGL 7
581
582 /* IMPORTANT: "FIG..." values should not be          */
583 /*             changed (eg. see proc "checkmargin")  */
584 #define FIGTOP    0
585 #define FIGRIGHT  1
586 #define FIGBOTTOM 2
587 #define FIGLEFT   3
588 #define NFIGSIDES 4
589
590 #define WRAP 1
591 #define NOWRAP 2
592
593 /* text size macros */
594 #define NORMAL 1
595 #define SMALLER 2
596 #define SMALLEST 3
597
598 #define NUMBER 1
599 #define NONUMBER 2
600
601 #define LEFT 1
602 #define INDENT 2
603 #define CENTER 3
604 #define RIGHT 4
605
606 #define TIGHT 1
607 #define LOOSE 2
608
609 #define NORULE 1
610 #define HEADRULE 2
611 #define GRID 3
612
613 #define ORDER 0
614 #define BULLET 1
615 #define PLAIN 2
616 #define MILSPEC 3
617 #define LABEL 4
618 #define CHECK 5
619
620 #define UROMAN 0
621 #define UALPHA 1
622 #define ARABIC 2
623 #define LALPHA 3
624 #define LROMAN 4
625
626 #define DOTPUNCT 0
627 #define PARENPUNCT 1
628
629 #define NEWPAGE 0
630 #define SAMEPAGE 1
631
632 #define GLOSS 1
633 #define NOGLOSS 2
634
635 #define INVERSE 1
636 #define NOINVERSE 2
637
638 #define STRIP 1
639 #define NOSTRIP 2
640
641 #define DPENWDVAL 1
642
643 #define SNAP 1
644 #define NOSNAP 2
645
646 #define AUTOSCALE 1
647 #define NOAUTOSCALE 2
648
649 /* the values for these elements are significant...they are used to set
650  * TeX register values which are later tested by  macros
651  */
652 #define COMMAND 1
653 #define KEYS2 2
654
655 /* the values for these elements are significant...they are used to set
656  * TeX register values which are later tested by  macros
657  */
658 #define TWO 2
659 #define FOUR 4
660 #define EIGHT 8
661 #define OTHER 0
662
663 /* values for ctable tracking */
664 EXTERN int ctbltype;
665 EXTERN int ctbldisplines;
666 EXTERN int ctblgraphics;
667
668 /* Declarations for lists */
669 #define MAXLISTLEV 8
670 /* FIRST  => first paragraph in list item.  The one following the label.
671    FOLLOW => immediately after a figure, note, caution, warning, ex or vex
672    INSIDE => at least one previous paragraph
673 */
674 enum ParagraphListLocation {FIRST, FOLLOW, INSIDE};
675
676 EXTERN LOGICAL lablistindented[MAXLISTLEV];
677 EXTERN int list INIT(0) ;
678 typedef struct contchain CONTCHAIN ;
679 struct contchain {
680   long where ;
681   CONTCHAIN *next ;
682   } ;
683 typedef struct list LIST ;
684 struct list {
685   int type ;
686   int order ;
687   int count ;
688   int space ;
689   unsigned char punct ;
690   unsigned char started ;
691   unsigned char where ; 
692   LIST *lastlist ;
693   CONTCHAIN *chain ; 
694   } ;
695 EXTERN LIST outlist 
696 #if defined(DEFINE)
697   = {0, 0, 0, 0, DOTPUNCT, FALSE, FIRST, NULL, NULL}
698 #endif
699   ;
700 EXTERN LIST *lastlist INIT(&outlist) ;
701 EXTERN int bulcount INIT(0) ;
702
703 /* Volume name for index */
704 EXTERN M_WCHAR volume[M_NAMELEN + 1] ;
705 /* save area for index processing */
706 EXTERN M_WCHAR idxsav[400] ;
707 /* Sort form of an index term */
708 EXTERN M_WCHAR sort[400] ;
709 /* Sort form of an index sub term */
710 EXTERN M_WCHAR subsort[400] ;
711 /* print form of index term */
712 EXTERN M_WCHAR print[400] ;
713 /* print form of index sub term */
714 EXTERN M_WCHAR subprint[400] ;
715 EXTERN int idxsavlen ;
716 EXTERN LOGICAL didsort ;
717 EXTERN LOGICAL didsubsort ;
718
719 /* Strings for constructing error messages */
720 EXTERN char firstused[] INIT("'%s' first used in line %d") ;
721 EXTERN char undef[] INIT("Undefined cross-reference %s (") ;
722 EXTERN char infile[] INIT("file %s, ") ;
723 EXTERN char online[] INIT("line %d)\n") ;
724 EXTERN char offile[] INIT(" of file: %s") ;
725 /* Whitemenu supported only in calculator, issue message only once */
726 EXTERN LOGICAL wmenu_err INIT(FALSE) ;
727
728 /* Repeated code at start of each text block */
729 #define STARTSTUFF {}
730
731 /* Pop the stack of font changes */
732 #define POPFONT 
733 /* For index entries */
734 #define IDXSTRT1 {}
735 #define IDXSTRT2 {}
736 #define IDXSTRT IDXSTRT1 IDXSTRT2
737
738 #define IDXEND1 {}
739 #define IDXEND2 {}
740 #define IDXEND3 {}
741 #define IDXEND IDXEND1 IDXEND2 IDXEND3
742
743 /* Absorb consecutive <CR>'s, because TeX gets confused by them */
744 EXTERN LOGICAL multi_cr_flag INIT(FALSE);
745
746 /* flag for leaders within <LIST PLAIN> only */
747 EXTERN LOGICAL leaderok INIT(FALSE) ;
748
749 /* Direct debugging trace output to stdout or outfile */
750 EXTERN LOGICAL tracetostd INIT(FALSE) ;
751
752 /* show memory available */
753 EXTERN LOGICAL showmem INIT(FALSE);
754
755 /* Function prototypes */
756 #include "fproto.h"
757
758 /* Declarations for handling special characters */
759 #include "roman8.h"
760
761 /* Declarations for handling special characters for calculators*/
762 EXTERN char ccoutbuf[128] ;
763
764 /* Character conversion tables */
765 #include "charconv.h"