~ubuntu-branches/ubuntu/intrepid/luatex/intrepid

« back to all changes in this revision

Viewing changes to src/texk/web2c/luatexdir/nodes.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2008-07-07 11:01:13 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707110113-1y7lam37zbbb7bbt
Tags: 0.28.0-1
* two new upstream releases, see the respective ANNOUCE files
* add luasocket license statement to debian/copyright
* activate the pdfluatex format
* prepare for latex based formats
  - add the ini files from TeX Live
  - add debian/formats file
  - adjust dh_installtex incantation
  the problem is that luatex dies when loading ukrhypmp.tex from 
  texlive-lang-cyrillic, but we don't want to conflict with it by now.
* policy 3.8.0, rename README.Debian-source to README.source, and add
  notes about quilt usage
* disable patch fix-pwd-inclusion (it was from svn)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* nodes.h
 
2
   
 
3
   Copyright 2006-2008 Taco Hoekwater <taco@luatex.org>
 
4
 
 
5
   This file is part of LuaTeX.
 
6
 
 
7
   LuaTeX is free software; you can redistribute it and/or modify it under
 
8
   the terms of the GNU General Public License as published by the Free
 
9
   Software Foundation; either version 2 of the License, or (at your
 
10
   option) any later version.
 
11
 
 
12
   LuaTeX is distributed in the hope that it will be useful, but WITHOUT
 
13
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 
14
   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 
15
   License for more details.
 
16
 
 
17
   You should have received a copy of the GNU General Public License along
 
18
   with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */
 
19
 
 
20
/* $Id: nodes.h 1300 2008-05-29 09:09:32Z taco $ */
1
21
 
2
22
#include <stdarg.h>
3
23
 
4
24
#ifndef __NODES_H__
5
 
#define __NODES_H__
 
25
#  define __NODES_H__
6
26
 
7
27
/* these don't really belong here */
8
28
 
9
 
#define token_ref_count(a) info((a)) /* reference count preceding a token list */
10
 
#define add_token_ref(a) token_ref_count(a)++  /* new reference to a token list */
 
29
#  define token_ref_count(a) info((a))  /* reference count preceding a token list */
 
30
#  define add_token_ref(a) token_ref_count(a)++ /* new reference to a token list */
11
31
 
12
32
 
13
33
/* these are in texlang.c */
14
34
 
15
 
#define set_vlink(a,b)  vlink(a)=b
16
 
#define get_vlink(a)  vlink(a)
17
 
#define get_character(a)  character(a)
18
 
 
19
 
extern halfword insert_discretionary ( halfword t,  halfword pre,  halfword post,  halfword replace);
20
 
extern halfword insert_syllable_discretionary ( halfword t,  lang_variables *lan);
21
 
extern halfword insert_word_discretionary ( halfword t,  lang_variables *lan);
22
 
extern halfword insert_complex_discretionary ( halfword t,   lang_variables *lan, 
23
 
                                               halfword pre,  halfword post,  halfword replace);
24
 
extern halfword insert_character ( halfword t,  int n);
25
 
extern void set_disc_field (halfword f, halfword t);
26
 
 
27
 
 
28
 
#define max_halfword  0x3FFFFFFF
29
 
#ifndef null
30
 
#define null         0
31
 
#endif
32
 
#define null_flag    -0x40000000
33
 
#define zero_glue 0
34
 
#define normal 0
35
 
 
36
 
#define vinfo(a)           varmem[(a)].hh.v.LH 
37
 
#define vlink(a)           varmem[(a)].hh.v.RH 
38
 
#define type(a)            varmem[(a)].hh.u.B0
39
 
#define subtype(a)         varmem[(a)].hh.u.B1
40
 
#define node_attr(a)       vinfo((a)+1)
41
 
#define alink(a)           vlink((a)+1)
42
 
 
43
 
#define node_size(a)       varmem[(a)].hh.v.LH
44
 
 
45
 
#define rlink(a)           vlink((a)+1) /* aka alink() */
46
 
#define llink(a)           vinfo((a)+1) /* overlaps with node_attr() */
47
 
 
48
 
#define add_glue_ref(a) glue_ref_count(a)++ /* new reference to a glue spec */
 
35
#  define set_vlink(a,b)  vlink(a)=b
 
36
#  define get_vlink(a)  vlink(a)
 
37
#  define get_character(a)  character(a)
 
38
 
 
39
extern halfword insert_discretionary(halfword t, halfword pre, halfword post,
 
40
                                     halfword replace);
 
41
extern halfword insert_syllable_discretionary(halfword t, lang_variables * lan);
 
42
extern halfword insert_word_discretionary(halfword t, lang_variables * lan);
 
43
extern halfword insert_complex_discretionary(halfword t, lang_variables * lan,
 
44
                                             halfword pre, halfword post,
 
45
                                             halfword replace);
 
46
extern halfword insert_character(halfword t, int n);
 
47
extern void set_disc_field(halfword f, halfword t);
 
48
 
 
49
 
 
50
#  define max_halfword  0x3FFFFFFF
 
51
#  ifndef null
 
52
#    define null         0
 
53
#  endif
 
54
#  define null_flag    -0x40000000
 
55
#  define zero_glue 0
 
56
#  define normal 0
 
57
 
 
58
#  define vinfo(a)           varmem[(a)].hh.v.LH
 
59
#  define vlink(a)           varmem[(a)].hh.v.RH
 
60
#  define type(a)            varmem[(a)].hh.u.B0
 
61
#  define subtype(a)         varmem[(a)].hh.u.B1
 
62
#  define node_attr(a)       vinfo((a)+1)
 
63
#  define alink(a)           vlink((a)+1)
 
64
 
 
65
#  define node_size(a)       varmem[(a)].hh.v.LH
 
66
 
 
67
#  define rlink(a)           vlink((a)+1)
 
68
                                        /* aka alink() */
 
69
#  define llink(a)           vinfo((a)+1)
 
70
                                        /* overlaps with node_attr() */
 
71
 
 
72
#  define add_glue_ref(a) glue_ref_count(a)++   /* new reference to a glue spec */
49
73
 
50
74
/* really special head node pointers that only need links */
51
75
 
52
 
#define temp_node_size 2
 
76
#  define temp_node_size 2
53
77
 
54
78
/* attribute lists */
55
79
 
57
81
 * be the same size
58
82
 */
59
83
 
60
 
#define attribute_node_size 2
61
 
 
62
 
#define attr_list_ref(a)   vinfo((a)+1) /* the reference count */
63
 
#define attribute_id(a)    vinfo((a)+1)
64
 
#define attribute_value(a) vlink((a)+1)
65
 
 
66
 
#define cache_disabled max_halfword
67
 
#define add_node_attr_ref(a) { if (a!=null)  attr_list_ref((a))++; }
68
 
 
69
 
#define  replace_attribute_list(a,b)  do {              \
70
 
    delete_attribute_ref(node_attr(a));                 \
71
 
    node_attr(a)=b;                                     \
 
84
#  define attribute_node_size 2
 
85
 
 
86
#  define attr_list_ref(a)   vinfo((a)+1)
 
87
                                        /* the reference count */
 
88
#  define attribute_id(a)    vinfo((a)+1)
 
89
#  define attribute_value(a) vlink((a)+1)
 
90
 
 
91
#  define cache_disabled max_halfword
 
92
#  define add_node_attr_ref(a) { if (a!=null)  attr_list_ref((a))++; }
 
93
 
 
94
#  define  replace_attribute_list(a,b)  do {              \
 
95
    delete_attribute_ref(node_attr(a));                 \
 
96
    node_attr(a)=b;                                     \
72
97
  } while (0)
73
98
 
74
 
extern void update_attribute_cache (void) ;
75
 
extern halfword copy_attribute_list(halfword n) ;
 
99
extern void update_attribute_cache(void);
 
100
extern halfword copy_attribute_list(halfword n);
76
101
extern halfword do_set_attribute(halfword p, int i, int val);
77
102
 
