type cast.
succmb().
fixed glue values: 65535->unity.
write_dvi: macro -> inline function.
removed abort_flag.
objects = yandytex.o itex.o openinou.o subroute.o local.o \
tex0.o tex1.o tex2.o tex3.o tex4.o \
tex5.o tex6.o tex7.o tex8.o tex9.o \
- yandy_pool.o md5.o yandy_backend_pdf.o
+ yandy_pool.o md5.o yandy_inlines.o
headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h
md5.o: libmd5/md5.c $(headers)
$(CC) -c $(CFLAGS) libmd5/md5.c
-yandy_backend_pdf.o: yandy_backend_pdf.c $(headers)
- $(CC) -c $(CFLAGS) yandy_backend_pdf.c
+yandy_inlines.o: yandy_inlines.c $(headers)
+ $(CC) -c $(CFLAGS) yandy_inlines.c
.PHONY: clean
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
-void print_err (const char * s);
void initialize (void);
void print_ln (void);
void print_char_(ASCII_code);
mode = 1;
head = contrib_head;
tail = contrib_head;
- cur_list.aux_field.cint = ignore_depth;
+ prev_depth = ignore_depth;
mode_line = 0;
prev_graf = 0;
shown_mode = 0;
printf("%s%s%ld\n", "Ouch---my internal constants have been clobbered!",
"---case ", (long) bad);
- goto lab9999;
+ goto final_end;
}
initialize();
if (is_initex)
{
if (!get_strings_started())
- goto lab9999;
+ goto final_end;
init_prim();
init_str_ptr = str_ptr;
#ifdef _WIN32
#ifdef _WIN64
- printf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
+ printf(" (%s %s/Win64)", application, yandyversion);
#else
- printf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
+ printf(" (%s %s/Win32)", application, yandyversion);
#endif
#else
- printf(log_line, " (%s %s/Linux)", application, yandyversion);
+ printf(" (%s %s/Linux)", application, yandyversion);
#endif
if (format_ident > 0)
align_state = 1000000L;
if (!init_terminal())
- goto lab9999;
+ goto final_end;
limit = last;
first = last + 1;
}
- if ((format_ident == 0) ||
- (buffer[loc] == '&') ||
- (buffer[loc] == '+'))
+ if ((format_ident == 0) || (buffer[loc] == '&') ||
+ (buffer[loc] == '+'))
{
if (format_ident != 0)
initialize();
if (!open_fmt_file ())
- goto lab9999;
+ goto final_end;
if (!load_fmt_file ())
{
#else
w_close(fmt_file);
#endif
- goto lab9999;
+ goto final_end;
}
#ifdef COMPACTFORMAT
w_close(fmt_file);
#endif
- while ((loc < limit) &&
- (buffer[loc] == ' '))
+ while ((loc < limit) && (buffer[loc] == ' '))
incr(loc);
}
else
selector = term_only;
- if ((loc < limit) &&
- (cat_code(buffer[loc]) != escape))
+ if ((loc < limit) && (cat_code(buffer[loc]) != escape))
start_input();
}
final_cleanup();
close_files_and_terminate();
-lab9999:
+final_end:
{
int code;
if (mem_min < mem_start) /* sanity test */
{
if (trace_flag)
- puts("WARNING: mem_min < mem_start!\n");
+ puts("WARNING: mem_min < mem_start!");
mem_min = mem_start;
}
}
#endif
-/**************************************************************************/
-
#ifdef INITEX
/* split out to allow sharing of code from do_initex and newpattern */
void reset_trie (void)
{
integer k;
- for (k = - (integer) trie_op_size; k <= trie_op_size; k++)
+ for (k = -(integer)trie_op_size; k <= trie_op_size; k++)
trie_op_hash[k] = 0;
for (k = 0; k <= 255; k++)
trie_not_ready = true;
}
/* borrowed code from initialize() */
-void reset_hyphen (void)
+void reset_hyphen(void)
{
hyph_pointer z;
k = k + glue_spec_size;
}
- stretch(fil_glue) = 65535L;
+ stretch(fil_glue) = unity;
stretch_order(fil_glue) = fil;
- stretch(fill_glue) = 65535L;
+ stretch(fill_glue) = unity;
stretch_order(fill_glue) = fill;
- stretch(ss_glue) = 65535L;
+ stretch(ss_glue) = unity;
stretch_order(ss_glue) = fil;
- shrink(ss_glue) = 65535L;
+ shrink(ss_glue) = unity;
shrink_order(ss_glue) = fil;
- stretch(fil_neg_glue) = -65536L;
+ stretch(fil_neg_glue) = -unity;
stretch_order(fil_neg_glue) = fil;
rover = lo_mem_stat_max + 1;
link(rover) = empty_flag;
link(mem_top) = page_ins_head;
type(page_head) = glue_node;
subtype(page_head) = normal;
- avail = 0; /* avail <- null p.164 */
+ avail = 0;
mem_end = mem_top;
hi_mem_min = hi_mem_stat_min;
var_used = lo_mem_stat_max + 1 - mem_bot;
{
overflow("pattern memory", trie_size);
/* not dynamic ---- but can be set -h=... from command line in ini-TeX */
- return; // abort_flag set
+ return;
}
do
if (!knuth_flag)
puts(" (Use -i on the command line)\n");
- abort_flag++;
return;
}
{
(void) flag;
- if (test_align ((int) eqtb, sizeof(eqtb[0]), "ALLOCATED ALIGNMENT"))
+ if (test_align((int) eqtb, sizeof(eqtb[0]), "ALLOCATED ALIGNMENT"))
puts("PLEASE RECOMPILE ME!\n");
#ifdef CHECKALIGNMENT
knuth_flag = false; /* allow extensions to TeX */
full_file_name_flag = true; /* new default 2000 June 18 */
errout = stdout; /* as opposed to stderr say --- used ??? */
- abort_flag = 0; // not yet hooked up ???
- err_level = 0; // not yet hooked up ???
new_hyphen_prime = 0;
#ifdef VARIABLETRIESIZE
s = buffer + strlen(buffer) - 1;
- if (*s == '\\' || *s == '/') *s = '\0'; /* flush trailing PATH_SEP */
+ if (*s == '\\' || *s == '/')
+ *s = '\0';
texpath = xstrdup(buffer);
-/* Hmm, we may be operating on DOS environment variables here !!! */
-
if (strcmp(dvi_directory, "") != 0)
- flush_trailing_slash (dvi_directory);
+ flush_trailing_slash(dvi_directory);
if (strcmp(log_directory, "") != 0)
- flush_trailing_slash (log_directory);
+ flush_trailing_slash(log_directory);
if (strcmp(aux_directory, "") != 0)
- flush_trailing_slash (aux_directory);
+ flush_trailing_slash(aux_directory);
if (strcmp(fmt_directory, "") != 0)
- flush_trailing_slash (fmt_directory);
+ flush_trailing_slash(fmt_directory);
if (strcmp(pdf_directory, "") != 0)
- flush_trailing_slash (pdf_directory);
+ flush_trailing_slash(pdf_directory);
if (deslash)
{
}
format_spec = 0;
-/* NOTE: assuming that command line arguments are in writable memory ! */
-/* if (trace_flag || debug_flag)
- sprintf(log_line, "optind %d ac %d\n", optind, ac); */ /* debugging */
-/* if (optind < ac) { */ /* bkph */
+
if (optind < ac && optind > 0)
{
if (deslash)
if (pseudo_tilde != 0 || pseudo_space != 0)
hidetwiddle (av[optind]);
- /* For Windows NT, lets allow + instead of & for format specification */
if (*av[optind] == '&' || *av[optind] == '+')
{
format_spec = 1;
xputenv("engine", "yandytex");
if (sizeof(memory_word) != sizeof(halfword) * 2)
- {
- sprintf(log_line, "ERROR: Bad word size %d!\n", sizeof(memory_word));
- show_line(log_line, 1);
- }
+ printf("ERROR: Bad word size %d!\n", sizeof(memory_word));
start_time = clock();
main_time = start_time;
closed_already = 0;
if (trace_flag)
- puts("Entering init (local.c)\n");
+ puts("Entering init (local.c)");
- probe_memory(); /* show top address */
- ini_max_address = max_address; /* initial max address */
+ probe_memory();
+ ini_max_address = max_address;
if (trace_flag)
show_maximums(stdout);
if (allocate_memory() != 0)
return -1;
- /* following is more or less useless since most all things not yet alloc */
- check_alloc_align(trace_flag); /* sanity check 1994/Jan/8 */
+ check_alloc_align(trace_flag);
if (trace_flag)
- show_line("Leaving init (local.c)\n", 0);
+ puts("Leaving init (local.c)");
return 0;
}
tenths = (inter_val * 10 + CLK_TCK / 2) / CLK_TCK;
seconds = tenths / 10;
tenths = tenths % 10;
- sprintf(log_line, "%d.%d", seconds, tenths);
- show_line(log_line, 0);
+ printf("%d.%d", seconds, tenths);
+ }
+ else if (inter_val >= CLK_TCK)
+ {
+ hundredth = (inter_val * 100 + CLK_TCK / 2) / CLK_TCK;
+ seconds = hundredth / 100;
+ hundredth = hundredth % 100;
+ printf("%d.%02d", seconds, hundredth);
+ }
+ else if (inter_val > 0)
+ {
+ thousands = (inter_val * 1000 + CLK_TCK / 2) / CLK_TCK;
+ seconds = thousands / 1000;
+ thousands = thousands % 1000;
+ printf("%d.%03d", seconds, thousands);
}
else
- if (inter_val >= CLK_TCK) /* 94/Feb/25 */
- {
- hundredth = (inter_val * 100 + CLK_TCK / 2) / CLK_TCK;
- seconds = hundredth / 100;
- hundredth = hundredth % 100;
- sprintf(log_line, "%d.%02d", seconds, hundredth);
- show_line(log_line, 0);
- }
- else
- if (inter_val > 0) /* 94/Oct/4 */
- {
- thousands = (inter_val * 1000 + CLK_TCK / 2) / CLK_TCK;
- seconds = thousands / 1000;
- thousands = thousands % 1000;
- sprintf(log_line, "%d.%03d", seconds, thousands);
- show_line(log_line, 0);
- }
- else
- show_line("0", 0);
+ show_line("0", 0);
}
-int endit (int flag)
+int endit(int flag)
{
finish_time = clock();
if (verbose_flag)
{
- puts("Total ");
+ printf("Total ");
show_inter_val(finish_time - start_time);
- puts(" sec (");
+ printf(" sec (");
show_inter_val(main_time - start_time);
- puts(" format load + ");
+ printf(" format load + ");
show_inter_val(finish_time - main_time);
- puts(" processing) ");
+ printf(" processing) ");
if (total_pages > 0)
{
show_inter_val((finish_time - main_time) / total_pages);
- puts(" sec per page.");
+ printf(" sec per page.");
}
-
- puts("\n");
}
return flag;
}
}
-/***************** font info listing moved from TEX9.C ******************/
-/* compare two strings in str_pool (not null terminated) */
/* k1 and k2 are positions in string pool */
/* l1 and l2 are lengths of strings */
int compare_strn (int k1, int l1, int k2, int l2)
return (pt);
}
-// Shows list of fonts in log file
void dvi_font_show(internal_font_number f, int suppressname)
{
int a, l, k, n;
if (fcount == 0)
return;
- fnumtable = (short *) malloc (fcount * sizeof(short));
+ fnumtable = (short *) malloc(fcount * sizeof(short));
fprintf(log_file, "\nUsed %d font%s:\n", fcount, (fcount == 1) ? "" : "s");
if (font_used[k])
fnumtable[fcount++] = (short) k;
- qsort ((void *)fnumtable, fcount, sizeof (short), &compare_fnt);
+ qsort ((void *)fnumtable, fcount, sizeof(short), &compare_fnt);
repeatflag = 0;
LINK = link
RC = rc
-# -Gf saves about 7k bytes in EXE file
-
-# For production (-Bd show compiler passes)
-# ASSUMING WE WORK WITH MS COMPILER AND LINKER ONLY use -Gy and -Gf
-# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -Ox -Gy -Gf -W3
-# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -YX -Ox -Ge -Gy -Gf -W4
-# Release version
-# CFLAGS=/c /Ge /Gy /Gf /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG /Ilib /YX
CFLAGS=/nologo /c /MT /GF /Gy /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG \
/I"kpathsea" /I"zlib" /I"libmd5"
-# Debugging version
-# CFLAGS=/c /Ge /Gy /Gf /Od /Zi /W4 /DMSDOS /DTeX /DPHARLAP /Ilib /YX
-
-# NOTE: -Ox => -Ogityb1 -Gs
# Link with MS LINK
# LFLAGS=@yandytex.nt /MAP lib\libdos.lib
objs = yandytex.obj itex.obj openinou.obj subroute.obj local.obj \
tex0.obj tex1.obj tex2.obj tex3.obj tex4.obj \
tex5.obj tex6.obj tex7.obj tex8.obj tex9.obj \
- yandy_pool.obj yandytex.res md5.obj
+ yandy_pool.obj yandytex.res md5.obj yandy_inlines.obj
# ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
yandytex.exe: $(objs)
$(LINK) $(LFLAGS) yandytex itex openinou subroute local \
tex0 tex1 tex2 tex3 tex4 tex5 tex6 tex7 tex8 tex9 \
- yandy_pool yandytex.res md5 \
+ yandy_pool yandytex.res md5 yandy_inlines\
kpathsea\kpathsea.lib libpng\libpng.lib zlib\zlib.lib \
dvipdfmx\libdvipdfmx.lib
del ..\yandy\bin\yandytex.exe
yandy_pool.obj: yandy_pool.c \
texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+yandy_inlines.obj: yandy_inlines.c \
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
+
.SUFFIXES:
.SUFFIXES: .obj .c
#include "texd.h"
+extern char * dvi_directory;
+extern char * log_directory;
+extern char * aux_directory;
+extern char * fmt_directory;
+extern char * pdf_directory;
+
#define PATH_SEP '/'
#define PATH_SEP_STRING "/"
}
#endif
-// separated out 1996/Jan/20 to make easier to read
// assumes path does not end in PATH_SEP
void patch_in_path (unsigned char *buffer, unsigned char *name, unsigned char *path)
{
retwiddle(name_of_file + 1);
if (shorten_file_name)
- {
check_short_name(name_of_file + 1);
- }
if (open_trace_flag)
{
return openable;
}
-/* Call the external program PROGRAM, passing it `name_of_file'. */
-/* This nonsense probably only works for Unix anyway. bkph */
-/* For one thing, MakeTeXTFM etc is more than 8 characters ! */
-
-extern char * dvi_directory;
-extern char * log_directory;
-extern char * aux_directory;
-extern char * fmt_directory;
-extern char * pdf_directory;
-
/* At least check for I/O error (such as disk full) when closing */
/* Would be better to check while writing - but this is better than nothing */
/* This is used for both input and output files, but never mind ... */
prepend_path_if(name_of_file + 1, name_of_file + 1, ".pdf", (unsigned char *) pdf_directory))
{
if (open_trace_flag)
- {
- sprintf(log_line, "After prepend %s\n", name_of_file + 1);
- show_line(log_line, 0);
- }
+ printf("After prepend %s\n", name_of_file + 1);
}
if (open_trace_flag)
- {
- sprintf(log_line, " Open `%s' for output ", name_of_file + 1);
- show_line(log_line, 0);
- }
+ printf(" Open `%s' for output ", name_of_file + 1);
-/* but we can assume this is opening here for *output* */
*f = fopen((char *) name_of_file + 1, fopen_mode);
/* Can't open as given. Try the envvar. */
#ifdef COMPACTFORMAT
if (strstr((char *) name_of_file + 1, ".fmt") != NULL)
- {
gz_fmt_file = gzdopen(fileno(*f), "wb9");
- }
#endif
if (strstr((char *) name_of_file + 1, ".dvi") != NULL)
if (*f)
name_length = temp_length;
- return *f != NULL;
+ return (*f != NULL);
}
\ No newline at end of file
}
if (trace_flag)
- {
printf("Unixified name: %s\n", t);
- //sprintf(log_line, "Unixified name: %s\n", t);
- //show_line(log_line, 0);
- }
return t;
}
#include "texd.h"
-INLINE void prompt_input(const char * s)
-{
- print_string(s);
- term_input();
-}
-INLINE void synch_h(void)
-{
- if (cur_h != dvi_h)
- {
- movement(cur_h - dvi_h, right1);
- dvi_h = cur_h;
- }
-}
-INLINE void synch_v(void)
-{
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, down1);
- dvi_v = cur_v;
- }
-}
-INLINE void set_cur_lang(void)
-{
- if (language <= 0)
- cur_lang = 0;
- else if (language > 255)
- cur_lang = 0;
- else
- cur_lang = language;
-}
-INLINE void free_avail_(halfword p)
-{
- link(p) = avail;
- avail = p;
-#ifdef STAT
- decr(dyn_used);
-#endif /* STAT */
-}
-INLINE void dvi_out_(ASCII_code op)
-{
- dvi_buf[dvi_ptr] = op;
- incr(dvi_ptr);
-
- if (dvi_ptr == dvi_limit)
- dvi_swap();
-}
-INLINE void succumb (void)
-{
- if (interaction == error_stop_mode)
- interaction = scroll_mode;
-
- if (log_opened)
- {
- error();
- }
-
-#ifdef DEBUG
- if (interaction > 0)
- debug_help();
-#endif
-
- history = 3;
- jump_out();
-}
-INLINE void flush_string (void)
-{
- decr(str_ptr);
- pool_ptr = str_start[str_ptr];
-}
-INLINE void append_char (ASCII_code c)
-{
- str_pool[pool_ptr] = c;
- incr(pool_ptr);
-}
-INLINE void append_lc_hex (ASCII_code c)
-{
- if (c < 10)
- append_char(c + '0');
- else
- append_char(c - 10 + 'a');
-}
-INLINE void print_err (const char * s)
-{
- if (interaction == error_stop_mode);
- print_nl("! ");
- print_string(s);
-}
-INLINE void tex_help (unsigned int n, ...)
-{
- int i;
- va_list help_arg;
-
- if (n > 6)
- n = 6;
-
- help_ptr = n;
- va_start(help_arg, n);
-
- for (i = n - 1; i > -1; --i)
- help_line[i] = va_arg(help_arg, char *);
-
- va_end(help_arg);
-}
-INLINE void str_room_ (int val)
-{
-#ifdef ALLOCATESTRING
- if (pool_ptr + val > current_pool_size)
- str_pool = realloc_str_pool(increment_pool_size);
-
- if (pool_ptr + val > current_pool_size)
- {
- overflow("pool size", current_pool_size - init_pool_ptr);
- }
-#else
- if (pool_ptr + val > pool_size)
- {
- overflow("pool size", pool_size - init_pool_ptr);
- }
-#endif
-}
-INLINE void tail_append_ (pointer val)
-{
- link(tail) = val;
- tail = link(tail);
-}
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* sec 0058 */
void print_ln (void)
{
case term_and_log:
show_char('\n');
term_offset = 0;
- (void) putc ('\n', log_file);
+ (void) putc('\n', log_file);
file_offset = 0;
break;
case log_only:
- (void) putc ('\n', log_file);
+ (void) putc('\n', log_file);
file_offset = 0;
break;
break;
default:
- (void) putc ('\n', write_file[selector]);
+ (void) putc('\n', write_file[selector]);
break;
}
}
void print_char_ (ASCII_code s)
{
if (s == new_line_char)
- {
if (selector < pseudo)
{
print_ln();
return;
}
- }
switch (selector)
{
if (pool_ptr < current_pool_size)
{
- str_pool[pool_ptr]= s;
+ str_pool[pool_ptr] = s;
incr(pool_ptr);
}
#else
if (pool_ptr < pool_size)
{
- str_pool[pool_ptr]= s;
+ str_pool[pool_ptr] = s;
incr(pool_ptr);
}
#endif
nl = new_line_char;
new_line_char = -1;
-/* translate ansi to dos 850 */
+
+ /* translate ansi to dos 850 */
if (!show_in_hex && s < 256 && s >= 32)
{
if (show_in_dos && s > 127)
{
if (wintodos[s - 128] > 0)
{
- print_char (wintodos[s - 128]);
+ print_char(wintodos[s - 128]);
}
else
{
else
print_string("< -");
- print_glue(20000 * 65536L, glue_order(p), "");
+ print_glue(20000 * unity, glue_order(p), "");
}
else
- print_glue(round(65536L * g), glue_order(p), "");
+ print_glue(round(unity * g), glue_order(p), "");
}
if (shift_amount(p) != 0)
if (cur_val >= 16384) /* 2^14 */
arith_error = true;
else
- cur_val = cur_val * 65536L + f;
+ cur_val = cur_val * unity + f;
lab30:;
{
get_x_token();
(void) fputs(log_line, log_file);
}
- (void) fputs(tex_version, log_file);
- (void) fprintf(log_file, " (%s %s)", application, yandyversion);
+ fprintf(log_file, "%s (%s %s)", tex_version, application, yandyversion);
if (format_ident > 0)
slow_print(format_ident);
tfm_temp = getc(tfm_file);
z =(z * 16) + (tfm_temp / 16);
- if (z < 65536L)
+ if (z < unity)
goto lab11;
while (lh > 2)
dvi_gone = dvi_gone + half_buf;
}
-/* attempt at speeding up bkph - is compiler smart ? */
/* sec 0600 */
void dvi_four_(integer x)
{
if (x >= 0)
- dvi_out(x / 0100000000); // dvi_out((x >> 24));
+ dvi_out(x / 0100000000);
else
{
x = x + 010000000000;
x = x + 010000000000;
- dvi_out((x / 0100000000) + 128); // dvi_out((x >> 24) + 128);
+ dvi_out((x / 0100000000) + 128);
}
- x = x % 0100000000; // x = x & 16777215L;
- dvi_out(x / 0200000); // dvi_out((x >> 16));
- x = x % 0200000; // x = x & 65535L;
- dvi_out(x / 0400); // dvi_out((x >> 8));
- dvi_out(x % 0400); // dvi_out(x & 255);
+ x = x % 0100000000;
+ dvi_out(x / 0200000);
+ x = x % 0200000;
+ dvi_out(x / 0400);
+ dvi_out(x % 0400);
}
/* sec 0601 */
void dvi_pop_(integer l)
if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0))
decr(dvi_ptr);
else
- dvi_out(142);
+ dvi_out(pop);
}
/* sec 0602 */
void dvi_font_def_(internal_font_number f)
incr(cur_s);
if (cur_s > 0)
- dvi_out(141);
+ dvi_out(push);
if (cur_s > max_push)
max_push = cur_s;
incr(cur_s);
if (cur_s > 0)
- dvi_out(141);
+ dvi_out(push);
if (cur_s > max_push)
max_push = cur_s;
dvi_v = 0;
cur_h = h_offset;
dvi_f = null_font;
-
- if (output_file_name == 0)
- {
- if (job_name == 0)
- open_log_file();
-
- pack_job_name(".dvi");
-
- while (!b_open_out(dvi_file))
- {
- prompt_file_name("file name for output", ".dvi");
- }
-
- output_file_name = b_make_name_string(dvi_file);
- }
+ ensure_dvi_open();
if (total_pages == 0)
{
help2("I can only handle fonts at positive sizes that are",
"less than 2048pt, so I've changed what you said to 10pt.");
error();
- s = 10 * 65536L;
+ s = 10 * unity;
}
}
else if (scan_keyword("scaled"))
return true;
}
-/**************************************************************************/
-void print_char_string (unsigned char *s)
-{
- while (*s > 0)
- print_char(*s++);
-}
+
void show_font_info (void); // now in local.c
extern int closed_already; // make sure we don't try this more than once
/* sec 1333 */
fprintf(log_file, "%c\n", ' ');
fprintf(log_file, "\n");
fprintf(log_file, "%s%s\n", "Here is how much of TeX's memory", " you used:");
- fprintf(log_file, "%c%ld%s", ' ', str_ptr - init_str_ptr, " string");
+ fprintf(log_file, "%c%ld%s", ' ', (int)(str_ptr - init_str_ptr), " string");
if (str_ptr != init_str_ptr + 1)
putc('s', log_file);
#ifdef ALLOCATESTRING
if (show_current)
- fprintf(log_file, "%s%ld\n", " out of ", current_max_strings - init_str_ptr);
+ fprintf(log_file, "%s%ld\n", " out of ", (int)(current_max_strings - init_str_ptr));
else
#endif
- fprintf(log_file, "%s%ld\n", " out of ", max_strings - init_str_ptr);
+ fprintf(log_file, "%s%ld\n", " out of ", (int)(max_strings - init_str_ptr));
#ifdef ALLOCATESTRING
if (show_current)
- fprintf(log_file, "%c%ld%s%ld\n", ' ', pool_ptr - init_pool_ptr, " string characters out of ", current_pool_size - init_pool_ptr);
+ fprintf(log_file, "%c%ld%s%ld\n", ' ', (int)(pool_ptr - init_pool_ptr), " string characters out of ", current_pool_size - init_pool_ptr);
else
#endif
- fprintf(log_file, "%c%ld%s%ld\n", ' ', pool_ptr - init_pool_ptr, " string characters out of ", pool_size - init_pool_ptr);
+ fprintf(log_file, "%c%ld%s%ld\n", ' ', (int)(pool_ptr - init_pool_ptr), " string characters out of ", pool_size - init_pool_ptr);
#ifdef ALLOCATEMAIN
if (show_current)
- 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 ", current_mem_size);
+ fprintf(log_file, "%c%ld%s%ld\n", ' ', (int)(lo_mem_max - mem_min + mem_end - hi_mem_min + 2), " words of memory out of ", current_mem_size);
else
#endif
- 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 ", mem_end + 1 - mem_min);
+ fprintf(log_file, "%c%ld%s%ld\n", ' ', (int)(lo_mem_max - mem_min + mem_end - hi_mem_min + 2), " words of memory out of ", mem_end + 1 - mem_min);
- fprintf(log_file, "%c%ld%s%ld\n", ' ', cs_count, " multiletter control sequences out of ", (hash_size + hash_extra));
- fprintf(log_file, "%c%ld%s%ld%s", ' ', (long)fmem_ptr, " words of font info for ", (long)font_ptr - font_base, " font");
+ fprintf(log_file, "%c%ld%s%ld\n", ' ', (int)(cs_count), " multiletter control sequences out of ", (hash_size + hash_extra));
+ fprintf(log_file, "%c%ld%s%ld%s", ' ', (int)(fmem_ptr), " words of font info for ", (int)(font_ptr - font_base), " font");
if (font_ptr != 1)
putc('s', log_file);
fprintf(log_file, "%s%ld\n", " out of ", hyphen_prime);
fprintf(log_file, " ");
- fprintf(log_file, "%ld%s", max_in_stack, "i,");
- fprintf(log_file, "%ld%s", max_nest_stack, "n,");
- fprintf(log_file, "%ld%s", max_param_stack, "p,");
- fprintf(log_file, "%ld%s", max_buf_stack + 1, "b,");
- fprintf(log_file, "%ld%s", max_save_stack + 6, "s");
+ fprintf(log_file, "%ld%s", (int)max_in_stack, "i,");
+ fprintf(log_file, "%ld%s", (int)max_nest_stack, "n,");
+ fprintf(log_file, "%ld%s", (int)max_param_stack, "p,");
+ fprintf(log_file, "%ld%s", (int)max_buf_stack + 1, "b,");
+ fprintf(log_file, "%ld%s", (int)max_save_stack + 6, "s");
fprintf(log_file, " stack positions out of ");
#ifdef ALLOCATESAVESTACK
fprintf(log_file, " (i = in_stack, n = nest_stack, p = param_stack, b = buf_stack, s = save_stack)\n");
if (!knuth_flag)
- fprintf(log_file, " %d inputs open max out of %d\n", high_in_open, max_in_open);
+ fprintf(log_file, " %d inputs open max out of %ld\n", high_in_open, max_in_open);
if (show_line_break_stats && first_pass_count > 0)
{
while (cur_s > -1)
{
if (cur_s > 0)
- dvi_out(142);
+ dvi_out(pop);
else
{
dvi_out(eop);
print_nl("Output written on ");
if (full_file_name_flag && dvi_file_name != NULL)
- print_char_string((unsigned char *) dvi_file_name);
+ print_string(dvi_file_name);
else
slow_print(output_file_name);
print_nl("Transcript written on ");
if (full_file_name_flag && log_file_name != NULL)
- print_char_string((unsigned char *) log_file_name);
+ print_string(log_file_name);
else
slow_print(texmf_log_name);
EXTERN integer skew_char[font_max + 1];
EXTERN font_index bchar_label[font_max + 1];
EXTERN short font_bchar[font_max + 1];
-/* don't change above to int or format file will be incompatible */
EXTERN short font_false_bchar[font_max + 1];
-/* don't change above to int or format file will be incompatible */
EXTERN integer char_base[font_max + 1];
EXTERN integer width_base[font_max + 1];
EXTERN integer height_base[font_max + 1];
EXTERN int font_dimen_zero;
EXTERN int ignore_frozen;
EXTERN boolean suppress_f_ligs;
-EXTERN int abort_flag;
-EXTERN int err_level;
EXTERN int jump_used;
EXTERN jmp_buf jumpbuffer;
extern int current_pool_size;
#include "coerce.h"
/* sec 79 */
-extern INLINE void prompt_input(const char *s);
-extern INLINE void synch_h(void);
-extern INLINE void synch_v(void);
-extern INLINE void set_cur_lang(void);
+extern inline void print_err (const char * s);
+extern inline void ensure_dvi_open(void);
+extern inline void write_dvi(size_t a, size_t b);
+extern inline void prompt_input(const char *s);
+extern inline void synch_h(void);
+extern inline void synch_v(void);
+extern inline void set_cur_lang(void);
extern char * md5_file(FILE * in_file);
-extern INLINE void str_room_ (int val);
+extern inline void str_room_ (int val);
#define str_room(a) str_room_((int) a)
-extern INLINE void tail_append_ (pointer val);
+extern inline void tail_append_ (pointer val);
#define tail_append(a) tail_append_((pointer) a)
-extern INLINE void tex_help (unsigned int n, ...);
-extern INLINE void append_char(ASCII_code c);
-extern INLINE void append_lc_hex(ASCII_code c);
-extern INLINE void succumb(void);
-extern INLINE void dvi_out_ (ASCII_code op);
+extern inline void tex_help (unsigned int n, ...);
+extern inline void append_char(ASCII_code c);
+extern inline void append_lc_hex(ASCII_code c);
+extern inline void succumb(void);
+extern inline void dvi_out_ (ASCII_code op);
#define dvi_out(op) dvi_out_((ASCII_code) (op))
-extern INLINE void free_avail_(halfword p);
+extern inline void free_avail_(halfword p);
#define free_avail(p) free_avail_((halfword) (p))
-extern INLINE void flush_string (void);
+extern inline void flush_string (void);
extern str_number load_pool_strings (integer spare_size);
extern str_number make_string_pool (const char *s);
#define help0() tex_help(0)
out_dpx_flag = (1 << 3),
};
-#define INLINE inline
-
/* Read a line of input as quickly as possible. */
extern boolean input_line (FILE *);
#define input_ln(stream, flag) input_line(stream)
#define dumpcore abort
#endif
-#define write_dvi(a, b) \
- if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
- (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file) \
- != (size_t) ((size_t)(b) - (size_t)(a) + 1)) \
- FATAL_PERROR ("\n! dvi file")
+//#define write_dvi(a, b) \
+// if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
+// (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file) \
+// != (size_t) ((size_t)(b) - (size_t)(a) + 1)) \
+// FATAL_PERROR ("\n! dvi file")
#ifdef COMPACTFORMAT
--- /dev/null
+/* Copyright 2014 Clerk Ma
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA. */
+
+#define EXTERN extern
+
+#include "texd.h"
+
+inline void ensure_dvi_open(void)
+{
+ if (output_file_name == 0)
+ {
+ if (job_name == 0)
+ open_log_file();
+
+ pack_job_name(".dvi");
+
+ while (!b_open_out(dvi_file))
+ {
+ prompt_file_name("file name for output", ".dvi");
+ }
+
+ output_file_name = b_make_name_string(dvi_file);
+ }
+}
+
+inline void write_dvi(size_t a, size_t b)
+{
+ if (fwrite((char *) &dvi_buf[a], sizeof(dvi_buf[a]),
+ ((b) - (a) + 1), dvi_file) != ((b) - (a) + 1))
+ FATAL_PERROR ("\n! dvi file");
+}
+inline void prompt_input(const char * s)
+{
+ print_string(s);
+ term_input();
+}
+inline void synch_h(void)
+{
+ if (cur_h != dvi_h)
+ {
+ movement(cur_h - dvi_h, right1);
+ dvi_h = cur_h;
+ }
+}
+inline void synch_v(void)
+{
+ if (cur_v != dvi_v)
+ {
+ movement(cur_v - dvi_v, down1);
+ dvi_v = cur_v;
+ }
+}
+inline void set_cur_lang(void)
+{
+ if (language <= 0)
+ cur_lang = 0;
+ else if (language > 255)
+ cur_lang = 0;
+ else
+ cur_lang = language;
+}
+inline void free_avail_(halfword p)
+{
+ link(p) = avail;
+ avail = p;
+#ifdef STAT
+ decr(dyn_used);
+#endif
+}
+inline void dvi_out_(ASCII_code op)
+{
+ dvi_buf[dvi_ptr] = op;
+ incr(dvi_ptr);
+
+ if (dvi_ptr == dvi_limit)
+ dvi_swap();
+}
+inline void succumb (void)
+{
+ if (interaction == error_stop_mode)
+ interaction = scroll_mode;
+
+ if (log_opened)
+ {
+ error();
+ }
+
+#ifdef DEBUG
+ if (interaction > 0)
+ debug_help();
+#endif
+
+ history = error_stop_mode;
+ jump_out();
+}
+inline void flush_string (void)
+{
+ decr(str_ptr);
+ pool_ptr = str_start[str_ptr];
+}
+inline void append_char (ASCII_code c)
+{
+ str_pool[pool_ptr] = c;
+ incr(pool_ptr);
+}
+inline void append_lc_hex (ASCII_code c)
+{
+ if (c < 10)
+ append_char(c + '0');
+ else
+ append_char(c - 10 + 'a');
+}
+inline void print_err (const char * s)
+{
+ if (interaction == error_stop_mode);
+ print_nl("! ");
+
+ print_string(s);
+}
+inline void tex_help (unsigned int n, ...)
+{
+ int i;
+ va_list help_arg;
+
+ if (n > 6)
+ n = 6;
+
+ help_ptr = n;
+ va_start(help_arg, n);
+
+ for (i = n - 1; i > -1; --i)
+ help_line[i] = va_arg(help_arg, char *);
+
+ va_end(help_arg);
+}
+inline void str_room_ (int val)
+{
+#ifdef ALLOCATESTRING
+ if (pool_ptr + val > current_pool_size)
+ str_pool = realloc_str_pool(increment_pool_size);
+
+ if (pool_ptr + val > current_pool_size)
+ overflow("pool size", current_pool_size - init_pool_ptr);
+#else
+ if (pool_ptr + val > pool_size)
+ overflow("pool size", pool_size - init_pool_ptr);
+#endif
+}
+inline void tail_append_ (pointer val)
+{
+ link(tail) = val;
+ tail = link(tail);
+}
\ No newline at end of file
pause_for_instructions(); \
} \
while (0)
+/* sec 0101 */
+#define unity 0200000
+#define two 0400000
/* sec 0105 */
#define nx_plux_y(...) mult_and_add(..., 07777777777L)
#define mult_integers(a) mult_and_add(a,0,017777777777L)
#define nop 138 // NULL
#define bop 139 // c0[4] c1[4] ... c9[4] p[4]
#define eop 140 // NULL
-//#define dvi_push 141
-//#define dvi_pop 142
+#define push 141
+#define pop 142
#define right1 143 // b[1]
#define right2 144 // b[2]
#define right3 145 // b[3]