1 /* alephmem.h: C declarations for types and accessing routines in aleph.c
2 
3 This file is part of the Aleph project, which
4 is based on the web2c distribution of TeX.
5 
6 Copyright (C) 1994--2000 John Plaice and Yannis Haralambous
7 Copyright (C) 2004 the Aleph team
8 
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License as published by the Free Software Foundation; either
12 version 2 of the License, or (at your option) any later version.
13 
14 This library is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 Library General Public License for more details.
18 
19 You should have received a copy of the GNU Library General Public
20 License along with this library; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
22 
23 
24 extern boolean new_input_line (FILE *, halfword);
25 extern boolean newinputln (FILE *, halfword, halfword, boolean);
26 extern int getc_two (FILE *);
27 extern int getfilemode (FILE *, int);
28 extern void ungetc_two (int, FILE *);
29 extern int ocptemp;
30 
31 #define newinputline(stream, mode, flag)   new_input_line (stream, mode)
32 
33 extern memoryword **fonttables;
34 extern memoryword **fontsorttables;
35 extern int **ocptables;
36 
37 typedef struct hashw
38 {
39   integer p;
40   struct hashw *ptr;
41   memoryword mw;
42 } hashword;
43 
44 extern hashword hashtable[];
45 extern hashword *createhashpos(int);
46 extern hashword *createeqtbpos(int);
47 extern hashword *createxeqlevel(int);
48 extern void inithhashtable(void);
49 extern void dumphhashtable(void);
50 extern void undumphhashtable(void);
51 extern void allocatefonttable(int, int);
52 extern void dumpfonttable(int, int);
53 extern void undumpfonttable(int);
54 extern void allocatefontsorttable(int, int);
55 extern void dumpfontsorttable(int, int);
56 extern void undumpfontsorttable(int);
57 extern void allocateocptable(int, int);
58 extern void dumpocptable(int);
59 extern void undumpocptable(int);
60 extern void odateandtime(int, int, int, int);
61 extern void btestin(void);
62 extern void runexternalocp(string);
63 
64 #define initeqtbtable()		inithhashtable();
65 #define dumpeqtbtable()		dumphhashtable();
66 #define undumpeqtbtable()	undumphhashtable();
67 
68 #define HASHTABLESIZE		23123
69 #define neweqtb(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
70 				 (hashtable[(a)%HASHTABLESIZE].mw) : \
71                                  (createeqtbpos(a)->mw))
72 #define neweqtbint(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
73 				 (hashtable[(a)%HASHTABLESIZE].mw.cint) : \
74                                  (createeqtbpos(a)->mw.cint))
75 #define neweqtbsc(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
76 				 (hashtable[(a)%HASHTABLESIZE].mw.cint) : \
77                                  (createeqtbpos(a)->mw.cint))
78 #define newequiv(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
79 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.rh) : \
80                                  (createeqtbpos(a)->mw.hh.rh))
81 #define newequiv1(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
82 			(hashtable[(a)%HASHTABLESIZE].mw.cint1) : \
83                                  (createeqtbpos(a)->mw.cint1))
84 #define neweqlevel(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
85 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.b1) : \
86                                  (createeqtbpos(a)->mw.hh.b1))
87 #define neweqtype(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
88 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.b0) : \
89                                  (createeqtbpos(a)->mw.hh.b0))
90 #define setneweqtb(a,v)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
91 				 (hashtable[(a)%HASHTABLESIZE].mw=v) : \
92                                  (createeqtbpos(a)->mw=v))
93 #define setneweqtbint(a,v)	(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
94 				 (hashtable[(a)%HASHTABLESIZE].mw.cint=v) : \
95                                  (createeqtbpos(a)->mw.cint=v))
96 #define setneweqtbsc(a,v)	(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
97 				 (hashtable[(a)%HASHTABLESIZE].mw.cint=v) : \
98                                  (createeqtbpos(a)->mw.cint=v))
99 #define setequiv(a,v)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
100 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.rh=v) : \
101                                  (createeqtbpos(a)->mw.hh.rh=v))
102 #define setequiv1(a,v)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
103 			 (hashtable[(a)%HASHTABLESIZE].mw.cint1=v) : \
104                                  (createeqtbpos(a)->mw.cint1=v))
105 #define seteqlevel(a,v)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
106 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.b1=v) : \
107                                  (createeqtbpos(a)->mw.hh.b1=v))
108 #define seteqtype(a,v)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
109 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.b0=v) : \
110                                  (createeqtbpos(a)->mw.hh.b0=v))
111 
112 #define newhashnext(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
113 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.v.LH) : \
114                                  (createhashpos(a)->mw.hh.v.LH))
115 #define newhashtext(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
116 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.v.RH) : \
117                                  (createhashpos(a)->mw.hh.v.RH))
118 #define sethashnext(a,d)	(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
119 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.v.LH=d) : \
120                                  (createhashpos(a)->mw.hh.v.LH=d))
121 #define sethashtext(a,d)	(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
122 				 (hashtable[(a)%HASHTABLESIZE].mw.hh.v.RH=d) : \
123                                  (createhashpos(a)->mw.hh.v.RH=d))
124 
125 #define newxeqlevel(a)		(((a)==hashtable[(a)%HASHTABLESIZE].p) ? \
126 				 (hashtable[(a)%HASHTABLESIZE].mw.cint) : \
127                                  (createxeqlevel(a)->mw.cint))
128 
129 #define setintzero(w,a)		((w).cint=(a))
130 #define setintone(w,a)		((w).cint1=(a))
131