78
103
 
79
104
/* a glue spec */
80
 
#define glue_spec_size 4
81
 
#define stretch(a)        vlink((a)+1)
 
105
#  define glue_spec_size 4
 
106
#  define stretch(a)        vlink((a)+1)
82
107
/* width == a+2 */
83
 
#define shrink(a)         vinfo((a)+1)
84
 
#define stretch_order(a)  type((a)+3)
85
 
#define shrink_order(a)   subtype((a)+3)
86
 
#define glue_ref_count(a) vlink((a)+3)
 
108
#  define shrink(a)         vinfo((a)+1)
 
109
#  define stretch_order(a)  type((a)+3)
 
110
#  define shrink_order(a)   subtype((a)+3)
 
111
#  define glue_ref_count(a) vlink((a)+3)
87
112
 
88
113
/* pdf action spec */
89
114
 
90
 
#define pdf_action_size 4
 
115
#  define pdf_action_size 4
91
116
 
92
117
typedef enum {
93
 
  pdf_action_page = 0,
94
 
  pdf_action_goto,
95
 
  pdf_action_thread,
96
 
  pdf_action_user } pdf_action_types;
 
118
    pdf_action_page = 0,
 
119
    pdf_action_goto,
 
120
    pdf_action_thread,
 
121
    pdf_action_user
 
122
} pdf_action_types;
97
123
 
98
 
#define pdf_action_type(a)        type((a) + 1)
99
 
#define pdf_action_named_id(a)    subtype((a) + 1)
100
 
#define pdf_action_id(a)          vlink((a) + 1)
101
 
#define pdf_action_file(a)        vinfo((a) + 2)
102
 
#define pdf_action_new_window(a)  vlink((a) + 2)
103
 
#define pdf_action_tokens(a)      vinfo((a) + 3)
104
 
#define pdf_action_refcount(a)    vlink((a) + 3)
 
124
#  define pdf_action_type(a)        type((a) + 1)
 
125
#  define pdf_action_named_id(a)    subtype((a) + 1)
 
126
#  define pdf_action_id(a)          vlink((a) + 1)
 
127
#  define pdf_action_file(a)        vinfo((a) + 2)
 
128
#  define pdf_action_new_window(a)  vlink((a) + 2)
 
129
#  define pdf_action_tokens(a)      vinfo((a) + 3)
 
130
#  define pdf_action_refcount(a)    vlink((a) + 3)
105
131
 
106
132
/*increase count of references to this action*/
107
 
#define add_action_ref(a) pdf_action_refcount((a))++ 
 
133
#  define add_action_ref(a) pdf_action_refcount((a))++
108
134
 
109
135
/* decrease count of references to this
110
136
   action; free it if there is no reference to this action*/
111
137
 
112
 
#define delete_action_ref(a) {                                                                  \
113
 
    if (pdf_action_refcount(a) == null) {                                               \
114
 
          if (pdf_action_type(a) == pdf_action_user) {                          \
115
 
                delete_token_ref(pdf_action_tokens(a));                                 \
116
 
          } else {                                                                                                      \
117
 
                if (pdf_action_file(a) != null)                                                 \
118
 
                  delete_token_ref(pdf_action_file(a));                                 \
119
 
                if (pdf_action_type(a) == pdf_action_page)                              \
120
 
                  delete_token_ref(pdf_action_tokens(a));                               \
121
 
                else if (pdf_action_named_id(a) > 0)                                    \
122
 
                  delete_token_ref(pdf_action_id(a));                                   \
123
 
          }                                                                                                                     \
124
 
          free_node(a, pdf_action_size);                                                        \
125
 
        } else {                                                                                                        \
126
 
          decr(pdf_action_refcount(a));                                                         \
127
 
        }                                                                                                                       \
 
138
#  define delete_action_ref(a) {                                                                  \
 
139
    if (pdf_action_refcount(a) == null) {                                               \
 
140
          if (pdf_action_type(a) == pdf_action_user) {                          \
 
141
                delete_token_ref(pdf_action_tokens(a));                                 \
 
142
          } else {                                                                                                      \
 
143
                if (pdf_action_file(a) != null)                                                 \
 
144
                  delete_token_ref(pdf_action_file(a));                                 \
 
145
                if (pdf_action_type(a) == pdf_action_page)                              \
 
146
                  delete_token_ref(pdf_action_tokens(a));                               \
 
147
                else if (pdf_action_named_id(a) > 0)                                    \
 
148
                  delete_token_ref(pdf_action_id(a));                                   \
 
149
          }                                                                                                                     \
 
150
          free_node(a, pdf_action_size);                                                        \
 
151
        } else {                                                                                                        \
 
152
          decr(pdf_action_refcount(a));                                                         \
 
153
        }                                                                                                                       \
128
154
  }
129
155
 
130
156
 
131
157
 
132
158
/* normal nodes */
133
159
 
134
 
#define inf_bad  10000  /* infinitely bad value */
135
 
#define inf_penalty inf_bad /*``infinite'' penalty value*/
136
 
#define eject_penalty -(inf_penalty) /*``negatively infinite'' penalty value */
137
 
 
138
 
#define penalty_node_size 3 
139
 
#define penalty(a)       vlink((a)+2)
140
 
 
141
 
#define glue_node_size 3
142
 
#define glue_ptr(a)      vinfo((a)+2)
143
 
#define leader_ptr(a)    vlink((a)+2)
 
160
#  define inf_bad  10000        /* infinitely bad value */
 
161
#  define inf_penalty inf_bad   /*``infinite'' penalty value */
 
162
#  define eject_penalty -(inf_penalty)  /*``negatively infinite'' penalty value */
 
163
 
 
164
#  define penalty_node_size 3
 
165
#  define penalty(a)       vlink((a)+2)
 
166
 
 
167
#  define glue_node_size 3
 
168
#  define glue_ptr(a)      vinfo((a)+2)
 
169
#  define leader_ptr(a)    vlink((a)+2)
144
170
 
145
171
/* disc nodes could eventually be smaller, because the indirect 
146
172
   pointers are not really needed (8 instead of 10).
147
173
 */
148
174
 
149
 
#define disc_node_size 10
 
175
#  define disc_node_size 10
150
176
 
151
177
typedef enum {
152
 
  discretionary_disc=0,
153
 
  explicit_disc,
154
 
  automatic_disc,
155
 
  syllable_disc } discretionary_types;
156
 
 
157
 
#define pre_break_head(a)   ((a)+4)
158
 
#define post_break_head(a)  ((a)+6)
159
 
#define no_break_head(a)    ((a)+8)
160
 
 
161
 
#define pre_break(a)     vinfo((a)+2)
162
 
#define post_break(a)    vlink((a)+2)
163
 
#define no_break(a)      vlink((a)+3)
164
 
#define tlink llink
165
 
 
166
 
#define vlink_pre_break(a)  vlink(pre_break_head(a))
167
 
#define vlink_post_break(a) vlink(post_break_head(a))
168
 
#define vlink_no_break(a)   vlink(no_break_head(a))
169
 
 
170
 
#define tlink_pre_break(a)  tlink(pre_break_head(a))
171
 
#define tlink_post_break(a) tlink(post_break_head(a))
172
 
#define tlink_no_break(a)   tlink(no_break_head(a))
173
 
 
174
 
#define kern_node_size 3
175
 
#define explicit 1  /*|subtype| of kern nodes from \.{\\kern} and \.{\\/}*/
176
 
#define acc_kern 2  /*|subtype| of kern nodes from accents */
177
 
 
178
 
#define box_node_size 8
179
 
#define width(a)         varmem[(a+2)].cint
180
 
#define depth(a)         varmem[(a+3)].cint
181
 
#define height(a)        varmem[(a+4)].cint
182
 
#define shift_amount(a)  vlink((a)+5)
183
 
#define box_dir(a)       vinfo((a)+5)
184
 
