int quitflag = 0;
boolean show_use = false;
-boolean floating = false;
void complainarg (int c, char *s)
{
boolean backwardflag = false; /* don't cripple all advanced features */
boolean shorten_file_name = false; /* don't shorten file names to 8+3 for DOS */
-boolean usesourcedirectory = true; /* use source file directory as local when WorkingDirectory is set */
/* cache to prevent allocating twice in a row */
/* returns allocated string -- these strings are not freed again */
/* is it safe to do that now ? 98/Jan/31 */
-char * grabenv (char * varname)
+char * grabenv (const char * varname)
{
char *s;
return NULL;
}
-void flush_trailing_slash (char *directory)
+void flush_trailing_slash(char * directory)
{
- char *s;
+ char * s;
if (strcmp(directory, "") != 0)
{
default_rule = 26214; /* revert to default rule thickness */
pseudo_tilde = false;
pseudo_space = false;
- show_texinput_flag = false;
truncate_long_lines = false;
allow_quoted_names = false;
show_cs_names = false;
- font_dimen_zero = false;
ignore_frozen = false;
suppress_f_ligs = false;
full_file_name_flag = false;
char * xchr_file = NULL;
char * repl_file = NULL;
-char * short_options = "m:e:h:0:H:g:P:o:l:a:wvpiKLZMdp2t?u";
+const char * short_options = "m:e:h:0:H:g:P:o:l:a:k:wvpiKLZMdp2t?u";
static struct option long_options[] =
{
- {"main-memory", 1, 0, 'm'},
- {"hyph-size", 1, 0, 'e'},
- {"trie-size", 1, 0, 'h'},
- {"backend", 1, 0, '0'},
- {"tab-step", 1, 0, 'H'},
- {"percent-grow", 1, 0, 'g'},
- {"default-rule", 1, 0, 'P'},
- {"dvi-dir", 1, 0, 'o'},
- {"log-dir", 1, 0, 'l'},
- {"aux-dir", 1, 0, 'a'},
- {"showhex", 0, 0, 'w'},
- {"verbose", 0, 0, 'v'},
- {"patterns", 0, 0, 'p'},
- {"initex", 0, 0, 'i'},
- {"knuthify", 0, 0, 'K'},
- {"cstyle", 0, 0, 'L'},
- {"showtfm", 0, 0, 'Z'},
- {"showmissing", 0, 0, 'M'},
- {"deslash", 0, 0, 'd'},
- {"patterns", 0, 0, 'p'},
- {"suppressflig", 0, 0, '2'},
- {"trace", 0, 0, 't'},
- {"help", 0, 0, '?'},
- {"usage", 0, 0, 'u'},
+ {"main-memory", required_argument, NULL, 'm'},
+ {"hyph-size", required_argument, NULL, 'e'},
+ {"trie-size", required_argument, NULL, 'h'},
+ {"backend", required_argument, NULL, '0'},
+ {"tab-step", required_argument, NULL, 'H'},
+ {"percent-grow", required_argument, NULL, 'g'},
+ {"default-rule", required_argument, NULL, 'P'},
+ {"dvi-dir", required_argument, NULL, 'o'},
+ {"log-dir", required_argument, NULL, 'l'},
+ {"aux-dir", required_argument, NULL, 'a'},
+ {"key-file", required_argument, NULL, 'k'},
+ {"showhex", no_argument, NULL, 'w'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"patterns", no_argument, NULL, 'p'},
+ {"initex", no_argument, NULL, 'i'},
+ {"knuthify", no_argument, NULL, 'K'},
+ {"cstyle", no_argument, NULL, 'L'},
+ {"showtfm", no_argument, NULL, 'Z'},
+ {"showmissing", no_argument, NULL, 'M'},
+ {"deslash", no_argument, NULL, 'd'},
+ {"patterns", no_argument, NULL, 'p'},
+ {"suppressflig", no_argument, NULL, '2'},
+ {"trace", no_argument, NULL, 't'},
+ {"help", no_argument, NULL, '?'},
+ {"usage", no_argument, NULL, 'u'},
{NULL, 0, 0, 0}
};
is_initex = true;
break;
case 'Q':
- interaction = batch_mode; /* quiet mode */
+ interaction = batch_mode;
break;
case 'R':
- interaction = nonstop_mode; /* run mode */
+ interaction = nonstop_mode;
break;
case 'S':
- interaction = scroll_mode; /* scroll mode */
+ interaction = scroll_mode;
break;
case 'T':
- interaction = error_stop_mode; /* tex mode */
+ interaction = error_stop_mode;
break;
case 'K':
backwardflag = true;
knuthify(); /* revert to `standard' Knuth TeX */
break;
case 'L':
- c_style_flag = true; /* C style error msg 94/Mar/21 */
+ c_style_flag = true;
break;
case 'Z':
- show_tfm_flag = true; /* show TFM in log file 94/Jun/21 */
+ show_tfm_flag = true;
break;
case 'M':
- show_missing = false; /* do not show missing 94/June/10 */
+ show_missing = false;
break;
case 'd':
deslash = false; /* flipped 93/Nov/18 */
case 'n':
restrict_to_ascii = true; /* 0 - 127 1994/Jan/21 */
break;
- case '7':
- usesourcedirectory = false; /* use working dir 98/Sep/29 */
- break;
case 'f':
show_fonts_used = false; /* 97/Dec/24 */
break;
case '4':
ignore_frozen = true; /* 98/Oct/5 */
break;
- case '5':
- font_dimen_zero = false; /* 98/Oct/5 */
- break;
- case 'F':
- show_texinput_flag = false; /* 98/Jan/28 */
- break;
-/* case 'X': truncate_long_lines = false; */ /* 98/Feb/2 */
- /* break; */
case 'J':
show_line_break_stats = false; /* 96/Feb/8 */
break;
if (tab_step == 0)
complainarg(c, optarg);
break;
+
case 'x':
if (optarg == 0)
xchr_file = xstrdup("xchr.map");
if (xchr_file == NULL || *xchr_file == '\0')
complainarg(c, optarg);
break;
+
case 'k':
if (optarg == 0)
repl_file = xstrdup("repl.key");
if (repl_file == NULL || *repl_file == '\0')
complainarg(c, optarg);
break;
+
case 'P':
if (optarg == 0)
default_rule = 26214;
if (default_rule == 0)
complainarg(c, optarg);
break;
+
case 'E':
if (optarg != 0)
putenv(optarg);
else
complainarg(c, optarg);
break;
+
case 'o':
if (optarg == 0)
dvi_directory = "";
complainarg(c, optarg);
break;
+
case '0':
{
char * format_spec = NULL;
printf("ERROR: Do not understand shipout flag `%s'\n", format_spec);
}
break;
+
case 'l':
if (optarg == 0)
log_directory = "";
else
optargnew = optarg;
- analyze_flag (c, optargnew);
+ analyze_flag(c, optargnew);
}
if (show_use || quitflag == 3)
stamp_it(log_line);
strcat(log_line, "\n");
show_line(log_line, 0);
- //stampcopy(log_line);
- //strcat(log_line, "\n");
- //show_line(log_line, 0);
if (show_use)
show_usage();
if (read_xchr_file(repl_file, 1, av))
{
if (trace_flag)
- puts("KEY REPLACE ON\n");
+ puts("KEY REPLACE ON");
key_replace = true;
}
if (read_xchr_file(xchr_file, 0, av))
{
if (trace_flag)
- puts("NON ASCII ON\n");
+ puts("NON ASCII ON");
non_ascii = true;
}
show_fmt_flag = true; /* show format file in log */
show_tfm_flag = false; /* don't show metric file in log */
shorten_file_name = false; /* don't shorten file names to 8+3 */
- show_texinput_flag = true; /* show TEXINPUTS and TEXFONTS */
truncate_long_lines = true; /* truncate long lines */
tab_step = 0; /* do not replace tabs with spaces */
show_line_break_stats = true; /* show line break statistics 96/Feb/8 */
mem_extra_low = 0;
mem_initex = 0;
format_name = "plain";
- encoding_name = "";
if (read_command_line(ac, av) < 0)
return -1;
#if defined(ALLOCATEHIGH) || defined(ALLOCATELOW)
if (mem_extra_high != 0 || mem_extra_low != 0)
{
- puts("ERROR: Cannot extend main memory in iniTeX\n");
- mem_extra_high = 0; mem_extra_low = 0;
+ puts("ERROR: Cannot extend main memory in iniTeX");
+ mem_extra_high = 0;
+ mem_extra_low = 0;
}
#endif
}
{
if (mem_initex != 0)
{
- puts("ERROR: Can only set initial main memory size in iniTeX\n");
+ puts("ERROR: Can only set initial main memory size in iniTeX");
mem_initex = 0;
}
if (trie_size != 0)
{
- puts("ERROR: Need only set hyphenation trie size in iniTeX\n");
+ puts("ERROR: Need only set hyphenation trie size in iniTeX");
/* trie_size = 0; */
}
}
if (trie_size == 0)
trie_size = default_trie_size;
+
/* Just in case user mistakenly specified words instead of kilo words */
if (mem_extra_high > 10000L * 1024L)
mem_extra_high = mem_extra_high / 1024;
if (mem_initex > 2048L * 1024L) /* extend main memory by 16 mega byte! */
{
- puts("WARNING: There may be no benefit to asking for so much memory\n");
+ puts("WARNING: There may be no benefit to asking for so much memory");
/* mem_initex = 2048 * 1024; */
}
if (new_hyphen_prime > 0)
{
if (! is_initex)
- puts("ERROR: Can only set hyphen prime in iniTeX\n");
+ puts("ERROR: Can only set hyphen prime in iniTeX");
else
{
if (new_hyphen_prime % 2 == 0)
percent_grow = 10; /* lower limit - 10% */
}
-/**********************************************************************/
-
-void perrormod (char *s)
+void perrormod (const char * s)
{
printf("`%s': %s\n", s, strerror(errno));
}
-/*************************************************************************/
-
/* convert tilde to pseudo_tilde to hide it from TeX --- 95/Sep/26 */
/* convert space to pseudo_space to hide it from TeX --- 97/Jun/5 */
/* called only if pseudo_tilde != 0 or pseudo_space != 0 */
{
if (deslash)
{
- if (trace_flag || debug_flag)
+ if (trace_flag)
printf("deslash: k %d argv[k] %s (argc %d)\n", optind, av[optind], ac);
unixify(av[optind]);
}
if (pseudo_tilde != 0 || pseudo_space != 0)
- hidetwiddle (av[optind]);
+ hidetwiddle(av[optind]);
if (*av[optind] == '&' || *av[optind] == '+')
{
{
if (deslash)
{
- if (trace_flag || debug_flag)
+ if (trace_flag)
printf("deslash: k %d argv[k] %s (argc %d)\n", optind + 1, av[optind + 1], ac);
unixify(av[optind + 1]);
}
if (pseudo_tilde != 0 || pseudo_space != 0)
- hidetwiddle (av[optind + 1]);
+ hidetwiddle(av[optind + 1]);
}
}
}
#ifdef ALLOCATEBUFFER
buffer = NULL;
current_buf_size = 0;
- buffer = realloc_buffer (initial_buf_size);
+ buffer = realloc_buffer(initial_buf_size);
#endif
hyph_list = NULL;
log_opened = false; /* so can tell whether opened */
interaction = -1; /* default state => 3 */
missing_characters = 0; /* none yet! */
- font_dimen_zero = true; /* \fontdimen0 for checksum 98/Oct/5 */
ignore_frozen = false; /* default is not to ignore 98/Oct/5 */
suppress_f_ligs = false; /* default is not to ignore f-ligs */
};
/* Read a line of input as quickly as possible. */
-extern boolean input_line (FILE *);
+extern boolean input_line (FILE * f);
#define input_ln(stream, flag) input_line(stream)
-
-#define b_open_in(f) open_input (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
-#define w_open_in(f) open_input (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
-#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
-#define w_open_out b_open_out
-#define b_close a_close
-#define w_close a_close
-#define gz_w_close gzclose
-
-/* sec 0241 */
-extern void fix_date_and_time(void);
+/* sec 0027 */
+#define a_open_in(f, p) open_input (&(f), p, FOPEN_R_MODE)
+#define a_open_out(f) open_output (&(f), FOPEN_W_MODE)
+#define b_open_in(f) open_input (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
+#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
+#define w_open_in(f) open_input (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
+#define w_open_out b_open_out
+#define a_close(f) (void) check_fclose(f)
+#define b_close a_close
+#define w_close a_close
+#define gz_w_close gzclose
/* If we're running under Unix, use system calls instead of standard I/O
to read and write the output files; also, be able to make a core dump. */
#endif
#ifdef COMPACTFORMAT
-extern int do_dump (char *, int, int, gzFile);
-extern int do_undump (char *, int, int, gzFile);
+extern int do_dump (char * p, int item_size, int nitems, gzFile out_file);
+extern int do_undump (char * p, int item_size, int nitems, gzFile out_file);
#define dump_file gz_fmt_file
#else
-extern int do_dump (char *, int, int, FILE *);
-extern int do_undump (char *, int, int, FILE *);
+extern int do_dump (char * p, int item_size, int nitems, FILE * out_file);
+extern int do_undump (char * p, int item_size, int nitems, FILE * out_file);
#define dump_file fmt_file
#endif
#define undumpthings(base, len) \
do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
-/* Use the above for all the other dumping and undumping. */
+/* Use the above for all the other dumping and undumping. */
#define generic_dump(x) dumpthings(x, 1)
#define generic_undump(x) undumpthings(x, 1)