if (cs_token_flag + undefined_control_sequence > max_halfword)
bad = 21;
- if (format_default_length > PATHMAX)
+ if (format_default_length > PATH_MAX)
bad = 31;
if (max_halfword < (mem_top - mem_min) / 2)
format_spec = xstrdup(optarg);
if (!strcmp(format_spec, "pdf"))
- pdf_output_flag = true;
+ pdf_output_flag = out_pdf_flag;
else if (!strcmp(format_spec, "dvi"))
- pdf_output_flag = false;
+ pdf_output_flag = out_dvi_flag;
+ else if (!strcmp(format_spec, "xdv"))
+ pdf_output_flag = out_xdv_flag;
else
{
sprintf(log_line, "ERROR: Do not understand argument value `%s'\n", format_spec);
int init_commands (int ac, char **av)
{
- pdf_output_flag = false;
+ pdf_output_flag = out_dvi_flag;
is_initex = false;
allow_patterns = false;
reset_exceptions = false;
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
- if (k < PATHMAX)
+ if (k < PATH_MAX)
name_length = k;
else
- name_length = PATHMAX - 1;
+ name_length = PATH_MAX - 1;
/* pad it out with spaces ... what for ? in case we modify and forget ? */
- for (k = name_length + 1; k <= PATHMAX; k++)
+ for (k = name_length + 1; k <= PATH_MAX; k++)
name_of_file[k] = ' ';
- name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
+ name_of_file[PATH_MAX] = '\0'; /* paranoia 94/Mar/24 */
{
name_of_file [name_length+1] = '\0';
ASCII_code c;
integer j;
- if (n + b - a + 5 > PATHMAX)
- b = a + PATHMAX - n - 5;
+ if (n + b - a + 5 > PATH_MAX)
+ b = a + PATH_MAX - n - 5;
k = 0;
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
/* This loop kicks in when we want a specififed format name */
c = buffer[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
- if (k < PATHMAX)
+ if (k < PATH_MAX)
name_length = k;
else
- name_length = PATHMAX - 1;
+ name_length = PATH_MAX - 1;
/* pad it out with spaces ... what for ? */
- for (k = name_length + 1; k <= PATHMAX; k++)
+ for (k = name_length + 1; k <= PATH_MAX; k++)
name_of_file[k]= ' ';
- name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
+ name_of_file[PATH_MAX] = '\0'; /* paranoia 94/Mar/24 */
}
/* sec 0525 */
str_number make_name_string (void)
if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
- if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
+ if ((cur_ext != 785) && (name_length + 5 < PATH_MAX))
{
name_of_file[name_length + 1] = '.';
name_of_file[name_length + 2] = 't';
}
void ship_out_(halfword p)
{
- if (pdf_output_flag)
- pdf_ship_out(p);
- else
- dvi_ship_out_(p);
+ switch (pdf_output_flag)
+ {
+ case out_pdf_flag:
+ pdf_ship_out(p);
+ break;
+ case out_dvi_flag:
+ case out_xdv_flag:
+ dvi_ship_out_(p);
+ break;
+ }
}
/* sec 0645 */
void scan_spec_(group_code c, boolean three_codes)
if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
read_open[n] = 1;
- else if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
+ else if ((cur_ext != 785) && (name_length + 5 < PATH_MAX))
{
strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
name_length = name_length + 4;
} /* end of if (log_opened) */
#endif /* STAT */
- if (pdf_output_flag)
+ switch (pdf_output_flag)
{
- if (total_pages == 0)
- {
- print_nl("No pages of output.");
- }
- else
- {
- HPDF_SaveToFile(yandy_pdf, pdf_file_name);
-
- print_nl("Output written on ");
-
- if (full_file_name_flag && pdf_file_name != NULL)
- print_char_string((unsigned char *) pdf_file_name);
- else
- slow_print(output_file_name);
-
- print_string(" (");
- print_int(total_pages);
- print_string(" page");
-
- if (total_pages != 1)
- print_char('s');
-
- //print_string(", ");
- //print_int(dvi_offset + dvi_ptr);
- //print_int(yandy_pdf->mmgr->mpool->used_size);
- //print_string(" bytes).");
- print_string(").");
- b_close(dvi_file);
- }
-
- HPDF_Free(yandy_pdf);
- font_name_hash_free(gentbl);
- }
- else
- {
- while (cur_s > -1)
- {
- if (cur_s > 0)
- dvi_out(142);
- else
+ case out_pdf_flag:
{
- dvi_out(eop);
- incr(total_pages);
- }
-
- decr(cur_s);
- }
-
- if (total_pages == 0)
- print_nl("No pages of output.");
- else
- {
- dvi_out(post);
- dvi_four(last_bop);
- last_bop = dvi_offset + dvi_ptr - 5;
- dvi_four(25400000L);
- dvi_four(473628672L);
- prepare_mag();
- dvi_four(mag);
- dvi_four(max_v);
- dvi_four(max_h);
- dvi_out(max_push / 256);
- dvi_out(max_push % 256);
-
- if (total_pages >= 65536) // 99/Oct/10 dvi_t 16 bit problem
- {
- sprintf(log_line, "\nWARNING: page count (dvi_t) in DVI file will be %ld not %ld\n",
- (total_pages % 65536), total_pages);
-
- if (log_opened)
- (void) fputs (log_line, log_file);
-
- show_line(log_line, 1);
- }
+ if (total_pages == 0)
+ {
+ print_nl("No pages of output.");
+ }
+ else
+ {
+ HPDF_SaveToFile(yandy_pdf, pdf_file_name);
+
+ print_nl("Output written on ");
- dvi_out((total_pages / 256) % 256);
- dvi_out(total_pages % 256);
+ if (full_file_name_flag && pdf_file_name != NULL)
+ print_char_string((unsigned char *) pdf_file_name);
+ else
+ slow_print(output_file_name);
- if (show_fonts_used && log_opened) /* 97/Dec/24 */
- show_font_info(); // now in local.c
+ print_string(" (");
+ print_int(total_pages);
+ print_string(" page");
- while (font_ptr > 0)
- {
- if (font_used[font_ptr])
- dvi_font_def(font_ptr);
+ if (total_pages != 1)
+ print_char('s');
+
+ print_string(").");
+ }
- decr(font_ptr);
+ HPDF_Free(yandy_pdf);
+ font_name_hash_free(gentbl);
}
-
- dvi_out(post_post);
- dvi_four(last_bop);
- dvi_out(id_byte);
- k = 4 + ((dvi_buf_size - dvi_ptr) % 4);
-
- while (k > 0)
+ break;
+ case out_dvi_flag:
+ case out_xdv_flag:
{
- dvi_out(223);
- decr(k);
- }
+ while (cur_s > -1)
+ {
+ if (cur_s > 0)
+ dvi_out(142);
+ else
+ {
+ dvi_out(eop);
+ incr(total_pages);
+ }
+
+ decr(cur_s);
+ }
- if (trace_flag) /* 93/Dec/28 - bkph */
- {
- sprintf(log_line, "\ndviwrite %d", dvi_gone);
- show_line(log_line, 0);
+ if (total_pages == 0)
+ print_nl("No pages of output.");
+ else
+ {
+ dvi_out(post);
+ dvi_four(last_bop);
+ last_bop = dvi_offset + dvi_ptr - 5;
+ dvi_four(25400000L);
+ dvi_four(473628672L);
+ prepare_mag();
+ dvi_four(mag);
+ dvi_four(max_v);
+ dvi_four(max_h);
+ dvi_out(max_push / 256);
+ dvi_out(max_push % 256);
+
+ if (total_pages >= 65536) // 99/Oct/10 dvi_t 16 bit problem
+ {
+ sprintf(log_line, "\nWARNING: page count (dvi_t) in DVI file will be %ld not %ld\n",
+ (total_pages % 65536), total_pages);
+
+ if (log_opened)
+ (void) fputs (log_line, log_file);
+
+ show_line(log_line, 1);
+ }
+
+ dvi_out((total_pages / 256) % 256);
+ dvi_out(total_pages % 256);
+
+ if (show_fonts_used && log_opened) /* 97/Dec/24 */
+ show_font_info(); // now in local.c
+
+ while (font_ptr > 0)
+ {
+ if (font_used[font_ptr])
+ dvi_font_def(font_ptr);
+
+ decr(font_ptr);
+ }
+
+ dvi_out(post_post);
+ dvi_four(last_bop);
+ dvi_out(id_byte);
+ k = 4 + ((dvi_buf_size - dvi_ptr) % 4);
+
+ while (k > 0)
+ {
+ dvi_out(223);
+ decr(k);
+ }
+
+ if (trace_flag) /* 93/Dec/28 - bkph */
+ {
+ sprintf(log_line, "\ndviwrite %d", dvi_gone);
+ show_line(log_line, 0);
+ }
+
+ if (dvi_limit == half_buf)
+ write_dvi(half_buf, dvi_buf_size - 1);
+
+ if (dvi_ptr > 0)
+ write_dvi(0, dvi_ptr - 1);
+
+ print_nl("Output written on ");
+
+ if (full_file_name_flag && dvi_file_name != NULL)
+ print_char_string((unsigned char *) dvi_file_name);
+ else
+ slow_print(output_file_name);
+
+ print_string(" (");
+ print_int(total_pages);
+ print_string(" page");
+
+ if (total_pages != 1)
+ print_char('s');
+
+ print_string(", ");
+ print_int(dvi_offset + dvi_ptr);
+ print_string(" bytes).");
+ b_close(dvi_file);
+ }
}
-
- if (dvi_limit == half_buf)
- write_dvi(half_buf, dvi_buf_size - 1);
-
- if (dvi_ptr > 0)
- write_dvi(0, dvi_ptr - 1);
-
- print_nl("Output written on ");
-
- if (full_file_name_flag && dvi_file_name != NULL)
- print_char_string((unsigned char *) dvi_file_name);
- else
- slow_print(output_file_name);
-
- print_string(" (");
- print_int(total_pages);
- print_string(" page");
-
- if (total_pages != 1)
- print_char('s');
-
- print_string(", ");
- print_int(dvi_offset + dvi_ptr);
- print_string(" bytes).");
- b_close(dvi_file);
- }
+ break;
}
if (log_opened)
/* also: should split use of quarterword for (i) font from (ii) char */
/* for example, xeq_level ? hyphenation trie_trc ? */
#define INCREASEFONTS
-/* make font_info array fmemoryword == 32 bit instead of memory_word = 64 bit */
#define SHORTFONTINFO
-/* make hash table htwo_halves == 32 bit instead of two_halves == 64 bit */
-/* increase trie_op_size from 751 to 3001 96/Oct/12 */
#define INCREASETRIEOP
#define COMPACTFORMAT
#define block_size 1000 /* block_size for variable length node alloc */
-/* min_quarterword assumed 0 -- i.e. we use unsigned types for quarterword */
#define min_quarterword 0
#ifdef INCREASEFONTS
#define max_quarterword 65535L
#define dvi_buf_size 16384
#endif
-/* #define hash_size 9500 */
-/* #define hash_size 25000 */
-#define hash_size 32768
-/* trick to try and get around eqtb_extra problem */
+#define hash_size 32768 // 9500 25000
#define hash_extra (255 - font_max)
-/* hash prime about 85% of hash_size (+ hash_extra) */
#define hash_prime 27197
#if (hash_extra != 255 - font_max)
EXTERN integer bad;
EXTERN ASCII_code xord[256];
EXTERN ASCII_code xchr[256];
-EXTERN unsigned char name_of_file[PATHMAX + 4];
+EXTERN unsigned char name_of_file[PATH_MAX + 4];
EXTERN integer name_length;
#ifdef ALLOCATESTRING
#include "yandytex.h"
-#ifdef _MSC_VER
- #define INLINE __inline
-#else
- #define INLINE inline
-#endif
+enum {
+ out_dvi_flag = (1 << 0),
+ out_pdf_flag = (1 << 1),
+ out_xdv_flag = (1 << 2),
+};
+
+#define INLINE inline
#define dump_file fmt_file
#define out_file dvi_file
-/* File types. */
-typedef FILE * byte_file;
-typedef FILE * word_file;
-
/* Read a line of input as quickly as possible. */
extern boolean input_line (FILE *);
#define input_ln(stream, flag) input_line(stream)
/* these, of course are useless definitions since parameters not given */
/* Declare routines in texmf.c. */
-extern void get_date_and_time();
-extern void t_open_in();
-extern boolean input_line();
+extern void t_open_in();
\ No newline at end of file
extern char * replacement[];
/* The main program, etc. */
+/* What we were invoked as and with. */
-/* What we were invoked as and with. */
static char *program_name = NULL;
int gargc; /* number of args - set to zero after initialization */
char **gargv; /* char *gargv[] -- bkph ? */
int jump_used = 0;
-jmp_buf jumpbuffer; // for non-local jumps
+jmp_buf jumpbuffer;
int main (int ac, char *av[])
{
}
}
-/* I/O for TeX and Metafont. */ /* give file name ? */
-
+/* I/O for TeX and Metafont. */
void complain_line (FILE *output)
{
show_line("\n", 0);
return input_line_finish();
}
-\f
/* This string specifies what the `e' option does in response to an
- error message. */
+ error message. */
static char *edit_value = "c:\\yandy\\WinEdt\\WinEdt.exe [Open('%s');SelLine(%d,7)]";
uexit(1);
}
-\f
/* Read and write format (for TeX) or base (for Metafont) files. In
tex.web, these files are architecture dependent; specifically,
BigEndian and LittleEndian architectures produce different files.
return 0;
}
-\f
#ifdef FUNNY_CORE_DUMP
/* This procedure is due to chris@mimsy.umd.edu. It makes a core dump
without any sort of error status (abort(2) does return an error status,
exit (1);
}
}
-#endif /* FUNNY_CORE_DUMP */
\ No newline at end of file
+#endif /* FUNNY_CORE_DUMP */
typedef long long integer;
typedef double glue_ratio;
typedef double real;
-typedef FILE * alpha_file;
+typedef FILE * alpha_file;
+typedef FILE * byte_file;
+typedef FILE * word_file;
typedef unsigned char ASCII_code;
typedef unsigned short KANJI_code;
typedef unsigned char eight_bits;
#define decr(x) --(x)
#define incr(x) ++(x)
#define fabs(x) ((x) >= 0.0 ? (x) : -(x))
-#define PATHMAX PATH_MAX
#define toint(x) ((integer) (x))
#define a_open_in(f, p) open_input (&(f), p, FOPEN_R_MODE)
#define a_open_out(f) open_output (&(f), FOPEN_W_MODE)