#define list_ptr(a)      vlink((a)+6)
185
 
#define glue_order(a)    subtype((a)+6)
186
 
#define glue_sign(a)     type((a)+6)
187
 
#define glue_set(a)      varmem[(a+7)].gr
 
178
    discretionary_disc = 0,
 
179
    explicit_disc,
 
180
    automatic_disc,
 
181
    syllable_disc
 
182
} discretionary_types;
 
183
 
 
184
#  define pre_break_head(a)   ((a)+4)
 
185
#  define post_break_head(a)  ((a)+6)
 
186
#  define no_break_head(a)    ((a)+8)
 
187
 
 
188
#  define pre_break(a)     vinfo((a)+2)
 
189
#  define post_break(a)    vlink((a)+2)
 
190
#  define no_break(a)      vlink((a)+3)
 
191
#  define tlink llink
 
192
 
 
193
#  define vlink_pre_break(a)  vlink(pre_break_head(a))
 
194
#  define vlink_post_break(a) vlink(post_break_head(a))
 
195
#  define vlink_no_break(a)   vlink(no_break_head(a))
 
196
 
 
197
#  define tlink_pre_break(a)  tlink(pre_break_head(a))
 
198
#  define tlink_post_break(a) tlink(post_break_head(a))
 
199
#  define tlink_no_break(a)   tlink(no_break_head(a))
 
200
 
 
201
#  define kern_node_size 3
 
202
#  define explicit 1            /*|subtype| of kern nodes from \.{\\kern} and \.{\\/} */
 
203
#  define acc_kern 2            /*|subtype| of kern nodes from accents */
 
204
 
 
205
#  define box_node_size 8
 
206
#  define width(a)         varmem[(a+2)].cint
 
207
#  define depth(a)         varmem[(a+3)].cint
 
208
#  define height(a)        varmem[(a+4)].cint
 
209
#  define shift_amount(a)  vlink((a)+5)
 
210
#  define box_dir(a)       vinfo((a)+5)
 
211
#  define list_ptr(a)      vlink((a)+6)
 
212
#  define glue_order(a)    subtype((a)+6)
 
213
#  define glue_sign(a)     type((a)+6)
 
214
#  define glue_set(a)      varmem[(a+7)].gr
188
215
 
189
216
/* unset nodes */
190
 
#define glue_stretch(a)  varmem[(a)+7].cint
191
 
#define glue_shrink      shift_amount
192
 
#define span_count       subtype
193
 
 
194
 
#define rule_node_size 6
195
 
#define rule_dir(a)      vlink((a)+5)
196
 
 
197
 
#define mark_node_size 3
198
 
#define mark_ptr(a)      vlink((a)+2)
199
 
#define mark_class(a)    vinfo((a)+2)
200
 
 
201
 
#define adjust_node_size 3
202
 
#define adjust_ptr(a)    vlink(a+2)
203
 
 
204
 
#define glyph_node_size 5
205
 
 
206
 
#define character(a)    vinfo((a)+2)
207
 
#define font(a)         vlink((a)+2)
208
 
#define lang_data(a)    vinfo((a)+3)
209
 
#define lig_ptr(a)      vlink((a)+3)
210
 
#define x_displace(a)   vinfo((a)+4)
211
 
#define y_displace(a)   vlink((a)+4)
212
 
#define is_char_node(a) (a!=null && type(a)==glyph_node)
213
 
 
214
 
#define char_lang(a)     ((const int)(((unsigned)lang_data(a) & 0x7FFF0000)>>16))
215
 
#define char_lhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x0000FF00)>>8))
216
 
#define char_rhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x000000FF)))
217
 
#define char_uchyph(a)   ((const int)(((unsigned)lang_data(a) & 0x80000000)>>31))
218
 
 
219
 
#define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+                     \
 
217
#  define glue_stretch(a)  varmem[(a)+7].cint
 
218
#  define glue_shrink      shift_amount
 
219
#  define span_count       subtype
 
220
 
 
221
#  define rule_node_size 6
 
222
#  define rule_dir(a)      vlink((a)+5)
 
223
 
 
224
#  define mark_node_size 3
 
225
#  define mark_ptr(a)      vlink((a)+2)
 
226
#  define mark_class(a)    vinfo((a)+2)
 
227
 
 
228
#  define adjust_node_size 3
 
229
#  define adjust_ptr(a)    vlink(a+2)
 
230
 
 
231
#  define glyph_node_size 5
 
232
 
 
233
#  define character(a)    vinfo((a)+2)
 
234
#  define font(a)         vlink((a)+2)
 
235
#  define lang_data(a)    vinfo((a)+3)
 
236
#  define lig_ptr(a)      vlink((a)+3)
 
237
#  define x_displace(a)   vinfo((a)+4)
 
238
#  define y_displace(a)   vlink((a)+4)
 
239
#  define is_char_node(a) (a!=null && type(a)==glyph_node)
 
240
 
 
241
#  define char_lang(a)     ((const int)(((unsigned)lang_data(a) & 0x7FFF0000)>>16))
 
242
#  define char_lhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x0000FF00)>>8))
 
243
#  define char_rhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x000000FF)))
 
244
#  define char_uchyph(a)   ((const int)(((unsigned)lang_data(a) & 0x80000000)>>31))
 
245
 
 
246
#  define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+                     \
220
247
  (b<<16)+ (((c>0 && c<256) ? c : 1)<<8)+(((d>0 && d<256) ? d : 1))
221
248
 
222
 
#define init_lang_data(a)      lang_data(a)=256+1
223
 
 
224
 
#define set_char_lang(a,b)    lang_data(a)=make_lang_data(char_uchyph(a),b,char_lhmin(a),char_rhmin(a))
225
 
#define set_char_lhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),b,char_rhmin(a))
226
 
#define set_char_rhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),char_lhmin(a),b)
227
 
#define set_char_uchyph(a,b)  lang_data(a)=make_lang_data(b,char_lang(a),char_lhmin(a),char_rhmin(a))
228
 
 
229
 
#define margin_kern_node_size 4
230
 
#define margin_char(a)  vlink((a)+3)
 
249
#  define init_lang_data(a)      lang_data(a)=256+1
 
250
 
 
251
#  define set_char_lang(a,b)    lang_data(a)=make_lang_data(char_uchyph(a),b,char_lhmin(a),char_rhmin(a))
 
252
#  define set_char_lhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),b,char_rhmin(a))
 
253
#  define set_char_rhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),char_lhmin(a),b)
 
254
#  define set_char_uchyph(a,b)  lang_data(a)=make_lang_data(b,char_lang(a),char_lhmin(a),char_rhmin(a))
 
255
 
 
256
#  define margin_kern_node_size 4
 
257
#  define margin_char(a)  vlink((a)+3)
231
258
 
232
259
/*@# {|subtype| of marginal kerns}*/
233
 
#define left_side 0
234
 
#define right_side 1
235
 
 
236
 
#define math_node_size 3
237
 
#define surround(a)      vlink((a)+2)
238
 
#define before 0 /*|subtype| for math node that introduces a formula*/
239
 
#define after 1 /*|subtype| for math node that winds up a formula*/
240
 
 
241
 
 
242
 
 
243
 
#define ins_node_size 6
244
 
#define float_cost(a)    varmem[(a)+2].cint
245
 
#define ins_ptr(a)       vinfo((a)+5)
246
 
#define split_top_ptr(a) vlink((a)+5)
247
 
 
248
 
 
249
 
#define page_ins_node_size 5
250
 
 
251
 
#define broken_ptr(a) vlink((a)+2) /* an insertion for this class will break here if anywhere */
252
 
#define broken_ins(a) vinfo((a)+2) /* this insertion might break at |broken_ptr| */
253
 
#define last_ins_ptr(a) vlink((a)+3) /*the most recent insertion for this |subtype|*/
254
 
#define best_ins_ptr(a) vinfo((a)+3) /*the optimum most recent insertion*/
 
260
#  define left_side 0
 
