OSDN Git Service

b4c8954573d8fe7a136188c29c6ee8647c37c918
[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 enum
27 {
28   out_dvi_flag = (1 << 0),
29   out_pdf_flag = (1 << 1),
30   out_xdv_flag = (1 << 2),
31   out_dpx_flag = (1 << 3),
32 };
33
34 /* Read a line of input as quickly as possible.  */
35 extern boolean input_line (FILE *);
36 #define input_ln(stream, flag) input_line(stream)
37
38 #define b_open_in(f)  open_input  (&(f), TFMFILEPATH,   FOPEN_RBIN_MODE)
39 #define w_open_in(f)  open_input  (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
40 #define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
41 #define w_open_out    b_open_out
42 #define b_close       a_close
43 #define w_close       a_close
44 #define gz_w_close    gzclose
45
46 /* sec 0241 */
47 extern void fix_date_and_time(void);
48
49 /* If we're running under Unix, use system calls instead of standard I/O
50    to read and write the output files; also, be able to make a core dump. */ 
51 #ifndef unix
52   #define dumpcore() exit(1)
53 #else /* unix */
54   #define dumpcore abort
55 #endif
56
57 #ifdef COMPACTFORMAT
58 extern int do_dump   (char *, int, int, gzFile);
59 extern int do_undump (char *, int, int, gzFile);
60 #define dump_file gz_fmt_file
61 #else
62 extern int do_dump   (char *, int, int, FILE *);
63 extern int do_undump (char *, int, int, FILE *);
64 #define dump_file fmt_file
65 #endif
66
67 #define dumpthings(base, len)           \
68   do_dump   ((char *) &(base), sizeof (base), (int) (len), dump_file)
69
70 #define undumpthings(base, len)         \
71   do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
72
73 /* Use the above for all the other dumping and undumping.  */
74 #define generic_dump(x)   dumpthings(x, 1)
75 #define generic_undump(x) undumpthings(x, 1)
76
77 #define dump_wd     generic_dump
78 #define undump_wd   generic_undump
79 #define dump_hh     generic_dump
80 #define undump_hh   generic_undump
81 #define dump_qqqq   generic_dump
82 #define undump_qqqq generic_undump
83
84 #define dump_int(x)         \
85   do                        \
86     {                       \
87       integer x_val = (x);  \
88       generic_dump (x_val); \
89     }                       \
90   while (0)
91
92 #define undump_int  generic_undump
93
94 extern void t_open_in();