1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
@x
#include <kpathsea/kpathsea.h>
@y
#include <kpathsea/kpathsea.h>
#include <ptexenc/ptexenc.h>
char kanjioption[16];
@z
@x
@d TEX "tex"
@y
@d TEX "e" P_UP "tex"
@z
@x
#define MPXCOMMAND "makempx"
@y
#define MPXCOMMAND P_UP "makempx"
@z
@x
if (cnf_cmd!=NULL && (strcmp (cnf_cmd, "1")!=0)) {
if (mp_troff_mode(mp)!=0)
cmd = concatn (cnf_cmd, " -troff ",
qmpname, " ", qmpxname, NULL);
else if (mpost_tex_program!=NULL && *mpost_tex_program != '\0')
cmd = concatn (cnf_cmd, " -tex=", mpost_tex_program, " ",
qmpname, " ", qmpxname, NULL);
@y
if (cnf_cmd!=NULL && (strcmp (cnf_cmd, "1")!=0)) {
if (kanjioption[0])
cnf_cmd = concatn (cnf_cmd, " --kanji=", kanjioption, NULL);
if (mp_troff_mode(mp))
cmd = concatn (cnf_cmd, " -troff ",
qmpname, " ", qmpxname, NULL);
else if (mpost_tex_program!=NULL && *mpost_tex_program != '\0')
cmd = concatn (cnf_cmd, " -tex=", mpost_tex_program, " ",
qmpname, " ", qmpxname, NULL);
@z
@x
if (mpost_tex_program != NULL && *mpost_tex_program != '\0') {
maincmd = mpost_xstrdup(mpost_tex_program);
} else {
if (mpxmode == mpx_tex_mode) {
s = kpse_var_value("TEX");
if (s==NULL) s = kpse_var_value("MPXMAINCMD");
if (s==NULL) s = mpost_xstrdup (TEX);
maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+1);
strcpy(maincmd,s);
@y
if (mpost_tex_program != NULL && *mpost_tex_program != '\0') {
if (kanjioption[0]) {
maincmd = (char *)mpost_xmalloc (strlen(mpost_tex_program) +
strlen(kanjioption) + 15);
strcpy(maincmd, mpost_tex_program);
strcat(maincmd, " --kanji=");
strcat(maincmd, kanjioption);
} else
maincmd = mpost_xstrdup(mpost_tex_program);
} else {
if (mpxmode == mpx_tex_mode) {
s = kpse_var_value("TEX");
if (s==NULL) s = kpse_var_value("MPXMAINCMD");
if (s==NULL) s = mpost_xstrdup (TEX);
if (kanjioption[0])
maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+
strlen(kanjioption)+13);
else
maincmd = (char *)mpost_xmalloc (strlen(s)+strlen(default_args)+1);
strcpy(maincmd,s);
if (kanjioption[0]) {
strcat(maincmd, " --kanji=");
strcat(maincmd, kanjioption);
}
@z
@x
const char *banner = "% Written by metapost version ";
@y
const char *banner = "% Written by " P_UP "mpost version ";
@z
@x
const char *banner = "% Written by dvitomp version ";
@y
const char *banner = "% Written by " P_UP "dvitomp version ";
@z
@x
{ "kpathsea-debug", 1, 0, 0 },
@y
{ "kpathsea-debug", 1, 0, 0 },
{ "kanji", 1, 0, 0 },
@z
@x
} else if (ARGUMENT_IS ("interaction")) {
@y
} else if (ARGUMENT_IS ("kanji")) {
strcpy(kanjioption, optarg);
if(!set_enc_string(optarg, optarg)) {
fprintf(stderr,"Ignoring unknown argument `%s' to --kanji", optarg);
}
} else if (ARGUMENT_IS ("interaction")) {
@z
@x
{ "no-kpathsea", 0, &nokpse, 1 },
@y
{ "no-kpathsea", 0, &nokpse, 1 },
{ "kanji", 1, 0, 0 },
@z
@x
} else if (option_is ("progname")) {
user_progname = optarg;
@y
} else if (option_is ("progname")) {
user_progname = optarg;
} else if (option_is ("kanji")) {
strcpy (kanjioption, optarg);
if(!set_enc_string(optarg, optarg)) {
fprintf(stderr,"Ignoring unknown argument `%s' to --kanji", optarg);
}
@z
@x
fprintf(stdout, "This is dvitomp %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, "This is MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@y
fprintf(stdout, "This is " P_UP "dvitomp %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, "This is " P_UP "MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@z
@x
"Usage: mpost [OPTION] [&MEMNAME] [MPNAME[.mp]] [COMMANDS]\n"
" mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
"\n"
" Run MetaPost on MPNAME, usually creating MPNAME.NNN (and perhaps\n"
" MPNAME.tfm), where NNN are the character numbers generated.\n"
" Any remaining COMMANDS are processed as MetaPost input,\n"
" after MPNAME is read.\n\n"
" With a --dvitomp argument, MetaPost acts as DVI-to-MPX converter only.\n"
" Call MetaPost with --dvitomp --help for option explanations.\n\n");
fprintf(stdout,
" -ini be inimpost, for dumping mem files\n"
@y
"Usage: " P_UP "mpost [OPTION] [&MEMNAME] [MPNAME[.mp]] [COMMANDS]\n"
" " P_UP "mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
"\n"
" Run " P_UP "MetaPost on MPNAME, usually creating MPNAME.NNN (and perhaps\n"
" MPNAME.tfm), where NNN are the character numbers generated.\n"
" Any remaining COMMANDS are processed as " P_UP "MetaPost input,\n"
" after MPNAME is read.\n\n"
" With a --dvitomp argument, " P_UP "MetaPost acts as DVI-to-MPX converter only.\n"
" Call " P_UP "MetaPost with --dvitomp --help for option explanations.\n\n");
fprintf(stdout,
" -ini be ini" P_UP "mpost, for dumping mem files\n"
@z
@x
" -jobname=STRING set the job name to STRING\n"
@y
" -jobname=STRING set the job name to STRING\n"
" -kanji=STRING set the Japanese encoding to STRING\n"
@z
@x
" -version output version information and exit\n"
"\n"
"Email bug reports to mp-implementors@@tug.org.\n"
@y
" -version output version information and exit\n"
@z
@x
fprintf(stdout, "This is dvitomp %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, "This is MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@y
fprintf(stdout, "This is " P_UP "dvitomp %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, "This is " P_UP "MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@z
@x
"Usage: dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
" mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
@y
"Usage: " P_UP "dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
" " P_UP "mpost --dvitomp DVINAME[.dvi] [MPXNAME[.mpx]]\n"
@z
@x
" -progname=STRING set program name to STRING\n"
@y
" -progname=STRING set program name to STRING\n"
#ifdef UPMP
" -kanji=STRING set kanji encoding (STRING=euc|jis|sjis|utf8|uptex)\n"
#else
" -kanji=STRING set kanji encoding (sjis, jis, euc, utf8)\n"
#endif
@z
@x
fprintf(stdout, "dvitomp (MetaPost) %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, "MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@y
fprintf(stdout, P_UP "dvitomp (" P_UP "MetaPost) %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
else
fprintf(stdout, P_UP "MetaPost %s" WEB2CVERSION " (%s)\n", s, kpathsea_version_string);
@z
@x
"Current maintainer of MetaPost: Luigi Scarso.\n\n"
@y
"Current maintainer of MetaPost: Luigi Scarso.\n"
#ifdef UPMP
"Authors of upMetaPost: Michio Matsuyama, Hideyuki Suzuki, Takuji Tanaka.\n\n"
#else
"Authors of pMetaPost: Michio Matsuyama, Hideyuki Suzuki.\n\n"
#endif
@z
@x
const char * banner = "This is MetaPost, version ";
@y
const char * banner = "This is " P_UP "MetaPost, version ";
@z
@x
#define DLLPROC dllmpostmain
@y
#ifdef UPMP
#define DLLPROC dllupmpostmain
#else
#define DLLPROC dllpmpostmain
#endif
@z
@x
if (FILESTRCASEEQ(base, "rmpost")){
@y
if (FILESTRCASEEQ(base, "r" P_UP "mpost")){
@z
@x
if (FILESTRCASEEQ(base, "dvitomp"))
@y
if (FILESTRCASEEQ(base, P_UP "dvitomp"))
@z
@x
if (dvitomp_only) {
@<Read and set dvitomp command line options@>;
} else {
@y
kanjioption[0] = '\0';
#ifdef UPMP
enable_UPTEX (true);
set_enc_string("uptex", "uptex");
#else
enable_UPTEX (false);
#if defined(WIN32)
set_enc_string("sjis", "sjis");
#else
set_enc_string("utf8", "euc");
#endif
#endif
if (dvitomp_only) {
@<Read and set dvitomp command line options@>;
} else {
@z
@x
if (FILESTRCASEEQ(kpse_program_name, "rmpost"))
@y
if (FILESTRCASEEQ(kpse_program_name, "r" P_UP "mpost"))
@z
@x
if(putenv(xstrdup("engine=metapost")))
@y
if(putenv(xstrdup("engine=" P_UP "mpost")))
@z
|