261
#  define right_side 1
 
262
 
 
263
#  define math_node_size 3
 
264
#  define surround(a)      vlink((a)+2)
 
265
#  define before 0              /*|subtype| for math node that introduces a formula */
 
266
#  define after 1               /*|subtype| for math node that winds up a formula */
 
267
 
 
268
 
 
269
 
 
270
#  define ins_node_size 6
 
271
#  define float_cost(a)    varmem[(a)+2].cint
 
272
#  define ins_ptr(a)       vinfo((a)+5)
 
273
#  define split_top_ptr(a) vlink((a)+5)
 
274
 
 
275
 
 
276
#  define page_ins_node_size 5
 
277
 
 
278
#  define broken_ptr(a) vlink((a)+2)    /* an insertion for this class will break here if anywhere */
 
279
#  define broken_ins(a) vinfo((a)+2)    /* this insertion might break at |broken_ptr| */
 
280
#  define last_ins_ptr(a) vlink((a)+3)  /*the most recent insertion for this |subtype| */
 
281
#  define best_ins_ptr(a) vinfo((a)+3)  /*the optimum most recent insertion */
255
282
/* height = 4 */
256
283
 
257
284
typedef enum {
258
 
  hlist_node = 0, 
259
 
  vlist_node = 1, 
260
 
  rule_node,      
261
 
  ins_node,       
262
 
  mark_node,      
263
 
  adjust_node,    
264
 
  /* 6 used to be ligatures */
265
 
  disc_node=7,     
266
 
  whatsit_node,
267
 
  math_node,      
268
 
  glue_node,      
269
 
  kern_node,      
270
 
  penalty_node,   
271
 
  unset_node,   /* 13 */
272
 
  style_node,
273
 
  choice_node,
274
 
  ord_noad,
275
 
  op_noad,
276
 
  bin_noad,
277
 
  rel_noad,
278
 
  open_noad,
279
 
  close_noad,
280
 
  punct_noad,
281
 
  inner_noad,
282
 
  radical_noad,
283
 
  fraction_noad,
284
 
  under_noad,
285
 
  over_noad,
286
 
  accent_noad,
287
 
  vcenter_noad,
288
 
  left_noad,
289
 
  right_noad,
290
 
  margin_kern_node = 32,
291
 
  glyph_node = 33,
292
 
  align_record_node = 34,
293
 
  pseudo_file_node = 35,
294
 
  pseudo_line_node = 36,
295
 
  inserting_node = 37,
296
 
  split_up_node = 38,
297
 
  expr_node = 39,
298
 
  nesting_node = 40,
299
 
  span_node = 41,
300
 
  attribute_node = 42,
301
 
  glue_spec_node = 43,
302
 
  attribute_list_node = 44,
303
 
  action_node = 45,
304
 
  temp_node = 46,
305
 
  align_stack_node = 47,
306
 
  movement_node = 48,
307
 
  if_node = 49,
308
 
  unhyphenated_node = 50, 
309
 
  hyphenated_node = 51,
310
 
  delta_node = 52,
311
 
  passive_node = 53,
312
 
  shape_node = 54 } node_types ;
313
 
 
314
 
#define last_known_node temp_node /* used by \lastnodetype */
315
 
 
316
 
#define movement_node_size 3
317
 
#define expr_node_size 3
318
 
#define if_node_size 2
319
 
#define align_stack_node_size 6
320
 
#define nesting_node_size 2
321
 
 
322
 
#define span_node_size 3
323
 
#define span_span(a) vlink((a)+1)
324
 
#define span_link(a) vinfo((a)+1)
325
 
 
326
 
#define pseudo_file_node_size 2
327
 
#define pseudo_lines(a) vlink((a)+1)
328
 
 
329
 
#define nodetype_has_attributes(t) (((t)<=glyph_node) && ((t)!=unset_node))
330
 
 
331
 
#define style_node_size 4 /* number of words in a style node*/
332
 
#define radical_noad_size 6 /*number of |mem| words in a radical noad*/
333
 
#define accent_noad_size 6 /*number of |mem| words in an accent noad*/
334
 
 
335
 
 
336
 
#define display_mlist(a) vinfo((a)+2) /* mlist to be used in display style*/
337
 
#define text_mlist(a) vlink((a)+2) /* mlist to be used in text style */
338
 
#define script_mlist(a) vinfo((a)+3) /* mlist to be used in script style */
339
 
#define script_script_mlist(a) vlink((a)+3) /* mlist to be used in scriptscript style */
340
 
 
341
 
#define noad_size 5 /*number of words in a normal noad*/
342
 
#define nucleus(a) (a)+2 /* the |nucleus| field of a noad */
343
 
#define supscr(a) (a)+3 /* the |supscr| field of a noad */
344
 
#define subscr(a) (a)+4 /* the |subscr| field of a noad */
345
 
#define math_type vlink /* a |quarterword| in |mem| */
346
 
#define fam(a) type((a)) /* a |quarterword| in |mem| */
347
 
 
348
 
#define fraction_noad_size 7 /*number of |mem| words in a fraction noad*/
349
 
#define numerator supscr /*|numerator| field in a fraction noad*/
350
 
#define denominator subscr /*|denominator| field in a fraction noad*/
 
285
    hlist_node = 0,
 
286
    vlist_node = 1,
 
287
    rule_node,
 
288
    ins_node,
 
289
    mark_node,
 
290
    adjust_node,
 
291
    /* 6 used to be ligatures */
 
292
    disc_node = 7,
 
293
    whatsit_node,
 
294
    math_node,
 
295
    glue_node,
 
296
    kern_node,
 
297
    penalty_node,
 
298
    unset_node,                 /* 13 */
 
299
    style_node,
 
300
    choice_node,
 
301
    ord_noad,
 
302
    op_noad,
 
303
    bin_noad,
 
304
    rel_noad,
 
305
    open_noad,
 
306
    close_noad,
 
307
    punct_noad,
 
308
    inner_noad,
 
309
    radical_noad,
 
310
    fraction_noad,
 
311
    under_noad,
 
312
    over_noad,
 
313
    accent_noad,
 
314
    vcenter_noad,
 
315
    left_noad,
 
316
    right_noad,
 
317
    margin_kern_node = 32,
 
318
    glyph_node = 33,
 
319
    align_record_node = 34,
 
320
    pseudo_file_node = 35,
 
321
    pseudo_line_node = 36,
 
322
    inserting_node = 37,
 
323
    split_up_node = 38,
 
324
    expr_node = 39,
 
325
    nesting_node = 40,
 
326
    span_node = 41,
 
327
    attribute_node = 42,
 
328
    glue_spec_node = 43,
 
329
    attribute_list_node = 44,
 
330
    action_node = 45,
 
331
    temp_node = 46,
 
332
    align_stack_node = 47,
 
333
    movement_node = 48,
 
334
    if_node = 49,
 
335
    unhyphenated_node = 50,
 
336
    hyphenated_node = 51,
 
337
    delta_node = 52,
 
338
    passive_node = 53,
 
339
    shape_node = 54
 
340
} node_types;
 
341
 
 
342
#  define last_known_node temp_node     /* used by \lastnodetype */
 
343
 
 
344
#  define movement_node_size 3
 
345
#  define expr_node_size 3
 
346
#  define if_node_size 2
 
347
#  define align_stack_node_size 6
 
348
#  define nesting_node_size 2
 
349
 
 
350
#  define span_node_size 3
 
351
#  define span_span(a) vlink((a)+1)
 
352
#  define span_link(a) vinfo((a)+1)
 
353
 
 
354
#  define pseudo_file_node_size 2
 
355
#  define pseudo_lines(a) vlink((a)+1)
 
356
 
 
357
#  define nodetype_has_attributes(t) (((t)<=glyph_node) && ((t)!=unset_node))
 
358
 
 
359
#  define style_node_size 4     /* number of words in a style node */
 
360
#  define radical_noad_size 6   /*number of |mem| words in a radical noad */
 
