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-fopen.h>
41 #include <kpathsea/c-ctype.h>
42 #include <kpathsea/c-proto.h>
43 #include <kpathsea/config.h>
44 #include <kpathsea/getopt.h>
45 #include <kpathsea/lib.h>
46 #include <kpathsea/line.h>
47 #include <kpathsea/readable.h>
48 #include <kpathsea/types.h>
49 #include <kpathsea/tex-file.h>
50 #include <kpathsea/variable.h>
51 #include <kpathsea/absolute.h>
53 #include <kpathsea/win32lib.h>
58 typedef long long integer;
59 typedef double glue_ratio;
61 typedef FILE * alpha_file;
62 typedef FILE * byte_file;
63 typedef FILE * word_file;
64 typedef unsigned char ASCII_code;
65 typedef unsigned short KANJI_code;
66 typedef unsigned char eight_bits;
67 typedef unsigned short sixteen_bits;
68 typedef integer pool_pointer;
69 typedef integer str_number;
70 typedef unsigned char packed_ASCII_code;
71 typedef integer scaled;
72 typedef integer nonnegative_integer;
73 typedef unsigned char small_number;
79 //#define abs(x) ((integer)(x) >= 0 ? (integer)(x) : (integer)-(x))
80 //#define fabs(x) ((x) >= 0.0 ? (x) : -(x))
82 #define odd(x) ((x) % 2)
83 #define round(x) web2c_round((double) (x))
86 #define toint(x) ((integer) (x))
88 EXTERN integer web2c_round (double r);
89 EXTERN boolean open_input (FILE ** f, kpse_file_format_type file_fmt, const char * fopen_mode);
90 EXTERN boolean open_output (FILE ** f, const char * fopen_mode);
91 EXTERN int check_fclose (FILE * f);
93 #define show_line(str, flag) (void) fputs(str, stdout)
95 #define wterm(s) (void) putc(s, stdout)
96 #define wlog(s) (void) putc(s, log_file)
97 #define wterm_cr() (void) putc('\n', stdout);
98 #define wlog_cr() (void) putc('\n', log_file);
102 out_dvi_flag = (1 << 0),
103 out_pdf_flag = (1 << 1),
104 out_xdv_flag = (1 << 2),
105 out_dpx_flag = (1 << 3),
108 EXTERN boolean input_line (FILE * f);
109 #define input_ln(stream, flag) input_line(stream)
111 #define a_open_in(f, p) open_input (&(f), p, FOPEN_R_MODE)
112 #define a_open_out(f) open_output (&(f), FOPEN_W_MODE)
113 #define b_open_in(f) open_input (&(f), kpse_tfm_format, FOPEN_RBIN_MODE)
114 #define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
115 #define w_open_in(f) open_input (&(f), kpse_fmt_format, FOPEN_RBIN_MODE)
116 #define w_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
117 #define a_close(f) (void) check_fclose(f)
118 #define b_close a_close
119 #define w_close a_close
120 #define gz_w_close gzclose
122 /* If we're running under Unix, use system calls instead of standard I/O
123 to read and write the output files; also, be able to make a core dump. */
125 #define dumpcore() exit(1)
127 #define dumpcore abort
131 EXTERN int do_dump(char * p, int item_size, int nitems, gzFile out_file);
132 EXTERN int do_undump(char * p, int item_size, int nitems, gzFile out_file);
133 #define dump_file gz_fmt_file
135 EXTERN int do_dump(char * p, int item_size, int nitems, FILE * out_file);
136 EXTERN int do_undump(char * p, int item_size, int nitems, FILE * out_file);
137 #define dump_file fmt_file
140 #define dumpthings(base, len) \
141 do_dump ((char *) &(base), sizeof (base), (int) (len), dump_file)
143 #define undumpthings(base, len) \
144 do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
146 /* Use the above for all the other dumping and undumping. */
147 #define generic_dump(x) dumpthings(x, 1)
148 #define generic_undump(x) undumpthings(x, 1)
150 #define dump_wd generic_dump
151 #define undump_wd generic_undump
152 #define dump_hh generic_dump
153 #define undump_hh generic_undump
154 #define dump_qqqq generic_dump
155 #define undump_qqqq generic_undump
157 #define dump_int(x) \
160 integer x_val = (x); \
161 generic_dump (x_val); \
165 #define undump_int generic_undump
167 #define undump_size(arg1, arg2, arg3, arg4) \
177 fprintf(stdout, "%s%s\n", "---! Must increase the " , arg3);\