blob: ce9bb4029cf08b804734d5e6cff2b7b1171c3ee3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
* Copyright (c) 1987 University of Maryland Department of Computer Science.
* All rights reserved. Permission to copy for any purpose is hereby granted
* so long as this copyright notice remains intact.
*/
/* C-Tex I/O definitions */
/*
* For non-ASCII systems, someone would have to do a great deal of work
* in the various I/O routines to use the two translation tables. I have
* not the motivation.
*/
#ifdef notdef
int InX[128]; /* input translation table */
int OutX[128]; /* output translation table */
#endif
/*
* These `magic constants' are really the best we can do. Using termcap
* would not be quite right, because (1) the C-TeX run may not be on a
* terminal at all, and (2) the log file could very likely be viewed from
* a different terminal than was used for the C-TeX run.
*/
#define MaxPrLineLen 72 /* will try to never print lines longer
than this */
#define MaxErrLineLen 72 /* errors (context actually) will never
be longer than this */
#define HalfErrLine 42 /* about 1/2 MaxErrLineLen; this will be
the width of first lines of contexts */
/*
* Input will be read into lines of InBufLen characters. This limits
* several things, including control sequence name length and length of
* strings read by \read.
*/
#define InBufLen 512
/* Output descriptors. Note that 0-15 are indexes into OutF. */
#define OutIgnore 16 /* nowhere; output is silently discarded */
#define OutTerm 17 /* to terminal (stdout) */
#define OutLog 18 /* to log file */
#define OutTermAndLog 19 /* to terminal & log file both */
#define OutString 20 /* to PoolString */
#define OutCircBuf 21 /* to CircBuf */
int OutFD; /* the current output descriptor */
FILE *LogF; /* the log file */
FILE *InF[16]; /* the 16 \read descriptors */
FILE *OutF[16]; /* the 16 \write descriptors */
char CircBuf[MaxErrLineLen]; /* this will be used for showing error
context; its length determines the
maximum amount of context that can
be shown. This is a way of getting
around a possibly massive amount of
stuff leading up to the point of the
error, without using backpointers.
Inefficient perhaps, but it does not
occur often. */
/*
* On occasion it is nice to be able to interrupt the current output
* descriptor and switch to a new one. This does not happen often,
* so we just have a small stack of them here.
*/
int OutFDstack[20];
int *OutFDsp;
/* macros to switch to a new output, then restore the old */
#define PushOut(fd) (*OutFDsp++ = OutFD, OutFD = (fd))
#define PopOut() (OutFD = *--OutFDsp)
/*
* The following magic variables are used by ShowContext to control the info
* being inserted into the CircBuf.
*/
int OutTally; /* total characters recently printed */
int OutSC_max; /* max needed by ShowContext */
/*
* UpdateTerminal makes sure that all output is visible by the user.
* In this case all we need to do is fflush(stdout).
*/
#define UpdateTerminal() ((void) fflush(stdout))
|