home *** CD-ROM | disk | FTP | other *** search
/ Mega Top 1 / os2_top1.zip / os2_top1 / APPS / TEKST / CMTEX330 / SOURCE / MATH.H < prev    next >
C/C++ Source or Header  |  1992-02-19  |  5KB  |  193 lines

  1.  
  2. /*
  3.  * %Y%:%M%:%I%:%Q%
  4.  *
  5.  * Copyright 1987,1988,1991 Pat J Monardo
  6.  *
  7.  * Redistribution of this file is permitted through
  8.  * the specifications in the file COPYING.
  9.  *
  10.  *
  11.  */
  12.  
  13. struct style_t {
  14.     mcell    noad_field;
  15.     ptr    display_field;
  16.     ptr    text_field;
  17.     ptr    script_field;
  18.     ptr    script_script_field;
  19. };
  20. typedef struct style_t style_t;
  21.  
  22. ptr    new_style();
  23.  
  24. #define STYLE_NODE        (UNSET_NODE + 1)
  25. #define STYLE_NODE_SIZE        sizeof(style_t)
  26. #define DISPLAY_STYLE        0
  27. #define TEXT_STYLE        2
  28. #define SCRIPT_STYLE        4
  29. #define SCRIPT_SCRIPT_STYLE    6
  30. #define CRAMPED            1
  31.  
  32. ptr    new_choice();
  33.  
  34. #define CHOICE_NODE        (UNSET_NODE + 2)
  35. #define display_mlist(C)    ((style_t *) (C))->display_field
  36. #define text_mlist(C)        ((style_t *) (C))->text_field
  37. #define script_mlist(C)        ((style_t *) (C))->script_field
  38. #define script_script_mlist(C)    ((style_t *) (C))->script_script_field
  39.  
  40. struct noad_t {
  41.     mcell    noad_field;
  42.     mcell    nucleus_field;
  43.     mcell    supscr_field;
  44.     mcell    subscr_field;
  45. };
  46. typedef struct noad_t noad_t;
  47.  
  48. ptr    new_noad();
  49.  
  50. #define NOAD_SIZE        sizeof(noad_t)
  51. #define nucleus(N)        ((ptr)    &((noad_t *) (N))->nucleus_field)
  52. #define supscr(N)        ((ptr)    &((noad_t *) (N))->supscr_field)
  53. #define subscr(N)        ((ptr)    &((noad_t *) (N))->subscr_field)
  54. #define math_type        rinfo
  55. #define math_link        llink
  56.  
  57. #define MATH_CHAR        1
  58. #define SUB_BOX            2
  59. #define SUB_MLIST        3
  60. #define MATH_TEXT_CHAR        4
  61.  
  62. #define fam            font
  63.  
  64. #define ORD_NOAD        (UNSET_NODE + 3)
  65. #define OP_NOAD            (ORD_NOAD + 1)
  66. #define BIN_NOAD        (ORD_NOAD + 2)
  67. #define REL_NOAD        (ORD_NOAD + 3)
  68. #define OPEN_NOAD        (ORD_NOAD + 4)
  69. #define CLOSE_NOAD        (ORD_NOAD + 5)
  70. #define PUNCT_NOAD        (ORD_NOAD + 6)
  71. #define INNER_NOAD        (ORD_NOAD + 7)
  72.  
  73. #define LIMITS            1
  74. #define NO_LIMITS        2
  75.  
  76. struct delimiter_t {
  77.     mcell    noad_field;
  78.     mcell    nucleus_field;
  79.     mcell    supscr_field;
  80.     mcell    subscr_field;
  81.     mcell    left_field;
  82.     mcell    right_field;
  83. };
  84. typedef struct delimiter_t delimiter_t;
  85.  
  86. #define left_delimiter(D)    ((ptr) &((delimiter_t *) (D))->left_field)
  87. #define right_delimiter(D)    ((ptr) &((delimiter_t *) (D))->right_field)
  88.  
  89. #define small_fam        q0
  90. #define small_char        q1
  91. #define large_fam        q2
  92. #define large_char        q3
  93.  
  94. #define RADICAL_NOAD        (INNER_NOAD + 1)
  95. #define RADICAL_NOAD_SIZE    (5 * sizeof(mcell))
  96. #define FRACTION_NOAD        (RADICAL_NOAD + 1)
  97. #define FRACTION_NOAD_SIZE    (6 * sizeof(mcell))
  98. #define DEFAULT_CODE        010000000000
  99. #define thickness        box_width
  100. #define numerator        supscr
  101. #define denominator        subscr
  102.  
  103. #define UNDER_NOAD        (FRACTION_NOAD + 1)
  104. #define OVER_NOAD        (UNDER_NOAD + 1)
  105.  
  106. #define ACCENT_NOAD        (OVER_NOAD + 1)
  107.  
  108. struct accent_t {
  109.     mcell    noad_field;
  110.     mcell    nucleus_field;
  111.     mcell    supscr_field;
  112.     mcell    subscr_field;
  113.     mcell    accent_field;
  114. };
  115. typedef struct accent_t accent_t;
  116.  
  117. #define ACCENT_NOAD_SIZE    (sizeof(accent_t))
  118. #define accent_chr(A)        ((ptr) &((accent_t *) (A))->accent_field)
  119.  
  120. #define VCENTER_NOAD        (ACCENT_NOAD + 1)
  121. #define LEFT_NOAD        (VCENTER_NOAD + 1)
  122. #define RIGHT_NOAD        (LEFT_NOAD + 1)
  123. #define delimiter        nucleus    
  124.  
  125. #define scripts_allowed(N)    (type(N) >= ORD_NOAD && type(N) < LEFT_NOAD)
  126.  
  127. void    print_fam_and_char();
  128. void    print_delimiter();
  129. void    print_subsidiary_data();
  130. void    print_style();
  131. void    print_size();
  132.  
  133. #define TEXT_SIZE        0
  134. #define SCRIPT_SIZE        16
  135. #define SCRIPT_SCRIPT_SIZE    32
  136.  
  137. void    show_choice_node();
  138. void    show_normal_noad();
  139. void    show_fraction_noad();
  140.  
  141. #define mathsy(S, P)        param(fam_fnt(2 + S), P)
  142.  
  143. #define math_x_height(S)    mathsy(S, 5)
  144. #define math_quad(S)        mathsy(S, 6)
  145. #define num1(S)            mathsy(S, 8)
  146. #define num2(S)            mathsy(S, 9)
  147. #define num3(S)            mathsy(S, 10)
  148. #define denom1(S)        mathsy(S, 11)
  149. #define denom2(S)        mathsy(S, 12)
  150. #define sup1(S)            mathsy(S, 13)
  151. #define sup2(S)            mathsy(S, 14)
  152. #define sup3(S)            mathsy(S, 15)
  153. #define sub1(S)            mathsy(S, 16)
  154. #define sub2(S)            mathsy(S, 17)
  155. #define sup_drop(S)        mathsy(S, 18)
  156. #define sub_drop(S)        mathsy(S, 19)
  157. #define delim1(S)        mathsy(S, 20)
  158. #define delim2(S)        mathsy(S, 21)
  159. #define axis_height(S)        mathsy(S, 22)
  160.  
  161. #define TOTAL_MATHSY_PARAMS    22
  162.  
  163. #define mathex(P)        param(fam_fnt(3 + cur_size), P)
  164.  
  165. #define default_rule_thickness    mathex(8)
  166. #define big_op_spacing1        mathex(9)
  167. #define big_op_spacing2        mathex(10)
  168. #define big_op_spacing3        mathex(11)
  169. #define big_op_spacing4        mathex(12)
  170. #define big_op_spacing5        mathex(13)
  171.  
  172. #define TOTAL_MATHEX_PARAMS    13
  173.  
  174. #define cramped_style(S)    (2 * ((S) / 2) + CRAMPED)
  175. #define sub_style(S)        (2 * ((S) / 4) + SCRIPT_STYLE + CRAMPED)
  176. #define sup_style(S)        (2 * ((S) / 4) + SCRIPT_STYLE + ((S) % 2))
  177. #define num_style(S)        ((S) + 2 - 2 * ((S) / 6))
  178. #define denom_style(S)        (2 * ((S) / 2) + CRAMPED + 2 - 2 * ((S) / 6))
  179.  
  180. ptr    fraction_rule();
  181. ptr    overbar();
  182. ptr    var_delimiter();
  183. void    stack_into_box();
  184. scal    height_plus_depth();
  185. ptr    char_box();
  186. ptr    rebox();
  187. ptr    math_glue();
  188. void    math_kern();
  189. void    flush_math();
  190.  
  191. void    _math_init();
  192. void    _math_init_once();
  193.