OSDN Git Service

updated codes. ptex
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Wed, 11 Jun 2014 14:36:22 +0000 (22:36 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Wed, 11 Jun 2014 14:36:22 +0000 (22:36 +0800)
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/tex1.c
src/texsourc/tex2.c
src/texsourc/tex7.c
src/texsourc/yandy_macros.h

index 8b835e8..745a37d 100644 (file)
@@ -1537,6 +1537,7 @@ void prefixed_command(void)
 
         p = cur_chr;
         scan_char_num();
+
         if (p == kcat_code_base)
           p = p + kcatcodekey(cur_val);
         else if (!is_char_ascii(cur_val))
index 2212dca..0e3274a 100644 (file)
@@ -3118,6 +3118,7 @@ void deslash_all (int ac, char **av)
 int main_init (int ac, char **av)
 {
   kpse_set_program_name(av[0], NULL);
+  //init_default_kanji(NULL, "sjis");
   xputenv("engine", "yandytex");
 
   if (sizeof(memory_word) != sizeof(halfword) * 2)
index aea154c..9c44871 100644 (file)
@@ -2128,9 +2128,9 @@ void print_cmd_chr_ (quarterword cmd, halfword chr_code)
           print_esc("showlists");
           break;
 
-        //case show_mode:
-        //  print_esc("showmode");
-        //  break;
+        case show_mode:
+          print_esc("showmode");
+          break;
 
         default:
           print_esc("show");
index c4b7cf4..32984f9 100644 (file)
@@ -2011,7 +2011,7 @@ void scan_something_internal_(small_number level, boolean negative)
         else
           cur_val = 0;
 
-        // find_effective_tail
+        find_effective_tail();
         tx = tail;
 
         if (!is_char_node(tx))
@@ -2133,7 +2133,7 @@ void get_next (void)
 {
   integer k;
   halfword t;
-/*  char cat; */    /* make this an int ? */
+/*  char cat; */
   int cat;      /* make this an int ? 95/Jan/7 */
   int l; // for pTeX
   ASCII_code c, cc;
@@ -2158,7 +2158,7 @@ lab25:
       }
       else
 lab21:
-      cur_cmd = cat_code(cur_chr);
+        cur_cmd = cat_code(cur_chr);
 
       switch (state + cur_cmd)
       {
@@ -2169,18 +2169,18 @@ lab21:
           break;
 
         case any_state_plus(escape):
-          {
+          {printf("\nescape. ");
             if (loc > limit)
               cur_cs = null_cs;
             else
             {
-              k = loc;
+              k = loc;printf("%d. ", buffer[k]);
               cur_chr = buffer[k];
               incr(k);
 
               if (multistrlen(buffer, limit + 1, k - 1) == 2)
               {
-                cat = kcat_code(kcatcodekey(fromBUFF(buffer, limit + 1, k-1)));
+                cat = kcat_code(kcatcodekey(fromBUFF(buffer, limit + 1, k - 1)));
                 incr(k);
               }
               else
@@ -2274,54 +2274,43 @@ lab26:
               }
               else
               {
-                if (buffer[k] == cur_chr)
-                  if (cat == sup_mark)
-                    if (k < limit)
+                if (buffer[k] == cur_chr) if (cat == sup_mark) if (k < limit)
+                {
+                  c = buffer[k + 1];
+                  
+                  if (c < 128)
+                  {
+                    d = 2;
+                    
+                    if (is_hex(c)) if (k + 2 <= limit)
                     {
-                      c = buffer[k + 1];
-
-                      if (c < 128)             /* ? */
-                      {
-                        d = 2;
-                        if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
-                          if (k + 2 <= limit)
-                          {
-                            cc = buffer[k + 2];
-
-                            if ((((cc >= 48) && (cc <= 57)) || ((cc >= 97) && (cc <= 102))))
-                              incr(d);
-                          }
-
-                        if (d > 2)
-                        {
-                          if (c <= 57)
-                            cur_chr = c - 48;
-                          else
-                            cur_chr = c - 87;
-
-                          if (cc <= 57)          /* cc may be used without ... */
-                            cur_chr = 16 * cur_chr + cc - 48;
-                          else
-                            cur_chr = 16 * cur_chr + cc - 87;
-
-                          buffer[k - 1] = cur_chr;
-                        }
-                        else if (c < 64)
-                          buffer[k - 1] = c + 64;
-                        else
-                          buffer[k - 1] = c - 64;
+                      cc = buffer[k + 2];
 
-                        limit = limit - d;
-                        first = first - d;
-
-                        while (k <= limit)
-                        {
-                          buffer[k] = buffer[k + d];
-                          incr(k);
-                        }
-                        goto lab26;
-                      }
+                      if (is_hex(cc))
+                        incr(d);
+                    }
+                    
+                    if (d > 2)
+                    {
+                      hex_to_cur_chr();
+                      buffer[k - 1] = cur_chr;
+                    }
+                    else if (c < 64)
+                      buffer[k - 1] = c + 64;
+                    else
+                      buffer[k - 1] = c - 64;
+                    
+                    limit = limit - d;
+                    first = first - d;
+                    
+                    while (k <= limit)
+                    {
+                      buffer[k] = buffer[k + d];
+                      incr(k);
                     }
+                    goto lab26;
+                  }
+                }
               }
               cur_cs = single_base + buffer[loc];
               incr(loc);
index a45022d..dc02607 100644 (file)
@@ -1267,7 +1267,7 @@ void unpackage (void)
       {
         case glue_node:
           if ((subtype(tail) == kanji_skip_code + 1) ||
-            (subtype(tail)=xkanji_skip_code+1))
+            (subtype(tail) == xkanji_skip_code+1))
           {
             link(p) = link(tail);
             delete_glue_ref(glue_ptr(tail));
@@ -1508,7 +1508,7 @@ void make_accent (void)
     
     if ((cur_cmd == letter) || (cur_cmd == other_char))
       q = new_character(f, cur_chr);
-    else if ((cur_cmd=kanji) || (cur_cmd == kana) || (cur_cmd == other_kchar))
+    else if ((cur_cmd == kanji) || (cur_cmd == kana) || (cur_cmd == other_kchar))
     {
       if (direction == dir_tate)
         f = cur_tfont;
index c5f1f28..2d64f6f 100644 (file)
@@ -1701,6 +1701,24 @@ do                                                                    \
   }                                                                   \
 while (0)
 //
+#define find_effective_tail()                   \
+do {                                            \
+tx = tail;                                      \
+if (is_char_node(tx))                           \
+  if (type(tx) == disp_node)                    \
+    { tx = prev_node;                           \
+    if (!is_char_node(tx))                      \
+      if (type(tx) == disp_node)                \
+        {tx = head; q = link(head);             \
+        while (q!=prev_node)                    \
+          { if (is_char_node(q)) tx = q;        \
+          else if (type(q) != disp_node) tx = q;\
+          }                                     \
+        q = link(q);                            \
+        }                                       \
+    }                                           \
+} while (0)
+//
 #define check_effective_tail_pTeX(a)\
 do                                  \
   {                                 \