361
#  define accent_noad_size 6    /*number of |mem| words in an accent noad */
 
362
 
 
363
 
 
364
#  define display_mlist(a) vinfo((a)+2) /* mlist to be used in display style */
 
365
#  define text_mlist(a) vlink((a)+2)    /* mlist to be used in text style */
 
366
#  define script_mlist(a) vinfo((a)+3)  /* mlist to be used in script style */
 
367
#  define script_script_mlist(a) vlink((a)+3)   /* mlist to be used in scriptscript style */
 
368
 
 
369
#  define noad_size 5           /*number of words in a normal noad */
 
370
#  define nucleus(a) (a)+2      /* the |nucleus| field of a noad */
 
371
#  define supscr(a) (a)+3       /* the |supscr| field of a noad */
 
372
#  define subscr(a) (a)+4       /* the |subscr| field of a noad */
 
373
#  define math_type vlink       /* a |quarterword| in |mem| */
 
374
#  define fam(a) type((a))      /* a |quarterword| in |mem| */
 
375
 
 
376
#  define fraction_noad_size 7  /*number of |mem| words in a fraction noad */
 
377
#  define numerator supscr      /*|numerator| field in a fraction noad */
 
378
#  define denominator subscr    /*|denominator| field in a fraction noad */
351
379
 
352
380
typedef enum {
353
 
  math_char=1, /* |math_type| when the attribute is simple */
354
 
  sub_box, /* |math_type| when the attribute is a box */
355
 
  sub_mlist, /* |math_type| when the attribute is a formula */
356
 
  math_text_char /* |math_type| when italic correction is dubious */
 
381
    math_char = 1,              /* |math_type| when the attribute is simple */
 
382
    sub_box,                    /* |math_type| when the attribute is a box */
 
383
    sub_mlist,                  /* |math_type| when the attribute is a formula */
 
384
    math_text_char              /* |math_type| when italic correction is dubious */
357
385
} math_types;
358
386
 
359
387
 
360
388
typedef enum {
361
 
  open_node = 0,
362
 
  write_node,
363
 
  close_node,
364
 
  special_node,
365
 
  language_node,
366
 
  set_language_code,
367
 
  local_par_node,
368
 
  dir_node,
369
 
  pdf_literal_node,
370
 
  pdf_obj_code,
371
 
  pdf_refobj_node, /* 10 */
372
 
  pdf_xform_code,
373
 
  pdf_refxform_node,
374
 
  pdf_ximage_code,
375
 
  pdf_refximage_node,
376
 
  pdf_annot_node,
377
 
  pdf_start_link_node,
378
 
  pdf_end_link_node,
379
 
  pdf_outline_code,
380
 
  pdf_dest_node,
381
 
  pdf_thread_node, /* 20 */
382
 
  pdf_start_thread_node,
383
 
  pdf_end_thread_node,
384
 
  pdf_save_pos_node,
385
 
  pdf_thread_data_node,
386
 
  pdf_link_data_node,
387
 
  pdf_names_code,
388
 
  pdf_font_attr_code,
389
 
  pdf_include_chars_code,
390
 
  pdf_map_file_code,
391
 
  pdf_map_line_code, /* 30 */
392
 
  pdf_trailer_code,
393
 
  pdf_font_expand_code,
394
 
  set_random_seed_code,
395
 
  pdf_glyph_to_unicode_code,
396
 
  late_lua_node, /* 35 */
397
 
  close_lua_node,
398
 
  save_cat_code_table_code,
399
 
  init_cat_code_table_code,
400
 
  pdf_colorstack_node,
401
 
  pdf_setmatrix_node, /* 40 */
402
 
  pdf_save_node,
403
 
  pdf_restore_node,
404
 
  cancel_boundary_node,
405
 
  user_defined_node /* 44 */ } whatsit_types ;
406
 
 
407
 
#define pdf_info_code pdf_thread_data_node
408
 
#define pdf_catalog_code  pdf_link_data_node
409
 
 
410
 
 
411
 
#define GLYPH_CHARACTER     (1 << 0)
412
 
#define GLYPH_LIGATURE      (1 << 1)
413
 
#define GLYPH_GHOST         (1 << 2)
414
 
#define GLYPH_LEFT          (1 << 3)
415
 
#define GLYPH_RIGHT         (1 << 4)
416
 
 
417
 
#define is_character(p)        ((subtype(p)) & GLYPH_CHARACTER)
418
 
#define is_ligature(p)         ((subtype(p)) & GLYPH_LIGATURE )
419
 
#define is_ghost(p)            ((subtype(p)) & GLYPH_GHOST    )
420
 
 
421
 
#define is_simple_character(p) (is_character(p) && !is_ligature(p) && !is_ghost(p))
422
 
 
423
 
#define is_leftboundary(p)         (is_ligature(p) && ((subtype(p)) & GLYPH_LEFT  ))
424
 
#define is_rightboundary(p)    (is_ligature(p) && ((subtype(p)) & GLYPH_RIGHT ))
425
 
#define is_leftghost(p)            (is_ghost(p)    && ((subtype(p)) & GLYPH_LEFT  ))
426
 
#define is_rightghost(p)           (is_ghost(p)    && ((subtype(p)) & GLYPH_RIGHT ))
427
 
 
428
 
#define set_is_glyph(p)         subtype(p) &= ~GLYPH_CHARACTER
429
 
#define set_is_character(p)     subtype(p) |= GLYPH_CHARACTER
430
 
#define set_is_ligature(p)      subtype(p) |= GLYPH_LIGATURE
431
 
#define set_is_ghost(p)         subtype(p) |= GLYPH_GHOST
432
 
 
433
 
#define set_to_glyph(p)         subtype(p) = (subtype(p) & 0xFF00)
434
 
#define set_to_character(p)     subtype(p) = (subtype(p) & 0xFF00) | GLYPH_CHARACTER
435
 
#define set_to_ligature(p)      subtype(p) = (subtype(p) & 0xFF00) | GLYPH_LIGATURE
436
 
#define set_to_ghost(p)         subtype(p) = (subtype(p) & 0xFF00) | GLYPH_GHOST
437
 
 
438
 
#define set_is_leftboundary(p)  { set_to_ligature(p); subtype(p) |= GLYPH_LEFT;  }
439
 
#define set_is_rightboundary(p) { set_to_ligature(p); subtype(p) |= GLYPH_RIGHT; }
440
 
#define set_is_leftghost(p)     { set_to_ghost(p);    subtype(p) |= GLYPH_LEFT;  }
441
 
#define set_is_rightghost(p)    { set_to_ghost(p);    subtype(p) |= GLYPH_RIGHT; }
442
 
 
443
 
 
444
 
#define special_node_size 3
445
 
 
446
 
#define dir_node_size 4
447
 
#define dir_dir(a)       vinfo((a)+2)
448
 
#define dir_level(a)     vlink((a)+2)
449
 
#define dir_dvi_ptr(a)   vinfo((a)+3)
450
 
#define dir_dvi_h(a)     vlink((a)+3)
451
 
 
452
 
#define write_node_size 3
453
 
#define close_node_size 3
454
 
#define write_tokens(a)  vlink(a+2)
455
 
#define write_stream(a)  vinfo(a+2)
456
 
 
457
 
#define open_node_size 4
458
 
#define open_name(a)   vlink((a)+2)
459
 
#define open_area(a)   vinfo((a)+3)
460
 
#define open_ext(a)    vlink((a)+3)
461
 
 
462
 
#define late_lua_data(a)        vlink((a)+2)
463
 
#define late_lua_reg(a)         vinfo((a)+2)
464
 
 
465
 
#define local_par_size 6
466
 
 
467
 
#define local_pen_inter(a)       vinfo((a)+2)
468
 
#define local_pen_broken(a)      vlink((a)+2)
469
 
#define local_box_left(a)        vlink((a)+3)
470
 
#define local_box_left_width(a)  vinfo((a)+3)
471
 
