OSDN Git Service

bool to boolean.
[putex/putex.git] / src / texsourc / texmf.h
1 /* Main include file for TeX in C.  Originally by Tim Morgan,
2    December 23, 1987.  These routines are also used by Metafont (with
3    some name changes).
4
5    Copyright 1992 Karl Berry
6    Copyright 2007 TeX Users Group
7    Copyright 2014 Clerk Ma
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful, but
15    WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17    General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22    02110-1301 USA.  */
23
24 #include "yandytex.h"
25
26 #ifdef _MSC_VER
27   #define INLINE __inline
28 #else
29   #define INLINE inline
30 #endif
31
32 #define dump_file  fmt_file
33 #define out_file   dvi_file
34
35 /* File types. */
36 typedef FILE * byte_file;
37 typedef FILE * word_file;
38
39 /* Read a line of input as quickly as possible.  */
40 extern boolean input_line (FILE *);
41 #define input_ln(stream, flag) input_line(stream)
42
43 /* `b_open_in' (and out) is used only for reading (and writing) .tfm
44    files; `w_open_in' (and out) only for dump files.  The filenames are
45    passed in as a global variable, `name_of_file'.  */
46    
47 #define b_open_in(f)  open_input  (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
48 #define w_open_in(f)  open_input  (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
49 #define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
50 #define w_open_out    b_open_out
51 #define b_close       a_close
52 #define w_close       a_close
53 #define gz_w_close    gzclose
54
55 /* sec 0241 */
56 #define fix_date_and_time() get_date_and_time (&(tex_time), &(day), &(month), &(year))
57
58 /* If we're running under Unix, use system calls instead of standard I/O
59    to read and write the output files; also, be able to make a core dump. */ 
60 #ifndef unix
61   #define dumpcore() exit(1)
62 #else /* unix */
63   #define dumpcore abort
64 #endif
65
66 #define write_dvi(a, b)                                           \
67   if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
68          (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file)      \
69          != (size_t) ((size_t)(b) - (size_t)(a) + 1))             \
70      FATAL_PERROR ("\n! dvi file")
71
72 extern int do_dump (char *, int, int, FILE *);
73 extern int do_undump (char *, int, int, FILE *);
74
75 /* Reading and writing the dump files.  `(un)dumpthings' is called from
76    the change file.*/
77 #define dumpthings(base, len)           \
78   do_dump ((char *) &(base), sizeof (base), (int) (len), dump_file)
79
80 #define undumpthings(base, len)           \
81   do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
82
83 /* Use the above for all the other dumping and undumping.  */
84 #define generic_dump(x)   dumpthings (x, 1)
85 #define generic_undump(x) undumpthings (x, 1)
86
87 #define dump_wd     generic_dump
88 #define undump_wd   generic_undump
89 #define dump_hh     generic_dump
90 #define undump_hh   generic_undump
91 #define dump_qqqq   generic_dump
92 #define undump_qqqq generic_undump
93
94 /* `dump_int' is called with constant integers, so we put them into a
95    variable first.  */
96 #define dump_int(x)         \
97   do                        \
98     {                       \
99       integer x_val = (x);  \
100       generic_dump (x_val); \
101     }                       \
102   while (0)
103
104 /* web2c/regfix puts variables in the format file loading into
105    registers.  Some compilers aren't willing to take addresses of such
106    variables.  So we must kludge.  */
107 #ifdef REGFIX
108 #define undump_int(x)         \
109   do                          \
110     {                         \
111       integer x_val;          \
112       generic_undump (x_val); \
113       x = x_val;              \
114     }                         \
115   while (0)
116 #else
117 #define undump_int  generic_undump
118 #endif
119
120
121 /* If we're running on an ASCII system, there is no need to use the
122    `xchr' array to convert characters to the external encoding.  */
123
124 #define Xchr(x) xchr[x]
125
126 /* following added from new texmf.c file 1996/Jan/12 */
127 /* these, of course are useless definitions since parameters not given */
128
129 /* Declare routines in texmf.c.  */
130 extern void get_date_and_time();
131 extern void t_open_in();
132 extern boolean input_line();