home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / texmf / source / TeX / tex / mltex.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-04  |  3.8 KB  |  158 lines

  1. #define EXTERN extern
  2. #include "texd.h"
  3.  
  4. #ifdef MLTEX
  5.  
  6. #ifndef effective_char
  7.  
  8. #if 0        /* das Ergebnis sollte etwa so aussehen... */
  9. static void
  10. dummy_function_do_nothing()
  11. {
  12.  
  13. __asm__("
  14. .text
  15.     .even
  16. .globl _effective_char
  17. _effective_char:
  18.     lea _zeqtb,a0
  19.     movel sp@(4),d0
  20.  
  21. |    cmpl a0@(charsubdefmax_offset),d0
  22.     movel a0,a1
  23.     addw %0,a1
  24.     cmpl a1@,d0
  25.     jgt L_effc_end
  26.  
  27.     movel d0,d1    | in_chr ist < 256
  28.     aslw #2,d1
  29.     addw d1,a0
  30.     addw %1,a0
  31.     tstw a0@
  32.     jeq L_effc_end
  33.  
  34.     moveq #0,d0
  35.     moveb a0@(1),d0
  36. L_effc_end:
  37.     rts "
  38.   :
  39.   : "i" ((intbase + char_sub_def_max_code) * sizeof(MEDmemoryword)),
  40.     "i" (char_sub_base * sizeof(MEDmemoryword))
  41. );
  42.  
  43. }
  44.  
  45. /* intbase (6419) + char_sub_def_max_code (55) = 25896
  46.    char_sub_base (513) * sizeof(MEDmemoryword)  = 2052 */
  47.  
  48. #endif
  49.  
  50.   integer
  51. effective_char( integer in_chr )
  52. { effective_char_regmem
  53.  
  54.   if( is_ML_TeX && in_chr <= char_sub_def_max && char_list_exists(in_chr) )
  55.     return ( (integer) eqtb[char_sub_base + in_chr].qqqq.b1 );
  56.   return in_chr;
  57. }
  58.  
  59.  
  60. #endif
  61.  
  62. /* called from hlist_out: */
  63. /* (br) added this as a new function */
  64.  
  65.   halfword
  66. substitute_char_list(halfword p, quarterword f, quarterword c)
  67. { substitute_char_list_regmem
  68.   halfword rem_chs;    /* remaining hlist */
  69.   long_halfword accent_chs, char_chs;
  70.   halfword k1_chs, k2_chs;
  71.   halfword p_chs, q_chs;
  72.   scaled a_chs, h_chs, ha_chs, w_chs, x_chs, delta_chs;
  73.   real s_chs;
  74.   fourquarters i_chs;
  75.  
  76.   rem_chs = link(p);
  77.   font(p) = nullfont;
  78.  
  79.   if( !char_list_exists(c) || (integer)c > char_sub_def_max ) {
  80.     charwarning(f, c);
  81.     return rem_chs;        /* Don't forget this ! */
  82.   }
  83.  
  84.   accent_chs = eqtb[c + char_sub_base].qqqq.b0;
  85.   char_chs   = eqtb[c + char_sub_base].qqqq.b1;
  86.  
  87.   if( tracinglostchars > 99 ) {
  88.     begindiagnostic();
  89.     c_printnl("Using Character Substitution List for: ");
  90.     print(c);  c_print(" = ");
  91.     print(accent_chs);  printchar(' ');
  92.     print(char_chs);  c_print(" in font ");
  93.     slowprint(fontname(f));
  94.     printchar('!');
  95.     enddiagnostic(false);
  96.   }
  97.  
  98.   p_chs = newcharacter(f, accent_chs);    /* charnode for accent */
  99.   if( p_chs == (halfword)0 ) {
  100.     /* Warning ist schon in newcharacter ausgegeben worden */
  101.     return rem_chs;
  102.   }
  103.  
  104.   q_chs = newcharacter(f, char_chs);    /* charnode for basechar */
  105.   if( q_chs == (halfword)0 ) {
  106.     /* Warning ist schon in newcharacter ausgegeben worden */
  107.     /* und nicht vergessen, den erfolgreich allokierten Charnode freizugeben */
  108.     freeavail(p_chs);
  109.     return rem_chs;
  110.   }
  111.  
  112.   /* Rebuild character from its list: */
  113.   /* link(p) = 0; */        /* nicht unbedingt notwendig */
  114.  
  115.   x_chs = xheight(f);
  116.   s_chs = slant(f)/((double) 65535.0);
  117.  
  118.   i_chs = zcharinfo(f, char_chs);
  119.   w_chs = zcharwidth(f, i_chs);
  120.   h_chs = zcharheight(f, heightdepth(i_chs));
  121.  
  122.   i_chs = zcharinfo(f, accent_chs);
  123.   a_chs = zcharwidth(f, i_chs);
  124.   ha_chs = zcharheight(f, heightdepth(i_chs));
  125.  
  126.   if( ha_chs > 0 && h_chs != x_chs ) {
  127.     /* Falls Akzent (koennte auch ein Circonflex, ... sein) und
  128.      * Buchstabe != x_height, muss Akzent geshiftet werden:
  129.      */
  130.     long_halfword r_chs;
  131.  
  132.     r_chs = newnullbox();
  133.     width(r_chs)       = a_chs;
  134.     depth(r_chs)       = zchardepth(f, heightdepth(i_chs));
  135.     height(r_chs)      = ha_chs;
  136.     shiftamount(r_chs) = x_chs - h_chs;
  137.     listptr(r_chs)     = p_chs;
  138.     p_chs = r_chs;
  139.   }
  140.  
  141.   delta_chs = round( (w_chs - a_chs)/((double)2.0) + (h_chs - x_chs) * s_chs );
  142.   k1_chs = newkern(delta_chs);        subtype(k1_chs) = acckern;
  143.   k2_chs = newkern(-a_chs - delta_chs);    subtype(k2_chs) = acckern;
  144.  
  145.   /* neue Liste aufbauen */
  146.   link(p) = k1_chs;        /* an alte Liste anhaengen, dann hat man
  147.                    jedoch noch altes Zeichen ??? */
  148.  
  149.   p            = k1_chs;    /* \kern delta_chs    */
  150.   link(p)      = p_chs;        /* \char accent        */
  151.   link(p_chs)  = k2_chs;    /* \kern -delta_chs-\w accent */
  152.   link(k2_chs) = q_chs;        /* \char c        */
  153.   link(q_chs)  = rem_chs;    /* remaining List */
  154.  
  155.   return p;
  156. }
  157. #endif
  158.