#define local_box_right(a)       vlink((a)+4)
472
 
#define local_box_right_width(a) vinfo((a)+4)
473
 
#define local_par_dir(a)         vinfo((a)+5)
474
 
 
475
 
 
476
 
#define pdf_literal_data(a)  vlink(a+2)
477
 
#define pdf_literal_mode(a)  vinfo(a+2)
478
 
 
479
 
#define pdf_refobj_node_size 3
480
 
 
481
 
#define pdf_obj_objnum(a)    vinfo((a) + 2)
482
 
 
483
 
#define pdf_refxform_node_size  6
484
 
#define pdf_refximage_node_size 6
485
 
#define pdf_annot_node_size 8
486
 
#define pdf_dest_node_size 8
487
 
#define pdf_thread_node_size 8
488
 
 
489
 
#define pdf_width(a)         varmem[(a) + 2].cint
490
 
#define pdf_height(a)        varmem[(a) + 3].cint
491
 
#define pdf_depth(a)         varmem[(a) + 4].cint
492
 
 
493
 
#define pdf_ximage_objnum(a) vinfo((a) + 5) /* this will be removed soon */
494
 
#define pdf_ximage_ref(a)    vinfo((a) + 5)
495
 
#define pdf_xform_objnum(a)  vinfo((a) + 5)
496
 
 
497
 
#define pdf_annot_data(a)       vinfo((a) + 6)
498
 
#define pdf_link_attr(a)        vinfo((a) + 6)
499
 
#define pdf_link_action(a)      vlink((a) + 6)
500
 
#define pdf_annot_objnum(a)     varmem[(a) + 7].cint
501
 
#define pdf_link_objnum(a)      varmem[(a) + 7].cint
502
 
 
503
 
#define pdf_dest_type(a)          type((a) + 6)
504
 
#define pdf_dest_named_id(a)      subtype((a) + 6)
505
 
#define pdf_dest_id(a)            vlink((a) + 6)
506
 
#define pdf_dest_xyz_zoom(a)      vinfo((a) + 7)
507
 
#define pdf_dest_objnum(a)        vlink((a) + 7)
508
 
 
509
 
#define pdf_thread_named_id(a)    subtype((a) + 6)
510
 
#define pdf_thread_id(a)          vlink((a) + 6)
511
 
#define pdf_thread_attr(a)        vinfo((a) + 7)
512
 
 
513
 
#define pdf_end_link_node_size 3
514
 
#define pdf_end_thread_node_size 3
515
 
#define pdf_save_pos_node_size 3
516
 
 
517
 
#define pdf_colorstack_node_size 4
518
 
#define pdf_setmatrix_node_size 3
519
 
 
520
 
#define pdf_colorstack_stack(a)  vlink((a)+2)
521
 
#define pdf_colorstack_cmd(a)    vinfo((a)+2)
522
 
#define pdf_colorstack_data(a)   vlink((a)+3)
523
 
#define pdf_setmatrix_data(a)    vlink((a)+2)
524
 
 
525
 
#define pdf_save_node_size     3
526
 
#define pdf_restore_node_size  3
527
 
 
528
 
typedef enum {
529
 
  colorstack_set=0,
530
 
  colorstack_push,
531
 
  colorstack_pop,
532
 
  colorstack_current } colorstack_commands;
533
 
 
534
 
#define colorstack_data   colorstack_push /* last value where data field is set */
535
 
 
536
 
#define user_defined_node_size 4
537
 
#define user_node_type(a)  vinfo((a)+2)
538
 
#define user_node_id(a)    vlink((a)+2)
539
 
#define user_node_value(a) vinfo((a)+3)
540
 
 
541
 
#define cancel_boundary_size   3
542
 
 
543
 
typedef enum {
544
 
  exactly=0, /*a box dimension is pre-specified*/
545
 
  additional, /*a box dimension is increased from the natural one*/
546
 
  cal_expand_ratio, /* calculate amount for font expansion after breaking
547
 
                       paragraph into lines*/
548
 
  subst_ex_font  /* substitute fonts */
 
389
    open_node = 0,
 
390
    write_node,
 
391
    close_node,
 
392
    special_node,
 
393
    language_node,
 
394
    set_language_code,
 
395
    local_par_node,
 
396
    dir_node,
 
397
    pdf_literal_node,
 
398
    pdf_obj_code,
 
399
    pdf_refobj_node,            /* 10 */
 
400
    pdf_xform_code,
 
401
    pdf_refxform_node,
 
402
    pdf_ximage_code,
 
403
    pdf_refximage_node,
 
404
    pdf_annot_node,
 
405
    pdf_start_link_node,
 
406
    pdf_end_link_node,
 
407
    pdf_outline_code,
 
408
    pdf_dest_node,
 
409
    pdf_thread_node,            /* 20 */
 
410
    pdf_start_thread_node,
 
411
    pdf_end_thread_node,
 
412
    pdf_save_pos_node,
 
413
    pdf_thread_data_node,
 
414
    pdf_link_data_node,
 
415
    pdf_names_code,
 
416
    pdf_font_attr_code,
 
417
    pdf_include_chars_code,
 
418
    pdf_map_file_code,
 
419
    pdf_map_line_code,          /* 30 */
 
420
    pdf_trailer_code,
 
421
    pdf_font_expand_code,
 
422
    set_random_seed_code,
 
423
    pdf_glyph_to_unicode_code,
 
424
    late_lua_node,              /* 35 */
 
425
    close_lua_node,
 
426
    save_cat_code_table_code,
 
427
    init_cat_code_table_code,
 
428
    pdf_colorstack_node,
 
429
    pdf_setmatrix_node,         /* 40 */
 
430
    pdf_save_node,
 
431
    pdf_restore_node,
 
432
    cancel_boundary_node,
 
433
    user_defined_node /* 44 */
 
434
} whatsit_types;
 
435
 
 
436
#  define pdf_info_code pdf_thread_data_node
 
437
#  define pdf_catalog_code  pdf_link_data_node
 
438
 
 
439
 
 
440
#  define GLYPH_CHARACTER     (1 << 0)
 
441
#  define GLYPH_LIGATURE      (1 << 1)
 
442
#  define GLYPH_GHOST         (1 << 2)
 
443
#  define GLYPH_LEFT          (1 << 3)
 
444
#  define GLYPH_RIGHT         (1 << 4)
 
445
 
 
446
#  define is_character(p)        ((subtype(p)) & GLYPH_CHARACTER)
 
447
#  define is_ligature(p)         ((subtype(p)) & GLYPH_LIGATURE )
 
448
#  define is_ghost(p)            ((subtype(p)) & GLYPH_GHOST    )
 
449
 
 
450
#  define is_simple_character(p) (is_character(p) && !is_ligature(p) && !is_ghost(p))
 
451
 
 
452
#  define is_leftboundary(p)         (is_ligature(p) && ((subtype(p)) & GLYPH_LEFT  ))
 
453
#  define is_rightboundary(p)    (is_ligature(p) && ((subtype(p)) & GLYPH_RIGHT ))
 
454
#  define is_leftghost(p)            (is_ghost(p)    && ((subtype(p)) & GLYPH_LEFT  ))
 
455
#  define is_rightghost(p)           (is_ghost(p)    && ((subtype(p)) & GLYPH_RIGHT ))
 
456
 
 
457
#  define set_is_glyph(p)         subtype(p) &= ~GLYPH_CHARACTER
 
458
#  define set_is_character(p)     subtype(p) |= GLYPH_CHARACTER
 
459
#  define set_is_ligature(p)      subtype(p) |= GLYPH_LIGATURE
 
460
#  define set_is_ghost(p)         subtype(p) |= GLYPH_GHOST
 
461
 
 
462
#  define set_to_glyph(p)         subtype(p) = (subtype(p) & 0xFF00)
 
463
#  define set_to_character(p)     subtype(p) = (subtype(p) & 0xFF00) | GLYPH_CHARACTER
 
