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