6 #pragma warning(disable:4115) // kill rpcasync.h complaint
8 #define MYLIBAPI __declspec(dllexport)
11 #pragma warning(disable:4996)
12 #pragma warning(disable:4131) // old style declarator
13 #pragma warning(disable:4135) // conversion between different integral types
14 #pragma warning(disable:4127) // conditional expression is constant
22 #pragma warning(disable:4244) /* 96/Jan/10 */
24 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
26 /* end of the old tex8.c */
28 void give_err_help (void)
33 bool open_fmt_file (void)
37 j = cur_input.loc_field;
39 /* For Windows NT, lets allow + instead of & for format specification */
40 /* User specified a format name on the command line */
41 if (buffer[cur_input.loc_field] == '&' || buffer[cur_input.loc_field] == '+')
43 incr(cur_input.loc_field);
44 j = cur_input.loc_field;
47 while (buffer[j] != ' ')
50 pack_buffered_name(0, cur_input.loc_field, j - 1);
52 if (w_open_in(fmt_file))
53 goto lab40; /* format file opened OK */
55 /* format file open failed */
58 (void) sprintf(log_line, "%s;%s\n", "Sorry, I can't find that format",
59 " will try the default.");
60 show_line(log_line, 1);
66 name_of_file[name_length + 1] = '\0';
67 (void) sprintf(s, "%s (%s);%s\n", "Sorry, I can't find that format",
68 name_of_file + 1, " will try the default.");
69 name_of_file[name_length + 1] = ' ';
71 (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n",
75 char *t; /* extra info 97/June/13 */
77 if ((t = grabenv("TEXFORMATS")) != NULL)
79 sprintf(s, "(%s=%s)\n", "TEXFORMATS", t);
83 sprintf(s, "%s environment variable not set\n", "TEXFORMATS");
86 show_line(log_line, 1); // show all three lines at once
94 /* Try the default format (either because no format specified or failed) */
95 pack_buffered_name(format_default_length - 4, 1, 0);
97 if (!w_open_in(fmt_file))
101 (void) sprintf(log_line, "%s!\n", "I can't find the default format file");
102 show_line(log_line, 1);
108 name_of_file[name_length + 1] = '\0';
109 (void) sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1);
110 name_of_file[name_length + 1] = ' ';
112 (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS");
115 char *t; /* extra info 97/June/13 */
117 if ((t = grabenv("TEXFORMATS")) != NULL)
119 sprintf(s, "(%s=%s)\n", "TEXFORMATS", t);
123 sprintf(s, "%s environment variable not set\n", "TEXFORMATS");
126 show_line(log_line, 1); // show all three lines at once
133 cur_input.loc_field = j;
137 /**************************************************************************/
138 void print_char_string (unsigned char *s)
143 void show_font_info (void); // now in local.c
144 extern int closed_already; // make sure we don't try this more than once
145 /* The following needs access to zdvibuf of ALLOCATEDVIBUF 94/Mar/24 */
146 /* done in closefilesandterminate_regmem in coerce.h */
148 void close_files_and_terminate (void)
152 if (closed_already++)
154 show_line("close_files_and_terminated already ", 0);
155 return; // sanity check
159 show_line("\nclose_files_and_terminate ", 0);
161 /* close all open files */
162 for (k = 0; k <= 15; k++)
165 (void) a_close(write_file[k]);
169 if (tracing_stats > 0 || verbose_flag != 0) /* 93/Nov/30 - bkph */
172 /* used to output paragraph breaking statistics here */
173 (void) fprintf(log_file, "%c\n", ' ');
174 (void) fprintf(log_file, "\n");
175 (void) fprintf(log_file, "%s%s\n", "Here is how much of TeX's memory", " you used:");
176 (void) fprintf(log_file, "%c%ld%s", ' ', (long)str_ptr - init_str_ptr, " string");
177 if (str_ptr != init_str_ptr + 1)
178 (void) putc('s', log_file);
179 #ifdef ALLOCATESTRING
181 (void) fprintf(log_file, "%s%ld\n", " out of ", (long) current_max_strings - init_str_ptr);
184 (void) fprintf(log_file, "%s%ld\n", " out of ", (long) max_strings - init_str_ptr);
186 #ifdef ALLOCATESTRING
188 (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) pool_ptr - init_pool_ptr, " string characters out of ", (long) current_pool_size - init_pool_ptr);
191 (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) pool_ptr - init_pool_ptr, " string characters out of ", (long) pool_size - init_pool_ptr);
195 (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", (long)current_mem_size);
198 (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", (long)mem_end + 1 - mem_min);
199 (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) cs_count, " multiletter control sequences out of ", (long)(hash_size + hash_extra));
200 (void) fprintf(log_file, "%c%ld%s%ld%s", ' ', (long) fmem_ptr, " words of font info for ", (long) font_ptr - 0, " font");
202 (void) putc('s', log_file);
206 (void) fprintf(log_file, "%s%ld%s%ld\n", ", out of ", (long)current_font_mem_size, " for ", (long)font_max - 0);
209 (void) fprintf(log_file, "%s%ld%s%ld\n", ", out of ", (long)font_mem_size, " for ", (long)font_max - 0);
210 (void) fprintf(log_file, "%c%ld%s", ' ', (long)hyph_count, " hyphenation exception");
212 (void) putc('s', log_file);
214 (void) fprintf(log_file, "%s%ld\n", " out of ", (long) hyphen_prime);
215 (void) fprintf(log_file, " ");
216 (void) fprintf(log_file, "%ld%s", (long)max_in_stack, "i,");
217 (void) fprintf(log_file, "%ld%s", (long)max_nest_stack, "n,");
218 (void) fprintf(log_file, "%ld%s", (long)max_param_stack, "p,");
219 (void) fprintf(log_file, "%ld%s", (long)max_buf_stack + 1, "b,");
220 (void) fprintf(log_file, "%ld%s", (long)max_save_stack + 6, "s");
221 (void) fprintf(log_file, " stack positions out of ");
223 #ifdef ALLOCATESAVESTACK
225 (void) fprintf(log_file, "%ld%s", (long)current_stack_size, "i,");
228 (void) fprintf(log_file, "%ld%s", (long)stack_size, "i,");
230 #ifdef ALLOCATENESTSTACK
232 (void) fprintf(log_file, "%ld%s", (long)current_nest_size, "n,");
235 (void) fprintf(log_file, "%ld%s", (long)nest_size, "n,");
237 #ifdef ALLOCATEPARAMSTACK
239 (void) fprintf(log_file, "%ld%s", (long)current_param_size, "p,");
242 (void) fprintf(log_file, "%ld%s", (long)param_size, "p,");
244 #ifdef ALLOCATEBUFFER
246 (void) fprintf(log_file, "%ld%s", (long)current_buf_size, "b,");
249 (void) fprintf(log_file, "%ld%s", (long)buf_size, "b,");
251 #ifdef ALLOCATESAVESTACK
253 (void) fprintf(log_file, "%ld%s", (long)current_save_size, "s");
256 (void) fprintf(log_file, "%ld%s", (long)save_size, "s");
257 (void) fprintf(log_file, "\n");
260 fprintf(log_file, " (i = in_stack, n = nest_stack, p = param_stack, b = buf_stack, s = save_stack)\n");
263 fprintf(log_file, " %d inputs open max out of %d\n", high_in_open, max_in_open);
265 /* Modified 98/Jan/14 to leave out lines with zero counts */
266 if (show_line_break_stats && first_pass_count > 0) /* 96/Feb/8 */
268 int first_count, secondcount, thirdcount;
270 (void) fprintf(log_file, "\nSuccess at breaking %d paragraph%s:", first_pass_count, (first_pass_count == 1) ? "" : "s");
273 (void) fprintf(log_file, "\n %d single line `paragraph%s'", single_line, (single_line == 1) ? "" : "s"); /* 96/Apr/23 */
275 first_count = first_pass_count - single_line - second_pass_count;
280 secondcount = second_pass_count - final_pass_count;
281 thirdcount = final_pass_count - paragraph_failed;
283 if (first_pass_count > 0)
284 (void) fprintf(log_file, "\n %d first pass (\\pretolerance = %d)", first_pass_count, pretolerance);
286 if (second_pass_count > 0)
287 (void) fprintf(log_file, "\n %d second pass (\\tolerance = %d)", second_pass_count, tolerance);
289 if (final_pass_count > 0 || emergency_stretch > 0)
291 (void) fprintf(log_file, "\n %d third pass (\\emergencystretch = %lgpt)", final_pass_count, (double) emergency_stretch / 65536.0);
294 if (paragraph_failed > 0)
295 (void) fprintf(log_file, "\n %d failed", paragraph_failed);
297 (void) putc('\n', log_file);
299 if (overfull_hbox > 0)
300 (void) fprintf(log_file, "\n %d overfull \\hbox%s", overfull_hbox, (overfull_hbox > 1) ? "es" : "");
302 if (underfull_hbox > 0)
303 (void) fprintf(log_file, "\n %d underfull \\hbox%s", underfull_hbox, (underfull_hbox > 1) ? "es" : "");
305 if (overfull_vbox > 0)
306 (void) fprintf(log_file, "\n %d overfull \\vbox%s", overfull_vbox, (overfull_vbox > 1) ? "es" : "");
308 if (underfull_vbox > 0)
309 (void) fprintf(log_file, "\n %d underfull \\vbox%s", underfull_vbox, (underfull_vbox > 1) ? "es" : "");
311 if (overfull_hbox || underfull_hbox || overfull_vbox || underfull_vbox)
312 (void) putc('\n', log_file);
314 } /* end of if (log_opened) */
329 if (total_pages == 0)
330 print_nl("No pages of output.");
335 last_bop = dvi_offset + dvi_ptr - 5;
337 dvi_four(473628672L);
342 dvi_out(max_push / 256);
343 dvi_out(max_push % 256);
345 if (total_pages >= 65536) // 99/Oct/10 dvi_t 16 bit problem
347 sprintf(log_line, "\nWARNING: page count (dvi_t) in DVI file will be %ld not %ld\n",
348 (total_pages % 65536), total_pages);
351 (void) fputs (log_line, log_file);
353 show_line(log_line, 1);
356 dvi_out((total_pages / 256) % 256);
357 dvi_out(total_pages % 256);
359 if (show_fonts_used && log_opened) /* 97/Dec/24 */
360 show_font_info(); // now in local.c
364 if (font_used[font_ptr])
365 dvi_font_def(font_ptr);
373 k = 4 + ((dvi_buf_size - dvi_ptr) % 4);
381 if (trace_flag) /* 93/Dec/28 - bkph */
383 sprintf(log_line, "\ndviwrite %d", dvi_gone);
384 show_line(log_line, 0);
387 if (dvi_limit == half_buf)
388 write_dvi(half_buf, dvi_buf_size - 1);
391 write_dvi(0, dvi_ptr - 1);
393 print_nl("Output written on ");
395 if (full_file_name_flag && dvi_file_name != NULL)
396 print_char_string((unsigned char *) dvi_file_name);
398 slow_print(output_file_name);
401 print_int(total_pages);
402 print_string(" page");
404 if (total_pages != 1)
408 print_int(dvi_offset + dvi_ptr);
409 print_string(" bytes).");
414 HPDF_SaveToFile (yandy_pdf, "texput.pdf");
415 HPDF_Free(yandy_pdf);
420 (void) putc('\n', log_file);
421 (void) a_close(log_file);
422 selector = selector - 2;
424 if (selector == term_only)
426 print_nl("Transcript written on ");
428 if (full_file_name_flag && log_file_name != NULL)
429 print_char_string((unsigned char *) log_file_name);
431 slow_print(texmf_log_name);
439 if ((edit_name_start != 0) && (interaction > 0))
441 call_edit(str_pool, edit_name_start, edit_name_length, edit_line);
446 void debug_help (void)
451 print_nl(" debug # (-1 to exit):");
455 read(stdin, m); // ???
460 read(stdin, n); // ???
466 print_int(mem[n].hh.v.LH);
469 print_int(mem[n].hh.v.RH);
476 print_scaled(font_info[n].sc); print_char(' ');
477 print_int(font_info[n].qqq.b0); print_char(':');
478 print_int(font_info[n].qqq.b1); print_char(':');
479 print_int(font_info[n].qqq.b2); print_char(':');
480 print_int(font_info[n].qqq.b3);
482 print_word(font_info[n]);
486 print_word(save_stack[n]);
494 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
495 #ifdef ALLOCATESTRING
496 /* About to output node list make some space in string pool 97/Mar/9 */
497 if (pool_ptr + 32000 > current_pool_size)
498 str_pool = realloc_str_pool (increment_pool_size);
499 /* We don't bother to check whether this worked */
501 #ifdef ALLOCATESTRING
502 depth_threshold = current_pool_size - pool_ptr - 10;
504 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
505 depth_threshold = pool_size - pool_ptr - 10;
511 show_token_list(n, 0, 1000);
524 read(stdin, l); // ???
530 register integer for_end;
535 while(k++ < for_end);
540 font_in_short_display = 0;
545 panicking = !panicking;