464
#  define set_to_ligature(p)      subtype(p) = (subtype(p) & 0xFF00) | GLYPH_LIGATURE
 
465
#  define set_to_ghost(p)         subtype(p) = (subtype(p) & 0xFF00) | GLYPH_GHOST
 
466
 
 
467
#  define set_is_leftboundary(p)  { set_to_ligature(p); subtype(p) |= GLYPH_LEFT;  }
 
468
#  define set_is_rightboundary(p) { set_to_ligature(p); subtype(p) |= GLYPH_RIGHT; }
 
469
#  define set_is_leftghost(p)     { set_to_ghost(p);    subtype(p) |= GLYPH_LEFT;  }
 
470
#  define set_is_rightghost(p)    { set_to_ghost(p);    subtype(p) |= GLYPH_RIGHT; }
 
471
 
 
472
 
 
473
#  define special_node_size 3
 
474
 
 
475
#  define dir_node_size 4
 
476
#  define dir_dir(a)       vinfo((a)+2)
 
477
#  define dir_level(a)     vlink((a)+2)
 
478
#  define dir_dvi_ptr(a)   vinfo((a)+3)
 
479
#  define dir_dvi_h(a)     vlink((a)+3)
 
480
 
 
481
#  define write_node_size 3
 
482
#  define close_node_size 3
 
483
#  define write_tokens(a)  vlink(a+2)
 
484
#  define write_stream(a)  vinfo(a+2)
 
485
 
 
486
#  define open_node_size 4
 
487
#  define open_name(a)   vlink((a)+2)
 
488
#  define open_area(a)   vinfo((a)+3)
 
489
#  define open_ext(a)    vlink((a)+3)
 
490
 
 
491
#  define late_lua_node_size 4
 
492
#  define late_lua_data(a)        vlink((a)+2)
 
493
#  define late_lua_reg(a)         vinfo((a)+2)
 
494
#  define late_lua_name(a)        vlink((a)+3)
 
495
 
 
496
#  define local_par_size 6
 
497
 
 
498
#  define local_pen_inter(a)       vinfo((a)+2)
 
499
#  define local_pen_broken(a)      vlink((a)+2)
 
500
#  define local_box_left(a)        vlink((a)+3)
 
501
#  define local_box_left_width(a)  vinfo((a)+3)
 
502
#  define local_box_right(a)       vlink((a)+4)
 
503
#  define local_box_right_width(a) vinfo((a)+4)
 
504
#  define local_par_dir(a)         vinfo((a)+5)
 
505
 
 
506
 
 
507
#  define pdf_literal_data(a)  vlink(a+2)
 
508
#  define pdf_literal_mode(a)  vinfo(a+2)
 
509
 
 
510
#  define pdf_refobj_node_size 3
 
511
 
 
512
#  define pdf_obj_objnum(a)    vinfo((a) + 2)
 
513
 
 
514
#  define pdf_refxform_node_size  6
 
515
#  define pdf_refximage_node_size 6
 
516
#  define pdf_annot_node_size 8
 
517
#  define pdf_dest_node_size 8
 
518
#  define pdf_thread_node_size 8
 
519
 
 
520
#  define pdf_width(a)         varmem[(a) + 2].cint
 
521
#  define pdf_height(a)        varmem[(a) + 3].cint
 
522
#  define pdf_depth(a)         varmem[(a) + 4].cint
 
523
 
 
524
#  define pdf_ximage_objnum(a) vinfo((a) + 5)   /* this will be removed soon */
 
525
#  define pdf_ximage_ref(a)    vinfo((a) + 5)
 
526
#  define pdf_xform_objnum(a)  vinfo((a) + 5)
 
527
 
 
528
#  define pdf_annot_data(a)       vinfo((a) + 6)
 
529
#  define pdf_link_attr(a)        vinfo((a) + 6)
 
530
#  define pdf_link_action(a)      vlink((a) + 6)
 
531
#  define pdf_annot_objnum(a)     varmem[(a) + 7].cint
 
532
#  define pdf_link_objnum(a)      varmem[(a) + 7].cint
 
533
 
 
534
#  define pdf_dest_type(a)          type((a) + 6)
 
535
#  define pdf_dest_named_id(a)      subtype((a) + 6)
 
536
#  define pdf_dest_id(a)            vlink((a) + 6)
 
537
#  define pdf_dest_xyz_zoom(a)      vinfo((a) + 7)
 
538
#  define pdf_dest_objnum(a)        vlink((a) + 7)
 
539
 
 
540
#  define pdf_thread_named_id(a)    subtype((a) + 6)
 
541
#  define pdf_thread_id(a)          vlink((a) + 6)
 
542
#  define pdf_thread_attr(a)        vinfo((a) + 7)
 
543
 
 
544
#  define pdf_end_link_node_size 3
 
545
#  define pdf_end_thread_node_size 3
 
546
#  define pdf_save_pos_node_size 3
 
547
 
 
548
#  define pdf_colorstack_node_size 4
 
549
#  define pdf_setmatrix_node_size 3
 
550
 
 
551
#  define pdf_colorstack_stack(a)  vlink((a)+2)
 
552
#  define pdf_colorstack_cmd(a)    vinfo((a)+2)
 
553
#  define pdf_colorstack_data(a)   vlink((a)+3)
 
554
#  define pdf_setmatrix_data(a)    vlink((a)+2)
 
555
 
 
556
#  define pdf_save_node_size     3
 
557
#  define pdf_restore_node_size  3
 
558
 
 
559
typedef enum {
 
560
    colorstack_set = 0,
 
561
    colorstack_push,
 
562
    colorstack_pop,
 
563
    colorstack_current
 
564
} colorstack_commands;
 
565
 
 
566
#  define colorstack_data   colorstack_push     /* last value where data field is set */
 
567
 
 
568
#  define user_defined_node_size 4
 
569
#  define user_node_type(a)  vinfo((a)+2)
 
570
#  define user_node_id(a)    vlink((a)+2)
 
571
#  define user_node_value(a) vinfo((a)+3)
 
572
 
 
573
#  define cancel_boundary_size   3
 
574
 
 
575
typedef enum {
 
576
    exactly = 0,                /*a box dimension is pre-specified */
 
577
    additional,                 /*a box dimension is increased from the natural one */
 
578
    cal_expand_ratio,           /* calculate amount for font expansion after breaking
 
579
                                   paragraph into lines */
 
580
    subst_ex_font               /* substitute fonts */
549
581
} hpack_subtypes;
550
582
 
551
 
#define active_node_size 4 /*number of words in extended active nodes*/
552
 
#define fitness subtype /*|very_loose_fit..tight_fit| on final line for this break*/
553
 
#define break_node(a) vlink((a)+1) /*pointer to the corresponding passive node */
554
 
#define line_number(a) vinfo((a)+1) /*line that begins at this breakpoint*/
555
 
#define total_demerits(a) varmem[(a)+2].cint /* the quantity that \TeX\ minimizes*/
556
 
#define active_short(a) vinfo(a+3) /* |shortfall| of this line */
557
 
#define active_glue(a)  vlink(a+3) /*corresponding glue stretch or shrink*/
558
 
 
559
 
#define passive_node_size 7
560
 
#define cur_break(a)                   vlink((a)+1) /*in passive node, points to position of this breakpoint*/
561
 
#define prev_break(a)                  vinfo((a)+1) /*points to passive node that should precede this one */
562
 
#define passive_pen_inter(a)           vinfo((a)+2)
563
 
#define passive_pen_broken(a)          vlink((a)+2)
564
 
#define passive_left_box(a)            vlink((a)+3)
565
 
#define passive_left_box_width(a)      vinfo((a)+3)
566
 
#define passive_last_left_box(a)       vlink((a)+4)
567
 
#define passive_last_left_box_width(a) vinfo((a)+4)
568
 
#define passive_right_box(a)           vlink((a)+5)
569
 
