1 /* Copyright 2014 Clerk Ma
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful, but
9 WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 #ifndef _YANDYTEX_TEXD_H
19 #define _YANDYTEX_TEXD_H
20 /* headers and pragmas */
23 #pragma warning(disable:4201) // nameless struct/union
24 #pragma warning(disable:4267)
25 #pragma warning(disable:4996) // a function that was marked with deprecated
26 #pragma warning(disable:4701) // potentially uninitialized local variable 'name' used
27 #pragma warning(disable:4135) // conversion between different integral types
28 #pragma warning(disable:4127) // conditional expression is constant
37 #include <kpathsea/c-auto.h>
38 #include <kpathsea/c-std.h>
39 #include <kpathsea/c-pathmx.h>
40 #include <kpathsea/c-pathch.h>
41 #include <kpathsea/c-fopen.h>
42 #include <kpathsea/c-ctype.h>
43 #include <kpathsea/c-proto.h>
44 #include <kpathsea/config.h>
45 #include <kpathsea/getopt.h>
46 #include <kpathsea/lib.h>
47 #include <kpathsea/line.h>
48 #include <kpathsea/readable.h>
49 #include <kpathsea/types.h>
50 #include <kpathsea/tex-file.h>
51 #include <kpathsea/variable.h>
52 #include <kpathsea/absolute.h>
54 #include <kpathsea/win32lib.h>
55 #include <kpathsea/concatn.h>
60 typedef long long integer;
61 typedef double glue_ratio;
63 typedef FILE * alpha_file;
64 typedef FILE * byte_file;
65 typedef FILE * word_file;
66 typedef unsigned char ASCII_code;
67 typedef unsigned short KANJI_code;
68 typedef unsigned char eight_bits;
69 typedef unsigned short sixteen_bits;
70 typedef integer pool_pointer;
71 typedef integer str_number;
72 typedef unsigned char packed_ASCII_code;
73 typedef integer scaled;
74 typedef integer nonnegative_integer;
75 typedef unsigned char small_number;
81 //#define abs(x) ((integer)(x) >= 0 ? (integer)(x) : (integer)-(x))
82 //#define fabs(x) ((x) >= 0.0 ? (x) : -(x))
84 #define odd(x) ((x) % 2)
85 #define round(x) web2c_round((double) (x))
88 #define toint(x) ((integer) (x))
90 EXTERN integer web2c_round (double r);
91 EXTERN boolean open_input (FILE ** f, kpse_file_format_type file_fmt, const char * fopen_mode);
92 EXTERN boolean open_output (FILE ** f, const char * fopen_mode);
93 EXTERN int check_fclose (FILE * f);
95 #define show_line(str, flag) (void) fputs(str, stdout)
97 #define wterm(s) (void) putc(s, stdout)
98 #define wlog(s) (void) putc(s, log_file)
99 #define wterm_cr() (void) putc('\n', stdout);
100 #define wlog_cr() (void) putc('\n', log_file);
104 out_dvi_flag = (1 << 0),
105 out_pdf_flag = (1 << 1),
106 out_xdv_flag = (1 << 2),
107 out_dpx_flag = (1 << 3),
110 EXTERN boolean input_line (FILE * f);
111 #define input_ln(stream, flag) input_line(stream)
113 #define a_open_in(f, p) open_input (&(f), p, FOPEN_R_MODE)
114 #define a_open_out(f) open_output (&(f), FOPEN_W_MODE)
115 #define b_open_in(f) open_input (&(f), kpse_tfm_format, FOPEN_RBIN_MODE)
116 #define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
117 #define w_open_in(f) open_input (&(f), kpse_fmt_format, FOPEN_RBIN_MODE)
118 #define w_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
119 #define a_close(f) (void) check_fclose(f)
120 #define b_close a_close
121 #define w_close a_close
122 #define gz_w_close gzclose
124 /* If we're running under Unix, use system calls instead of standard I/O
125 to read and write the output files; also, be able to make a core dump. */
127 #define dumpcore() exit(1)
129 #define dumpcore abort
133 EXTERN int do_dump(char * p, int item_size, int nitems, gzFile out_file);
134 EXTERN int do_undump(char * p, int item_size, int nitems, gzFile out_file);
135 #define dump_file gz_fmt_file
137 EXTERN int do_dump(char * p, int item_size, int nitems, FILE * out_file);
138 EXTERN int do_undump(char * p, int item_size, int nitems, FILE * out_file);
139 #define dump_file fmt_file
142 #define dumpthings(base, len) \
143 do_dump ((char *) &(base), sizeof (base), (int) (len), dump_file)
145 #define undumpthings(base, len) \
146 do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
148 /* Use the above for all the other dumping and undumping. */
149 #define generic_dump(x) dumpthings(x, 1)
150 #define generic_undump(x) undumpthings(x, 1)
152 #define dump_wd generic_dump
153 #define undump_wd generic_undump
154 #define dump_hh generic_dump
155 #define undump_hh generic_undump
156 #define dump_qqqq generic_dump
157 #define undump_qqqq generic_undump
159 #define dump_int(x) \
162 integer x_val = (x); \
163 generic_dump (x_val); \
167 #define undump_int generic_undump
169 #define undump_size(arg1, arg2, arg3, arg4) \
179 fprintf(stdout, "%s%s\n", "---! Must increase the " , arg3);\