From 74d3520a79868c9eb2900ed95465e48a592928ab Mon Sep 17 00:00:00 2001 From: maqiyuan Date: Sun, 11 May 2014 15:53:43 +0800 Subject: [PATCH] makefile for gcc. --- src/texsourc/Makefile.gcc | 92 ++++++++++++++++++++++++++++++++++++++++ src/texsourc/tex0.c | 26 ++++++------ src/texsourc/tex2.c | 9 +--- src/texsourc/tex4.c | 1 - src/texsourc/tex9.c | 8 ++-- src/texsourc/yandy_pdf_backend.c | 11 +++-- 6 files changed, 115 insertions(+), 32 deletions(-) create mode 100644 src/texsourc/Makefile.gcc diff --git a/src/texsourc/Makefile.gcc b/src/texsourc/Makefile.gcc new file mode 100644 index 0000000..18811eb --- /dev/null +++ b/src/texsourc/Makefile.gcc @@ -0,0 +1,92 @@ +# +# Copyright (c) 2014 Clerk Ma +# +# You may freely use, modify and/or distribute this file. +# +# makefle for linux (tested in ubuntu 14.04). +# +# apt-get install libkpathsea6 libkpathsea-dev +# apt-get install libhpdf-2.2.1 libhpdf-dev +# apt-get install libpng12-0 libpng12-dev +# apt-get install zlib1g zlib1g-dev +# + +CC = gcc +CFLAGS = -DMSDOS -DTeX -DINITEX -DINI -Ilibmd5 -Ilibavl/libavl +LDFLAGS = -lkpathsea -lhpdf -lpng -lz + +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 md5file.o \ + yandy_pdf_backend.o avl.o + +headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h + +yandytex: $(objects) + $(CC) -o yandytex $(objects) $(LDFLAGS) + +yandytex.o: yandytex.c $(headers) + $(CC) -c $(CFLAGS) yandytex.c + +itex.o: itex.c $(headers) + $(CC) -c $(CFLAGS) itex.c + +openinou.o: openinou.c $(headers) + $(CC) -c $(CFLAGS) openinou.c + +subroute.o: subroute.o $(headers) + $(CC) -c $(CFLAGS) subroute.c + +local.o: local.c $(headers) + $(CC) -c $(CFLAGS) local.c + +tex0.o: tex0.c $(headers) + $(CC) -c $(CFLAGS) tex0.c + +tex1.o: tex1.c $(headers) + $(CC) -c $(CFLAGS) tex1.c + +tex2.o: tex2.c $(headers) + $(CC) -c $(CFLAGS) tex2.c + +tex3.o: tex3.c $(headers) + $(CC) -c $(CFLAGS) tex3.c + +tex4.o: tex4.c $(headers) + $(CC) -c $(CFLAGS) tex4.c + +tex5.o: tex5.c $(headers) + $(CC) -c $(CFLAGS) tex5.c + +tex6.o: tex6.c $(headers) + $(CC) -c $(CFLAGS) tex6.c + +tex7.o: tex7.c $(headers) + $(CC) -c $(CFLAGS) tex7.c + +tex8.o: tex8.c $(headers) + $(CC) -c $(CFLAGS) tex8.c + +tex9.o: tex9.c $(headers) + $(CC) -c $(CFLAGS) tex9.c + +yandy_pool.o: yandy_pool.c $(headers) + $(CC) -c $(CFLAGS) yandy_pool.c + +md5.o: libmd5/md5.c $(headers) + $(CC) -c $(CFLAGS) libmd5/md5.c + +md5file.o: md5file.c $(headers) + $(CC) -c $(CFLAGS) md5file.c + +yandy_pdf_backend.o: yandy_pdf_backend.c $(headers) + $(CC) -c $(CFLAGS) yandy_pdf_backend.c + +avl.o: libavl/libavl/avl.c $(headers) + $(CC) -c $(CFLAGS) libavl/libavl/avl.c + +.PHONY: clean + +clean: + rm yandytex *.o diff --git a/src/texsourc/tex0.c b/src/texsourc/tex0.c index 0586036..a98dc5e 100644 --- a/src/texsourc/tex0.c +++ b/src/texsourc/tex0.c @@ -272,7 +272,7 @@ void print_ (integer s) if (s >= str_ptr) s = 259; /* ??? */ - else + else { if (s < 256) { @@ -330,6 +330,7 @@ void print_ (integer s) incr(j); } } + new_line_char = nl; /* restore eol */ return; } @@ -351,7 +352,6 @@ void print_string_ (unsigned char *s) print_char(*s++); } /* sec 0060 */ -// print string number s from string pool by calling print_ void slow_print_ (integer s) { pool_pointer j; @@ -372,7 +372,6 @@ void slow_print_ (integer s) } } /* sec 0062 */ -// print newline followed by string number s (unless at start of line) void print_nl_ (const char * s) { if (((term_offset > 0) && (odd(selector))) || @@ -382,7 +381,6 @@ void print_nl_ (const char * s) print_string(s); } /* sec 0063 */ -// print string number s preceded by escape character void print_esc_ (const char * s) { integer c; @@ -476,7 +474,8 @@ void print_cs_ (integer p) print_esc("NONEXISTENT."); else { - print_esc(""); print(text(p)); + print_esc(""); + print(text(p)); print_char(' '); } } @@ -488,7 +487,8 @@ void sprint_cs_(halfword p) print(p - active_base); else if (p < null_cs) { - print_esc(""); print(p - single_base); + print_esc(""); + print(p - single_base); } else { @@ -520,7 +520,9 @@ void print_size_ (integer s) /* sec 1355 */ void print_write_whatsit_(str_number s, halfword p) { - print_esc(""); print(s); + print_esc(""); + print(s); + if (write_stream(p) < 16) print_int(write_stream(p)); else if (write_stream(p) == 16) @@ -892,7 +894,6 @@ bool init_terminal (void) } } /* sec 0043 */ -// Make string from str_start[str_ptr] to pool_ptr str_number make_string (void) { #ifdef ALLOCATESTRING @@ -1299,7 +1300,6 @@ scaled round_decimals_(small_number k) return ((a + 1) / 2); } /* sec 0103 */ -/* This has some minor speedup changes - no real advantage probably ... */ void print_scaled_(scaled s) { scaled delta; @@ -2344,7 +2344,7 @@ void print_delimiter_(halfword p) integer a; a = small_fam(p) * 256 + small_char(p); - a = a * 4096 + large_fam(p) * 256 + large_char(p); + a = a * 0x1000 + large_fam(p) * 256 + large_char(p); if (a < 0) print_int(a); @@ -2506,9 +2506,9 @@ void show_node_list_(integer p) if (cur_length > depth_threshold) { -/* if (p > 0) */ /* was p>null !!! line 3662 in tex.web */ if (p != 0) /* fixed 94/Mar/23 BUG FIX NOTE: still not fixed in 3.14159 ! */ - print_string(" []"); + print_string(" []"); + return; } @@ -3019,4 +3019,4 @@ void show_node_list_(integer p) } p = link(p); } -} +} \ No newline at end of file diff --git a/src/texsourc/tex2.c b/src/texsourc/tex2.c index 97a8847..04d6501 100644 --- a/src/texsourc/tex2.c +++ b/src/texsourc/tex2.c @@ -1708,10 +1708,6 @@ void find_font_dimen_(bool writing) error(); } } -/* NOTE: the above use of /fontdimen0 to access the checksum is a kludge */ -/* In future would be better to do this by allocating one more slot for */ -/* for parameters when a font is read rather than carry checksum separately */ -/* The above gets the value byte order reversed ... 98/Oct/5 */ /* sec 0413 */ void scan_something_internal_(small_number level, bool negative) { @@ -2091,8 +2087,6 @@ void scan_something_internal_(small_number level, bool negative) else if ((cur_val_level >= glue_val) && (cur_val_level <= mu_val)) add_glue_ref(cur_val); } -/*****************************************************************************/ -/* Moved here to avoid question about pragma optimize 96/Sep/12 */ /* sec 0341 */ void get_next (void) { @@ -2601,5 +2595,4 @@ lab40: align_state = 1000000L; goto lab20; } -} -//#pragma optimize ("", on) /* 96/Sep/12 */ \ No newline at end of file +} \ No newline at end of file diff --git a/src/texsourc/tex4.c b/src/texsourc/tex4.c index 7158a2b..f9d6249 100644 --- a/src/texsourc/tex4.c +++ b/src/texsourc/tex4.c @@ -451,7 +451,6 @@ void special_out_(halfword p) pool_ptr = str_start[str_ptr]; } -/* noew returns -1 if it fails */ /* sec 1370 */ void write_out_(halfword p) { diff --git a/src/texsourc/tex9.c b/src/texsourc/tex9.c index dc5dc3b..96963d3 100644 --- a/src/texsourc/tex9.c +++ b/src/texsourc/tex9.c @@ -334,11 +334,11 @@ void close_files_and_terminate (void) if (total_pages != 1) print_char('s'); - print_string(", "); + //print_string(", "); //print_int(dvi_offset + dvi_ptr); - print_int(yandy_pdf->sig_bytes); - print_string(" bytes)."); - //print_string(")."); + //print_int(yandy_pdf->mmgr->mpool->used_size); + //print_string(" bytes)."); + print_string(")."); b_close(dvi_file); } diff --git a/src/texsourc/yandy_pdf_backend.c b/src/texsourc/yandy_pdf_backend.c index 5bb2e0f..0dedc8d 100644 --- a/src/texsourc/yandy_pdf_backend.c +++ b/src/texsourc/yandy_pdf_backend.c @@ -365,6 +365,7 @@ void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user void pdf_font_def(internal_font_number f) { + /* int k; const char * fnt_name; char * afm_name; @@ -390,8 +391,8 @@ void pdf_font_def(internal_font_number f) yandy_font[k] = HPDF_GetFont(yandy_pdf, fnt_name, NULL); } } - - HPDF_Page_SetFontAndSize(yandy_page, yandy_font[k], (font_size[f] / 65535)); + */ + HPDF_Page_SetFontAndSize(yandy_page, yandy_font[0], (font_size[f] / 65535)); } void pdf_ship_out(halfword p) @@ -493,6 +494,7 @@ void pdf_ship_out(halfword p) } yandy_page = HPDF_AddPage (yandy_pdf); + HPDF_Page_SetFontAndSize(yandy_page, yandy_font[0], 10); HPDF_Page_SetSize (yandy_page, HPDF_PAGE_SIZE_A4, HPDF_PAGE_PORTRAIT); cur_v = height(p) + v_offset; @@ -562,8 +564,6 @@ lab21: if (f != dvi_f) { - pdf_font_def(f); - if (!font_used[f]) { font_used[f] = true; @@ -572,8 +572,7 @@ lab21: dvi_f = f; } - HPDF_Page_SetFontAndSize (yandy_page, yandy_font[dvi_f], 10); - HPDF_Page_BeginText(yandy_page); + HPDF_Page_BeginText(yandy_page);HPDF_Page_SetFontAndSize(yandy_page, yandy_font[0], 10); HPDF_Page_MoveTextPos(yandy_page, pdf_sp_to_bp(cur_h) + 72, (841.89 - (pdf_sp_to_bp(cur_v) + 72))); HPDF_Page_ShowText(yandy_page, pdf_char_to_string(c)); HPDF_Page_EndText(yandy_page); -- 2.11.0