Debian Codegraph @

texk/web2c/pmpostdir/pmpost.ch

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