OSDN Git Service

pdf_set_rule.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Sun, 1 Jun 2014 14:31:44 +0000 (22:31 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Sun, 1 Jun 2014 14:31:44 +0000 (22:31 +0800)
src/texsourc/coerce.h
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/tex0.c
src/texsourc/tex4.c
src/texsourc/tex7.c
src/texsourc/tex8.c
src/texsourc/texd.h
src/texsourc/texmfmem.h
src/texsourc/yandy_macros.h
src/texsourc/yandy_pdf_backend.c

index ec39bb4..9113584 100644 (file)
@@ -43,8 +43,8 @@ void print_file_name_(integer, integer, integer);
 #define print_file_name(n, a, e) print_file_name_((integer) (n), (integer) (a), (integer) (e))
 void print_size_(integer);
 #define print_size(s) print_size_((integer) (s))
-void print_write_whatsit_(str_number, halfword);
-#define print_write_whatsit(s, p) print_write_whatsit_((str_number) (s), (halfword) (p))
+void print_write_whatsit_(str_number, pointer);
+#define print_write_whatsit(s, p) print_write_whatsit_((str_number) (s), (pointer) (p))
 void jump_out(void);
 void error(void);
 void fatal_error_(char *);
@@ -87,7 +87,7 @@ scaled xn_over_d_(scaled, integer, integer);
 halfword badness_(scaled, scaled);
 #define badness(t, s) badness_((scaled) (t), (scaled) (s))
 void print_word_(memory_word);
-#define print_word(w) print_word_((memory_word) (w))
+#define print_word(w) print_word_((w))
 void show_token_list_(integer, integer, integer);
 #define show_token_list(p, q, l) show_token_list_((integer) (p), (integer) (q), (integer) (l))
 void runaway(void);
@@ -183,7 +183,7 @@ void primitive_(str_number, quarterword, halfword);
 void new_save_level_(group_code);
 #define new_save_level(c) new_save_level_((group_code) (c))
 void eq_destroy_(memory_word);
-#define eq_destroy(w) eq_destroy_((memory_word) (w))
+#define eq_destroy(w) eq_destroy_((w))
 void eq_save_(halfword, quarterword);
 #define eq_save(p, l) eq_save_((halfword) (p), (quarterword) (l))
 void eq_define_(halfword, quarterword, halfword);
@@ -294,18 +294,18 @@ void dvi_font_def_(internal_font_number);
 #define dvi_font_def(f) dvi_font_def_((internal_font_number) (f))
 void zmovement(scaled, eight_bits);
 #define movement(w, o) zmovement((scaled) (w), (eight_bits) (o))
-void special_out_(halfword);
-#define special_out(p) special_out_((halfword) (p))
+void special_out_(pointer);
+#define special_out(p) special_out_((pointer) (p))
 void hlist_out(void);
 void vlist_out(void);
 void ship_out_(halfword);
 #define ship_out(p) ship_out_((halfword) (p))
 void prune_movements_(integer);
 #define prune_movements(l) prune_movements_((integer) (l))
-void write_out_(halfword);
-#define write_out(p) write_out_((halfword) (p))
-void out_what_(halfword);
-#define out_what(p) out_what_((halfword) (p))
+void write_out_(pointer);
+#define write_out(p) write_out_((pointer) (p))
+void out_what_(pointer);
+#define out_what(p) out_what_((pointer) (p))
 void scan_spec_(group_code, boolean);
 #define scan_spec(c, threecodes) scan_spec_((group_code) (c), (boolean) (threecodes))
 halfword hpack_(halfword, scaled, small_number);
@@ -461,13 +461,13 @@ void push_math_(group_code);
 #define push_math(c) push_math_((group_code) (c))
 void init_math(void);
 void start_eq_no(void);
-void scan_math_(halfword);
-#define scan_math(p) scan_math_((halfword) (p))
+void scan_math_(pointer);
+#define scan_math(p) scan_math_((pointer) (p))
 void set_math_char_(integer);
 #define set_math_char(c) set_math_char_((integer) (c))
 void math_limit_switch(void);
-void scan_delimiter_(halfword, boolean);
-#define scan_delimiter(p, r) scan_delimiter_((halfword) (p), (boolean) (r))
+void scan_delimiter_(pointer, boolean);
+#define scan_delimiter(p, r) scan_delimiter_((pointer) (p), (boolean) (r))
 void math_radical(void);
 void math_ac(void);
 void append_choices(void);
@@ -513,15 +513,4 @@ void close_files_and_terminate(void);
 void final_cleanup(void);
 void init_prim(void);
 void debug_help(void);
-int texbody(void);
-
-/*
- * The C compiler ignores most unnecessary casts (i.e., casts of something
- * to its own type).  However, for structures, it doesn't.  Therefore,
- * we have to redefine these two macros so that they don't try to cast
- * the argument (a memory_word) as a memory_word.
- */
-#undef  eq_destroy
-#define eq_destroy(x)  eq_destroy_(x)
-#undef  print_word
-#define print_word(x)  print_word_(x)
+int texbody(void);
\ No newline at end of file
index d87768d..30b04b1 100644 (file)
@@ -1002,7 +1002,7 @@ void prefixed_command (void)
   internal_font_number f;
   halfword j;
   font_index k;
-  halfword p, q;
+  pointer p, q;
   integer n;
   boolean e;
 
@@ -1596,7 +1596,7 @@ lab30:
 boolean load_fmt_file (void)
 {
   integer j, k;
-  halfword p, q;
+  pointer p, q;
   integer x;
 
   undump_int(x);
@@ -3562,7 +3562,7 @@ void init_trie (void)
 void store_fmt_file (void)
 {
   integer j, k, l;
-  halfword p, q;
+  pointer p, q;
   integer x;
 
   if (!is_initex)
index 38b1c40..5614c6d 100644 (file)
@@ -2458,7 +2458,7 @@ static struct option long_options[] =
   {"main-memory",   1, 0, 'm'},
   {"hyph-size",     1, 0, 'e'},
   {"trie-size",     1, 0, 'h'},
-  {"output-format", 1, 0, '0'},
+  {"backend",       1, 0, '0'},
   {"tab-step",      1, 0, 'H'},
   {"percent-grow",  1, 0, 'g'},
   {"default-rule",  1, 0, 'P'},
index 28f2379..3a0a103 100644 (file)
@@ -518,7 +518,7 @@ void print_size_ (integer s)
     print_esc("scriptscriptfont");
 } 
 /* sec 1355 */
-void print_write_whatsit_(str_number s, halfword p)
+void print_write_whatsit_(str_number s, pointer p)
 {
   print_esc("");
   print(s);
index a4ca980..99f7813 100644 (file)
@@ -406,7 +406,7 @@ lab30:
   }
 }
 /* sec 1368 */
-void special_out_(halfword p)
+void special_out_(pointer p)
 {
   char old_setting;
   pool_pointer k;
@@ -445,7 +445,7 @@ void special_out_(halfword p)
   pool_ptr = str_start[str_ptr];
 }
 /* sec 1370 */
-void write_out_(halfword p)
+void write_out_(pointer p)
 {
   char old_setting;
 /*  integer oldmode;  */
@@ -505,7 +505,7 @@ void write_out_(halfword p)
   selector = old_setting;
 }
 /* sec 1373 */
-void out_what_(halfword p)
+void out_what_(pointer p)
 {
 /*  small_number j;  */
   int j;            /* 1995/Jan/7 */
index d6cbf1c..bc905a7 100644 (file)
@@ -949,7 +949,7 @@ void new_graf_(boolean indented)
 /* sec 1093 */
 void indent_in_hmode (void)
 {
-  halfword p, q;
+  pointer p, q;
 
   if (cur_chr > 0)
   {
@@ -1040,7 +1040,7 @@ void begin_insert_or_adjust (void)
 /* sec 1101 */
 void make_mark (void)
 {
-  halfword p;
+  pointer p;
 
   p = scan_toks(false, true);
   p = get_node(small_node_size);
@@ -1062,7 +1062,7 @@ void append_penalty (void)
 /* sec 1105 */
 void delete_last (void)
 {
-  halfword p, q;
+  pointer p, q;
   quarterword m;
 
   if ((mode == vmode) && (tail == head))
@@ -1114,7 +1114,7 @@ void delete_last (void)
 /* sec 1110 */
 void unpackage (void)
 {
-  halfword p;
+  pointer p;
   char c;
 
   c = cur_chr;
@@ -1150,7 +1150,7 @@ void unpackage (void)
 /* sec 1113 */
 void append_italic_correction (void)
 {
-  halfword p;
+  pointer p;
   internal_font_number f;
 
   if (tail != head)
@@ -1196,7 +1196,7 @@ void append_discretionary (void)
 /* sec 1119 */
 void build_discretionary (void)
 {
-  halfword p, q;
+  pointer p, q;
   integer n;
 
   unsave();
@@ -1287,7 +1287,7 @@ lab30:
 void make_accent (void)
 {
   real s, t;
-  halfword p, q, r;
+  pointer p, q, r;
   internal_font_number f;
   scaled a, h, x, w, delta;
   four_quarters i;
@@ -1461,8 +1461,8 @@ void init_math (void)
   scaled w;
   scaled l;
   scaled s;
-  halfword p;
-  halfword q;
+  pointer p;
+  pointer q;
   internal_font_number f;
   integer n;
   scaled v;
@@ -1642,7 +1642,7 @@ void start_eq_no (void)
   }
 }
 /* sec 1151 */
-void scan_math_(halfword p)
+void scan_math_(pointer p)
 {
   integer c;
 
@@ -1727,7 +1727,7 @@ lab21:
 /* sec 1155 */
 void set_math_char_(integer c)
 {
-  halfword p;
+  pointer p;
 
   if (c >= 32768L)
   {
@@ -1773,7 +1773,7 @@ void math_limit_switch (void)
   error();
 }
 /* sec 1160 */
-void scan_delimiter_(halfword p, boolean r)
+void scan_delimiter_(pointer p, boolean r)
 {
    if (r)
    {
@@ -1876,7 +1876,7 @@ void append_choices (void)
 /* sec 1184 */
 halfword fin_mlist_(halfword p)
 {
-  halfword q;
+  pointer q;
 
   if (incompleat_noad != 0)
   {
@@ -1912,7 +1912,7 @@ halfword fin_mlist_(halfword p)
 /* sec 1174 */
 void build_choices (void)
 {
-  halfword p;
+  pointer p;
 
   unsave();
   p = fin_mlist(0);
@@ -1948,8 +1948,8 @@ void build_choices (void)
 void sub_sup (void)
 {
 /*  small_number t; */
-  int t;              /* 95/Jan/7 */
-  halfword p;
+  int t; /* 95/Jan/7 */
+  pointer p;
 
   t = 0;
   p = 0;
@@ -1987,7 +1987,7 @@ void sub_sup (void)
 void package_(small_number c)
 {
   scaled h;
-  halfword p;
+  pointer p;
   scaled d;
 
   d = box_max_depth;
index 2873866..7189775 100644 (file)
@@ -83,7 +83,7 @@ void math_fraction (void)
 void math_left_right (void)
 {
   small_number t;
-  halfword p;
+  pointer p;
 
   t = cur_chr;
 
@@ -131,9 +131,9 @@ void after_math (void)
   boolean l;
   boolean danger;
   integer m;
-  halfword p;
-  halfword a;
-  halfword b;
+  pointer p;
+  pointer a;
+  pointer b;
   scaled w;
   scaled z;
   scaled e;
@@ -141,8 +141,8 @@ void after_math (void)
   scaled d;
   scaled s;
   small_number g1, g2;
-  halfword r;
-  halfword t;
+  pointer r;
+  pointer t;
 
   danger = false;
   
@@ -461,7 +461,7 @@ void trap_zero_glue (void)
 /* sec 1236 */
 void do_register_command_ (small_number a)
 {
-  halfword l, q, r, s;
+  pointer l, q, r, s;
   char p;
 
   q = cur_cmd;
@@ -733,7 +733,7 @@ void alter_box_dimen (void)
 /* sec 1257 */
 void new_font_(small_number a)
 {
-  halfword u;
+  pointer u;
   scaled s;
   internal_font_number f;
   str_number t;
@@ -1034,8 +1034,8 @@ void issue_message (void)
 /* sec 1288 */
 void shift_case (void)
 {
-  halfword b;
-  halfword p;
+  pointer b;
+  pointer p;
   halfword t;
   eight_bits c;
 
@@ -1064,7 +1064,7 @@ void shift_case (void)
 /* sec 1293 */
 void show_whatever (void)
 {
-  halfword p;
+  pointer p;
 
   switch (cur_chr)
   {
@@ -1163,7 +1163,7 @@ lab50:
 /* sec 1349 */
 void new_whatsit_(small_number s, small_number w)
 {
-  halfword p;
+  pointer p;
 
   p = get_node(w);
   type(p) = whatsit_node;
@@ -1196,7 +1196,7 @@ void new_write_whatsit_(small_number w)
 void do_extension (void)
 {
   integer k;
-  halfword p;
+  pointer p;
 
   switch(cur_chr)
   {
index 3da803b..b0983d1 100644 (file)
@@ -166,6 +166,7 @@ EXTERN integer max_buf_stack;
 /* typedef unsigned long halfword; NO NO: since mem_min may be < 0 */
 /* sec 0113 */
 typedef long halfword;
+typedef halfword pointer;
 typedef char two_choices;
 typedef char four_choices;
 /* sec 0113 */
@@ -762,7 +763,7 @@ EXTERN integer ready_already;
 EXTERN alpha_file write_file[16];
 EXTERN boolean write_open[18];
 /* sec 1345 */
-EXTERN halfword write_loc;
+EXTERN pointer write_loc;
 EXTERN pool_pointer edit_name_start;
 EXTERN integer edit_name_length, edit_line;
 EXTERN int tfm_temp;
@@ -886,10 +887,9 @@ void get_date_and_time (integer *minutes, integer *day,
 
 char *unixify (char *);
 
-/****************************************************************************/
-#include "coerce.h"
 #include "yandy_macros.h"
-/****************************************************************************/
+#include "coerce.h"
+
 /* sec 79 */
 extern void synch_h(void);
 extern void synch_v(void);
index 6701650..6761c42 100644 (file)
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301 USA.  */
 
-/* texmfmem.h: the memory_word type, which is too hard to translate
-   automatically from Pascal.  We have to make sure the byte-swapping
-   that the (un)dumping routines do suffices to put things in the right
-   place in memory.
-
-   A memory_word can be broken up into a `two_halves' or a
-   `four_quarters', and a `two_halves' can be further broken up.  Here is
-   a picture.  ..._M = most significant byte, ..._L = least significant
-   byte.
-   
-   If BigEndian:
-   two_halves.v:  RH_M  RH_L  LH_M  LH_L
-   two_halves.u:  JNK1  JNK2    B0    B1
-   four_quarters:   B0    B1    B2    B3
-   
-   If LittleEndian:
-   two_halves.v:  LH_L  LH_M  RH_L  RH_M
-   two_halves.u:    B1    B0  JNK1  JNK2
-   four_quarters:   B3    B2    B1    B0
-   
-   The halfword fields are four bytes if we are building a TeX or MF;
-   this leads to further complications:
-   
-   BigEndian:
-   two_halves.v:  RH_MM RH_ML RH_LM RH_LL LH_MM LH_ML LH_LM LH_LL
-   two_halves.u:  ---------JUNK----------  B0    B1
-   four_quarters:   B0    B1    B2    B3
-
-   LittleEndian:
-   two_halves.v:  LH_LL LH_LM LH_ML LH_MM RH_LL RH_LM RH_ML RH_MM
-   two_halves.u:  junkx junky  B1    B0
-   four_quarters: ---------JUNK----------  B3    B2    B1    B0
-
-   I guess TeX and Metafont never refer to the B1 and B0 in the
-   four_quarters structure as the B1 and B0 in the two_halves.u structure.
-   
-   This file can't be part of texmf.h, because texmf.h gets included by
-   {tex,mf}d.h before the `halfword' etc. types are defined.  So we
-   include it from the change file instead.
-*/
-
 /*
   meaning      structure                      TeX                 Y&Y TeX
                ----------------------------------------------------------------------
index cb95abf..97a3dde 100644 (file)
@@ -63,7 +63,7 @@ enum
 #define unfloat(a)             (a)
 #define float_constant(a)      (float) (a)
 /* sec 0115*/
-#define pointer halfword
+//#define pointer halfword
 #define null    min_halfword
 /* sec 0118 */
 #define link(p) mem[(p)].hh.rh
index e42abac..dc30df6 100644 (file)
@@ -369,6 +369,20 @@ void pdf_end_text()
 // draw a rule.
 void pdf_set_rule(scaled x, scaled y, scaled w, scaled h)
 {
+  if (h <= 65782)
+  {
+    HPDF_Page_SetLineWidth(yandy_page, h / 65535);
+    HPDF_Page_MoveTo (yandy_page, (x / 65535 + 72), (841.89 - y / 65535 - 72));
+    HPDF_Page_LineTo (yandy_page, (x / 65535 + 72 + w / 65535), (841.89 - y / 65535 - 72));
+    HPDF_Page_Stroke (yandy_page);
+  }
+  else if (w <= 65782)
+  {
+    HPDF_Page_SetLineWidth(yandy_page, w / 65535);
+    HPDF_Page_MoveTo (yandy_page, (x / 65535 + 72), (841.89 - y / 65535 - 72));
+    HPDF_Page_LineTo (yandy_page, (x / 65535 + 72), (841.89 - y / 65535 - 72 + h / 65535));
+    HPDF_Page_Stroke (yandy_page);
+  }
 }
 void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data)
 {
@@ -417,7 +431,7 @@ void pdf_font_def (internal_font_number f)
   free(fnt_buffer);
 }
 
-void pdf_ship_out(halfword p)
+void pdf_ship_out(pointer p)
 {
   char j, k;
 
@@ -787,10 +801,7 @@ lab14:
     if ((rule_ht > 0) && (rule_wd > 0))
     {
       cur_v = base_line + rule_dp;
-      HPDF_Page_SetLineWidth(yandy_page, rule_ht / 65535);
-      HPDF_Page_MoveTo (yandy_page, (cur_h / 65535 + 72), (841.89 - cur_v / 65535 - 72));
-      HPDF_Page_LineTo (yandy_page, (cur_h / 65535 + 72 + rule_wd / 65535), (841.89 - cur_v / 65535 - 72));
-      HPDF_Page_Stroke (yandy_page);
+      pdf_set_rule(cur_h, cur_v, rule_wd, rule_ht);
       cur_v = base_line;
       dvi_h = dvi_h + rule_wd;
     }
@@ -1018,10 +1029,7 @@ lab14:
 
       if ((rule_ht > 0) && (rule_wd > 0))
       {
-        HPDF_Page_SetLineWidth(yandy_page, rule_ht / 65535);
-        HPDF_Page_MoveTo(yandy_page, (cur_h / 65535 + 72), (841.89 - cur_v / 65535 - 72));
-        HPDF_Page_LineTo(yandy_page, (cur_h / 65535 + 72 + rule_wd / 65535), (841.89 - cur_v / 65535 - 72));
-        HPDF_Page_Stroke(yandy_page);
+        pdf_set_rule(cur_h, cur_v, rule_wd, rule_ht);
       }
 
       goto lab15;