#define passive_right_box_width(a)     vinfo((a)+5)
570
 
#define serial(a)                      vlink((a)+6) /* serial number for symbolic identification*/
571
 
 
572
 
#define delta_node_size 10 /* 8 fields, stored in a+1..9 */
573
 
 
574
 
#define couple_nodes(a,b) {assert(b!=null);vlink(a)=b;alink(b)=a;}
575
 
#define try_couple_nodes(a,b) if (b==null) vlink(a)=b; else {couple_nodes(a,b);}
576
 
#define uncouple_node(a) {assert(a!=null);vlink(a)=null;alink(a)=null;}
577
 
 
578
 
#define cache_disabled max_halfword
579
 
 
580
 
extern void delete_attribute_ref(halfword b) ;
581
 
extern void build_attribute_list(halfword b) ;
 
583
#  define active_node_size 4    /*number of words in extended active nodes */
 
584
#  define fitness subtype       /*|very_loose_fit..tight_fit| on final line for this break */
 
585
#  define break_node(a) vlink((a)+1)    /*pointer to the corresponding passive node */
 
586
#  define line_number(a) vinfo((a)+1)   /*line that begins at this breakpoint */
 
587
#  define total_demerits(a) varmem[(a)+2].cint  /* the quantity that \TeX\ minimizes */
 
588
#  define active_short(a) vinfo(a+3)    /* |shortfall| of this line */
 
589
#  define active_glue(a)  vlink(a+3)    /*corresponding glue stretch or shrink */
 
590
 
 
591
#  define passive_node_size 7
 
592
#  define cur_break(a)                   vlink((a)+1)   /*in passive node, points to position of this breakpoint */
 
593
#  define prev_break(a)                  vinfo((a)+1)   /*points to passive node that should precede this one */
 
594
#  define passive_pen_inter(a)           vinfo((a)+2)
 
595
#  define passive_pen_broken(a)          vlink((a)+2)
 
596
#  define passive_left_box(a)            vlink((a)+3)
 
597
#  define passive_left_box_width(a)      vinfo((a)+3)
 
598
#  define passive_last_left_box(a)       vlink((a)+4)
 
599
#  define passive_last_left_box_width(a) vinfo((a)+4)
 
600
#  define passive_right_box(a)           vlink((a)+5)
 
601
#  define passive_right_box_width(a)     vinfo((a)+5)
 
602
#  define serial(a)                      vlink((a)+6)   /* serial number for symbolic identification */
 
603
 
 
604
#  define delta_node_size 10    /* 8 fields, stored in a+1..9 */
 
605
 
 
606
#  define couple_nodes(a,b) {assert(b!=null);vlink(a)=b;alink(b)=a;}
 
607
#  define try_couple_nodes(a,b) if (b==null) vlink(a)=b; else {couple_nodes(a,b);}
 
608
#  define uncouple_node(a) {assert(a!=null);vlink(a)=null;alink(a)=null;}
 
609
 
 
610
#  define cache_disabled max_halfword
 
611
 
 
612
extern void delete_attribute_ref(halfword b);
 
613
extern void build_attribute_list(halfword b);
582
614
 
583
615
extern int unset_attribute(halfword n, int c, int w);
584
616
extern void set_attribute(halfword n, int c, int w);
585
617
extern int has_attribute(halfword n, int c, int w);
586
618
 
587
 
extern halfword new_span_node (halfword n, int c, scaled w);
588
 
extern halfword string_to_pseudo(integer l,integer pool_ptr, integer nl);
 
619
extern halfword new_span_node(halfword n, int c, scaled w);
 
620
extern halfword string_to_pseudo(integer l, integer pool_ptr, integer nl);
589
621
 
590
622
/* TH: these two defines still need checking. The node ordering in luatex is not 
591
623
   quite the same as in tex82 */
592
624
 
593
 
#define precedes_break(a) (type((a))<math_node && (type(a)!=whatsit_node || subtype(a)!=dir_node))
594
 
#define non_discardable(a) (type((a))<math_node)
 
625
#  define precedes_break(a) (type((a))<math_node && (type(a)!=whatsit_node || subtype(a)!=dir_node))
 
626
#  define non_discardable(a) (type((a))<math_node)
595
627
 
596
628
/* from luanode.c */
597
629
 
598
630
typedef struct _node_info {
599
 
  int id;
600
 
  int size;
601
 
  char **fields;
602
 
  char *name; 
603
 
}  node_info;
 
631
    int id;
 
632
    int size;
 
633
    char **fields;
 
634
    char *name;
 
635
} node_info;
604
636
 
605
637
extern node_info node_data[];
606
638
extern node_info whatsit_node_data[];
610
642
extern halfword copy_node_list(halfword);
611
643
extern halfword copy_node(halfword);
612
644
extern void check_node(halfword);
613
 
extern void check_node_mem (void);
614
 
extern void fix_node_list (halfword);
 
645
extern void check_node_mem(void);
 
646
extern void fix_node_list(halfword);
615
647
extern int fix_node_lists;
616
 
extern char *sprint_node_mem_usage (void) ;
617
 
extern halfword raw_glyph_node(void) ;
 
648
extern char *sprint_node_mem_usage(void);
 
649
extern halfword raw_glyph_node(void);
618
650
extern halfword new_glyph_node(void);
619
651
extern int valid_node(halfword);
620
652
 
621
 
#define unity 0x10000
 
653
#  define unity 0x10000
622
654
typedef enum {
623
 
  normal_g=0,
624
 
  sfi,
625
 
  fil,
626
 
  fill,
627
 
  filll } glue_orders;
 
655
    normal_g = 0,
 
656
    sfi,
 
657
    fil,
 
658
    fill,
 
659
    filll
 
660
} glue_orders;
628
661
 
629
 
#define zero_glue       0
630
 
#define sfi_glue        zero_glue+glue_spec_size
631
 
#define fil_glue        sfi_glue+glue_spec_size
632
 
#define fill_glue       fil_glue+glue_spec_size
633
 
#define ss_glue         fill_glue+glue_spec_size
634
 
#define fil_neg_glue    ss_glue+glue_spec_size
635
 
#define page_ins_head   fil_neg_glue+glue_spec_size
636
 
#define contrib_head    page_ins_head+temp_node_size
637
 
#define page_head       contrib_head+temp_node_size
638
 
#define temp_head       page_head+temp_node_size
639
 
#define hold_head       temp_head+temp_node_size
640
 
#define adjust_head     hold_head+temp_node_size
641
 
#define pre_adjust_head adjust_head+temp_node_size
642
 
#define active          pre_adjust_head+temp_node_size
643
 
#define align_head      active+active_node_size
644
 
#define end_span        align_head+temp_node_size
645
 
#define begin_point     end_span+glyph_node_size
646
 
#define end_point       begin_point+glyph_node_size
 
662
#  define zero_glue       0
 
663
#  define sfi_glue        zero_glue+glue_spec_size
 
664
#  define fil_glue        sfi_glue+glue_spec_size
 
665
#  define fill_glue       fil_glue+glue_spec_size
 
666
#  define ss_glue         fill_glue+glue_spec_size
 
667
#  define fil_neg_glue    ss_glue+glue_spec_size
 
668
#  define page_ins_head   fil_neg_glue+glue_spec_size
 
669
#  define contrib_head    page_ins_head+temp_node_size
 
670
#  define page_head       contrib_head+temp_node_size
 
671
#  define temp_head       page_head+temp_node_size
 
672
#  define hold_head       temp_head+temp_node_size
 
673
#  define adjust_head     hold_head+temp_node_size
 
674
#  define pre_adjust_head adjust_head+temp_node_size
 
675
#  define active          pre_adjust_head+temp_node_size
 
676
#  define align_head      active+active_node_size
 
677
#  define end_span        align_head+temp_node_size
 
678
#  define begin_point     end_span+glyph_node_size
 
679
#  define end_point       begin_point+glyph_node_size
647
680
 
648
681
#endif