~ubuntu-branches/ubuntu/saucy/luatex/saucy

« back to all changes in this revision

Viewing changes to source/texk/web2c/luatexdir/tex/texnodes.h

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Preining
  • Date: 2009-12-25 09:47:05 UTC
  • mfrom: (1.1.9 upstream) (4.2.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091225094705-y33rpflo8t4u9nag
Tags: 0.50.0-1
* new upstream release
* disable fix-hurd-ftbfs patch, included upstream
* disable upstram-fixes, included upstream
* disable ubuntu_libpoppler-0.11, not needed anymore

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: texnodes.h 3261 2009-12-18 11:38:21Z taco $ */
 
21
 
 
22
#include <stdarg.h>
 
23
 
 
24
#ifndef __NODES_H__
 
25
#  define __NODES_H__
 
26
 
 
27
/* these are in texlang.c */
 
28
 
 
29
#  define set_vlink(a,b)  vlink(a)=b
 
30
#  define get_vlink(a)  vlink(a)
 
31
#  define get_character(a)  character(a)
 
32
 
 
33
extern halfword insert_discretionary(halfword t, halfword pre, halfword post,
 
34
                                     halfword replace);
 
35
extern halfword insert_syllable_discretionary(halfword t, lang_variables * lan);
 
36
extern halfword insert_word_discretionary(halfword t, lang_variables * lan);
 
37
extern halfword insert_complex_discretionary(halfword t, lang_variables * lan,
 
38
                                             halfword pre, halfword post,
 
39
                                             halfword replace);
 
40
extern halfword insert_character(halfword t, int n);
 
41
extern void set_disc_field(halfword f, halfword t);
 
42
 
 
43
 
 
44
#  define max_halfword  0x3FFFFFFF
 
45
#  define max_dimen     0x3FFFFFFF
 
46
#  ifndef null
 
47
#    define null         0
 
48
#  endif
 
49
#  define null_flag    -0x40000000
 
50
#  define zero_glue 0
 
51
#  define normal 0
 
52
 
 
53
#  define vinfo(a)           varmem[(a)].hh.v.LH
 
54
#  define vlink(a)           varmem[(a)].hh.v.RH
 
55
#  define type(a)            varmem[(a)].hh.u.B0
 
56
#  define subtype(a)         varmem[(a)].hh.u.B1
 
57
#  define node_attr(a)       vinfo((a)+1)
 
58
#  define alink(a)           vlink((a)+1)
 
59
 
 
60
#  define node_size(a)       varmem[(a)].hh.v.LH
 
61
 
 
62
#  define rlink(a)           vlink((a)+1)
 
63
                                        /* aka alink() */
 
64
#  define llink(a)           vinfo((a)+1)
 
65
                                        /* overlaps with node_attr() */
 
66
 
 
67
#  define add_glue_ref(a) glue_ref_count(a)++   /* new reference to a glue spec */
 
68
 
 
69
/* really special head node pointers that only need links */
 
70
 
 
71
#  define temp_node_size 2
 
72
 
 
73
/* attribute lists */
 
74
 
 
75
#  define UNUSED_ATTRIBUTE -0x7FFFFFFF  /* as low as it goes */
 
76
 
 
77
/* it is convenient to have attribute list nodes and attribute node
 
78
 * be the same size
 
79
 */
 
80
 
 
81
#  define attribute_node_size 2
 
82
 
 
83
#  define attr_list_ref(a)   vinfo((a)+1)
 
84
                                        /* the reference count */
 
85
#  define attribute_id(a)    vinfo((a)+1)
 
86
#  define attribute_value(a) vlink((a)+1)
 
87
 
 
88
#  define cache_disabled max_halfword
 
89
#  define add_node_attr_ref(a) { if (a!=null)  attr_list_ref((a))++; }
 
90
 
 
91
#  define  replace_attribute_list(a,b)  do {              \
 
92
    delete_attribute_ref(node_attr(a));                 \
 
93
    node_attr(a)=b;                                     \
 
94
  } while (0)
 
95
 
 
96
extern void update_attribute_cache(void);
 
97
extern halfword copy_attribute_list(halfword n);
 
98
extern halfword do_set_attribute(halfword p, int i, int val);
 
99
 
 
100
 
 
101
/* a glue spec */
 
102
#  define glue_spec_size 4
 
103
#  define stretch(a)        vlink((a)+1)
 
104
/* width == a+2 */
 
105
#  define shrink(a)         vinfo((a)+1)
 
106
#  define stretch_order(a)  type((a)+3)
 
107
#  define shrink_order(a)   subtype((a)+3)
 
108
#  define glue_ref_count(a) vlink((a)+3)
 
109
 
 
110
#  define width_offset 2
 
111
#  define depth_offset 3
 
112
#  define height_offset 4
 
113
#  define list_offset 6
 
114
 
 
115
typedef enum {
 
116
    cond_math_glue = 98,        /* special |subtype| to suppress glue in the next node */
 
117
    mu_glue,                    /* |subtype| for math glue */
 
118
    a_leaders,                  /* |subtype| for aligned leaders */
 
119
    c_leaders,                  /* |subtype| for centered leaders */
 
120
    x_leaders,                  /* |subtype| for expanded leaders */
 
121
    g_leaders                   /* |subtype| for global (page) leaders */
 
122
} glue_subtype_codes;
 
123
 
 
124
/* normal nodes */
 
125
 
 
126
#  define inf_bad  10000        /* infinitely bad value */
 
127
#  define inf_penalty inf_bad   /*``infinite'' penalty value */
 
128
#  define eject_penalty -(inf_penalty)  /*``negatively infinite'' penalty value */
 
129
 
 
130
#  define penalty_node_size 3
 
131
#  define penalty(a)       vlink((a)+2)
 
132
 
 
133
#  define glue_node_size 4
 
134
#  define glue_ptr(a)      vinfo((a)+2)
 
135
#  define leader_ptr(a)    vlink((a)+2)
 
136
#  define synctex_tag_glue(a)  vinfo((a)+3)
 
137
#  define synctex_line_glue(a) vlink((a)+3)
 
138
 
 
139
/* disc nodes could eventually be smaller, because the indirect 
 
140
   pointers are not really needed (8 instead of 10).
 
141
 */
 
142
 
 
143
#  define disc_node_size 10
 
144
 
 
145
typedef enum {
 
146
    discretionary_disc = 0,
 
147
    explicit_disc,
 
148
    automatic_disc,
 
149
    syllable_disc,
 
150
    init_disc,                  /* first of a duo of syllable_discs */
 
151
    select_disc,                /* second of a duo of syllable_discs */
 
152
} discretionary_types;
 
153
 
 
154
#  define pre_break_head(a)   ((a)+4)
 
155
#  define post_break_head(a)  ((a)+6)
 
156
#  define no_break_head(a)    ((a)+8)
 
157
 
 
158
#  define pre_break(a)     vinfo((a)+2)
 
159
#  define post_break(a)    vlink((a)+2)
 
160
#  define no_break(a)      vlink((a)+3)
 
161
#  define tlink llink
 
162
 
 
163
#  define vlink_pre_break(a)  vlink(pre_break_head(a))
 
164
#  define vlink_post_break(a) vlink(post_break_head(a))
 
165
#  define vlink_no_break(a)   vlink(no_break_head(a))
 
166
 
 
167
#  define tlink_pre_break(a)  tlink(pre_break_head(a))
 
168
#  define tlink_post_break(a) tlink(post_break_head(a))
 
169
#  define tlink_no_break(a)   tlink(no_break_head(a))
 
170
 
 
171
#  define kern_node_size 4
 
172
#  define explicit 1            /*|subtype| of kern nodes from \.{\\kern} and \.{\\/} */
 
173
#  define acc_kern 2            /*|subtype| of kern nodes from accents */
 
174
#  define synctex_tag_kern(a)  vinfo((a)+3)
 
175
#  define synctex_line_kern(a) vlink((a)+3)
 
176
 
 
177
#  define box_node_size 9
 
178
 
 
179
#  define HLIST_SUBTYPE_UNKNOWN 0
 
180
#  define HLIST_SUBTYPE_LINE 1
 
181
#  define HLIST_SUBTYPE_HBOX 2
 
182
 
 
183
#  define width(a)            varmem[(a)+2].cint
 
184
#  define depth(a)            varmem[(a)+3].cint
 
185
#  define height(a)           varmem[(a)+4].cint
 
186
#  define shift_amount(a)     vlink((a)+5)
 
187
#  define box_dir(a)          vinfo((a)+5)
 
188
#  define list_ptr(a)         vlink((a)+6)
 
189
#  define glue_order(a)       subtype((a)+6)
 
190
#  define glue_sign(a)        type((a)+6)
 
191
#  define glue_set(a)         varmem[(a)+7].gr
 
192
#  define synctex_tag_box(a)  vinfo((a)+8)
 
193
#  define synctex_line_box(a) vlink((a)+8)
 
194
 
 
195
 
 
196
/* unset nodes */
 
197
#  define glue_stretch(a)  varmem[(a)+7].cint
 
198
#  define glue_shrink      shift_amount
 
199
#  define span_count       subtype
 
200
 
 
201
#  define rule_node_size 7
 
202
#  define rule_dir(a)      vlink((a)+5)
 
203
#  define synctex_tag_rule(a)  vinfo((a)+6)
 
204
#  define synctex_line_rule(a) vlink((a)+6)
 
205
 
 
206
#  define mark_node_size 3
 
207
#  define mark_ptr(a)      vlink((a)+2)
 
208
#  define mark_class(a)    vinfo((a)+2)
 
209
 
 
210
#  define adjust_node_size 3
 
211
#  define adjust_pre       subtype
 
212
#  define adjust_ptr(a)    vlink(a+2)
 
213
 
 
214
#  define glyph_node_size 5
 
215
 
 
216
#  define character(a)    vinfo((a)+2)
 
217
#  define font(a)         vlink((a)+2)
 
218
#  define lang_data(a)    vinfo((a)+3)
 
219
#  define lig_ptr(a)      vlink((a)+3)
 
220
#  define x_displace(a)   vinfo((a)+4)
 
221
#  define y_displace(a)   vlink((a)+4)
 
222
#  define is_char_node(a) (a!=null && type(a)==glyph_node)
 
223
 
 
224
#  define char_lang(a)     ((const int)(signed short)(((signed int)((unsigned)lang_data(a)&0x7FFF0000)<<1)>>17))
 
225
#  define char_lhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x0000FF00)>>8))
 
226
#  define char_rhmin(a)    ((const int)(((unsigned)lang_data(a) & 0x000000FF)))
 
227
#  define char_uchyph(a)   ((const int)(((unsigned)lang_data(a) & 0x80000000)>>31))
 
228
 
 
229
#  define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+                     \
 
230
  (b<<16)+ (((c>0 && c<256) ? c : 255)<<8)+(((d>0 && d<256) ? d : 255))
 
231
 
 
232
#  define init_lang_data(a)      lang_data(a)=256+1
 
233
 
 
234
#  define set_char_lang(a,b)    lang_data(a)=make_lang_data(char_uchyph(a),b,char_lhmin(a),char_rhmin(a))
 
235
#  define set_char_lhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),b,char_rhmin(a))
 
236
#  define set_char_rhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),char_lhmin(a),b)
 
237
#  define set_char_uchyph(a,b)  lang_data(a)=make_lang_data(b,char_lang(a),char_lhmin(a),char_rhmin(a))
 
238
 
 
239
#  define margin_kern_node_size 4
 
240
#  define margin_char(a)  vlink((a)+3)
 
241
 
 
242
/*@# {|subtype| of marginal kerns}*/
 
243
#  define left_side 0
 
244
#  define right_side 1
 
245
 
 
246
#  define math_node_size 4
 
247
#  define surround(a)      vlink((a)+2)
 
248
#  define before 0              /*|subtype| for math node that introduces a formula */
 
249
#  define after 1               /*|subtype| for math node that winds up a formula */
 
250
#  define synctex_tag_math(a)  vinfo((a)+3)
 
251
#  define synctex_line_math(a) vlink((a)+3)
 
252
 
 
253
#  define ins_node_size 6
 
254
#  define float_cost(a)    varmem[(a)+2].cint
 
255
#  define ins_ptr(a)       vinfo((a)+5)
 
256
#  define split_top_ptr(a) vlink((a)+5)
 
257
 
 
258
 
 
259
#  define page_ins_node_size 5
 
260
 
 
261
/* height = 4 */
 
262
 
 
263
typedef enum {
 
264
    hlist_node = 0,
 
265
    vlist_node = 1,
 
266
    rule_node,
 
267
    ins_node,
 
268
    mark_node,
 
269
    adjust_node,
 
270
    /* 6 used to be ligatures */
 
271
    disc_node = 7,
 
272
    whatsit_node,
 
273
    math_node,
 
274
    glue_node,                  /* 10 */
 
275
    kern_node,
 
276
    penalty_node,
 
277
    unset_node,
 
278
    style_node,
 
279
    choice_node,                /* 15 */
 
280
    simple_noad,
 
281
    old_op_noad,
 
282
    old_bin_noad,
 
283
    old_rel_noad,
 
284
    old_open_noad,              /* 20 */
 
285
    old_close_noad,
 
286
    old_punct_noad,
 
287
    old_inner_noad,
 
288
    radical_noad,
 
289
    fraction_noad,              /* 25 */
 
290
    old_under_noad,
 
291
    old_over_noad,
 
292
    accent_noad,
 
293
    old_vcenter_noad,
 
294
    fence_noad,                 /* 30 */
 
295
    math_char_node,             /* kernel fields */
 
296
    sub_box_node,
 
297
    sub_mlist_node,
 
298
    math_text_char_node,
 
299
    delim_node,                 /* shield fields */
 
300
    margin_kern_node,
 
301
    glyph_node,
 
302
    align_record_node,
 
303
    pseudo_file_node,
 
304
    pseudo_line_node,           /* 40 */
 
305
    inserting_node,
 
306
    split_up_node,
 
307
    expr_node,
 
308
    nesting_node,
 
309
    span_node,                  /* 45 */
 
310
    attribute_node,
 
311
    glue_spec_node,
 
312
    attribute_list_node,
 
313
    action_node,
 
314
    temp_node,                  /* 50 */
 
315
    align_stack_node,
 
316
    movement_node,
 
317
    if_node,
 
318
    unhyphenated_node,
 
319
    hyphenated_node,            /* 55 */
 
320
    delta_node,
 
321
    passive_node,
 
322
    shape_node,
 
323
} node_types;
 
324
 
 
325
#  define MAX_NODE_TYPE 58
 
326
 
 
327
#  define last_known_node temp_node     /* used by \lastnodetype */
 
328
 
 
329
#  define movement_node_size 3
 
330
#  define expr_node_size 3
 
331
#  define if_node_size 2
 
332
#  define align_stack_node_size 6
 
333
#  define nesting_node_size 2
 
334
 
 
335
#  define span_node_size 3
 
336
#  define span_span(a) vlink((a)+1)
 
337
#  define span_link(a) vinfo((a)+1)
 
338
 
 
339
#  define pseudo_file_node_size 2
 
340
#  define pseudo_lines(a) vlink((a)+1)
 
341
 
 
342
#  define nodetype_has_attributes(t) (((t)<=glyph_node) && ((t)!=unset_node))
 
343
 
 
344
/* style and choice nodes */
 
345
/* style nodes can be smaller, the information is encoded in |subtype|,
 
346
   but choice nodes are on-the-spot converted to style nodes */
 
347
 
 
348
#  define style_node_size 4     /* number of words in a style node */
 
349
 
 
350
#  define display_mlist(a) vinfo((a)+2) /* mlist to be used in display style */
 
351
#  define text_mlist(a) vlink((a)+2)    /* mlist to be used in text style */
 
352
#  define script_mlist(a) vinfo((a)+3)  /* mlist to be used in script style */
 
353
#  define script_script_mlist(a) vlink((a)+3)   /* mlist to be used in scriptscript style */
 
354
 
 
355
/* regular noads */
 
356
 
 
357
#  define noad_size 4           /* number of words in a normal noad */
 
358
#  define new_hlist(a) vlink((a)+2)     /* the translation of an mlist */
 
359
#  define nucleus(a)   vinfo((a)+2)     /* the |nucleus| field of a noad */
 
360
#  define supscr(a)    vlink((a)+3)     /* the |supscr| field of a noad */
 
361
#  define subscr(a)    vinfo((a)+3)     /* the |subscr| field of a noad */
 
362
 
 
363
/* accent noads */
 
364
/* like a regular noad, but with two extra fields. */
 
365
 
 
366
#  define accent_noad_size 5    /*number of |mem| words in an accent noad */
 
367
#  define accent_chr(a) vinfo((a)+4)    /* the |accent_chr| field of an accent noad */
 
368
#  define bot_accent_chr(a) vlink((a)+4)        /* the |bot_accent_chr| field of an accent noad */
 
369
 
 
370
/* left and right noads */
 
371
 
 
372
#  define fence_noad_size 3
 
373
#  define delimiter(a)      vlink((a)+2)        /* |delimiter| field in left and right noads */
 
374
 
 
375
/* subtype of fence noads */
 
376
 
 
377
#  define left_noad_side 1
 
378
#  define middle_noad_side 2
 
379
#  define right_noad_side 3
 
380
 
 
381
/* fraction noads */
 
382
 
 
383
#  define fraction_noad_size 5  /*number of |mem| words in a fraction noad */
 
384
#  define thickness(a)       vlink((a)+2)       /* |thickness| field in a fraction noad */
 
385
#  define numerator(a)       vlink((a)+3)       /*|numerator| field in a fraction noad */
 
386
#  define denominator(a)     vinfo((a)+3)       /*|denominator| field in a fraction noad */
 
387
#  define left_delimiter(a)  vlink((a)+4)       /* first delimiter field of a noad */
 
388
#  define right_delimiter(a) vinfo((a)+4)       /* second delimiter field of a fraction noad */
 
389
 
 
390
/* radical noads */
 
391
/* this is like a fraction, but it only stores a |left_delimiter| */
 
392
#  define radical_noad_size 5   /*number of |mem| words in a radical noad */
 
393
 
 
394
#  define degree(a) vinfo((a)+4)        /* the root degree in a radical noad */
 
395
 
 
396
#  define math_kernel_node_size 3
 
397
 
 
398
/* accessors for the |nucleus|-style node fields */
 
399
#  define math_fam(a)       vinfo((a)+2)
 
400
#  define math_character(a) vlink((a)+2)
 
401
#  define math_list(a) vlink((a)+2)
 
402
 
 
403
/* accessors for the |delimiter|-style two-word subnode fields */
 
404
 
 
405
#  define math_shield_node_size 4
 
406
                                /* not used yet */
 
407
 
 
408
#  define small_fam(A)  vinfo((A)+2)    /* |fam| for ``small'' delimiter */
 
409
#  define small_char(A) vlink((A)+2)    /* |character| for ``small'' delimiter */
 
410
#  define large_fam(A)  vinfo((A)+3)    /* |fam| for ``large'' delimiter */
 
411
#  define large_char(A) vlink((A)+3)    /* |character| for ``large'' delimiter */
 
412
 
 
413
typedef enum {
 
414
    open_node = 0,
 
415
    write_node,
 
416
    close_node,
 
417
    special_node,
 
418
    language_node,
 
419
    set_language_code,
 
420
    local_par_node,
 
421
    dir_node,
 
422
    pdf_literal_node,
 
423
    pdf_obj_code,
 
424
    pdf_refobj_node,            /* 10 */
 
425
    pdf_xform_code,
 
426
    pdf_refxform_node,
 
427
    pdf_ximage_code,
 
428
    pdf_refximage_node,
 
429
    pdf_annot_node,
 
430
    pdf_start_link_node,
 
431
    pdf_end_link_node,
 
432
    pdf_outline_code,
 
433
    pdf_dest_node,
 
434
    pdf_thread_node,            /* 20 */
 
435
    pdf_start_thread_node,
 
436
    pdf_end_thread_node,
 
437
    pdf_save_pos_node,
 
438
    pdf_thread_data_node,
 
439
    pdf_link_data_node,
 
440
    pdf_names_code,
 
441
    pdf_font_attr_code,
 
442
    pdf_include_chars_code,
 
443
    pdf_map_file_code,
 
444
    pdf_map_line_code,          /* 30 */
 
445
    pdf_trailer_code,
 
446
    pdf_font_expand_code,
 
447
    set_random_seed_code,
 
448
    pdf_glyph_to_unicode_code,
 
449
    late_lua_node,              /* 35 */
 
450
    close_lua_node,
 
451
    save_cat_code_table_code,
 
452
    init_cat_code_table_code,
 
453
    pdf_colorstack_node,
 
454
    pdf_setmatrix_node,         /* 40 */
 
455
    pdf_save_node,
 
456
    pdf_restore_node,
 
457
    cancel_boundary_node,
 
458
    user_defined_node           /* 44 */
 
459
} whatsit_types;
 
460
 
 
461
#  define MAX_WHATSIT_TYPE 44
 
462
 
 
463
#  define  get_node_size(i,j) (i!=whatsit_node ? node_data[i].size : whatsit_node_data[j].size)
 
464
#  define  get_node_name(i,j) (i!=whatsit_node ? node_data[i].name : whatsit_node_data[j].name)
 
465
 
 
466
 
 
467
#  define pdf_info_code pdf_thread_data_node
 
468
#  define pdf_catalog_code  pdf_link_data_node
 
469
 
 
470
#  define GLYPH_CHARACTER     (1 << 0)
 
471
#  define GLYPH_LIGATURE      (1 << 1)
 
472
#  define GLYPH_GHOST         (1 << 2)
 
473
#  define GLYPH_LEFT          (1 << 3)
 
474
#  define GLYPH_RIGHT         (1 << 4)
 
475
 
 
476
#  define is_character(p)        ((subtype(p)) & GLYPH_CHARACTER)
 
477
#  define is_ligature(p)         ((subtype(p)) & GLYPH_LIGATURE )
 
478
#  define is_ghost(p)            ((subtype(p)) & GLYPH_GHOST    )
 
479
 
 
480
#  define is_simple_character(p) (is_character(p) && !is_ligature(p) && !is_ghost(p))
 
481
 
 
482
#  define is_leftboundary(p)         (is_ligature(p) && ((subtype(p)) & GLYPH_LEFT  ))
 
483
#  define is_rightboundary(p)    (is_ligature(p) && ((subtype(p)) & GLYPH_RIGHT ))
 
484
#  define is_leftghost(p)            (is_ghost(p)    && ((subtype(p)) & GLYPH_LEFT  ))
 
485
#  define is_rightghost(p)           (is_ghost(p)    && ((subtype(p)) & GLYPH_RIGHT ))
 
486
 
 
487
#  define set_is_glyph(p)         subtype(p) &= ~GLYPH_CHARACTER
 
488
#  define set_is_character(p)     subtype(p) |= GLYPH_CHARACTER
 
489
#  define set_is_ligature(p)      subtype(p) |= GLYPH_LIGATURE
 
490
#  define set_is_ghost(p)         subtype(p) |= GLYPH_GHOST
 
491
 
 
492
#  define set_to_glyph(p)         subtype(p) = (subtype(p) & 0xFF00)
 
493
#  define set_to_character(p)     subtype(p) = (subtype(p) & 0xFF00) | GLYPH_CHARACTER
 
494
#  define set_to_ligature(p)      subtype(p) = (subtype(p) & 0xFF00) | GLYPH_LIGATURE
 
495
#  define set_to_ghost(p)         subtype(p) = (subtype(p) & 0xFF00) | GLYPH_GHOST
 
496
 
 
497
#  define set_is_leftboundary(p)  { set_to_ligature(p); subtype(p) |= GLYPH_LEFT;  }
 
498
#  define set_is_rightboundary(p) { set_to_ligature(p); subtype(p) |= GLYPH_RIGHT; }
 
499
#  define set_is_leftghost(p)     { set_to_ghost(p);    subtype(p) |= GLYPH_LEFT;  }
 
500
#  define set_is_rightghost(p)    { set_to_ghost(p);    subtype(p) |= GLYPH_RIGHT; }
 
501
 
 
502
 
 
503
#  define special_node_size 3
 
504
 
 
505
#  define dir_node_size 6
 
506
#  define dir_dir(a)       vinfo((a)+2)
 
507
#  define dir_level(a)     vlink((a)+2)
 
508
#  define dir_dvi_ptr(a)   vinfo((a)+3)
 
509
#  define dir_dvi_h(a)     vlink((a)+3) /* obsolete */
 
510
#  define dir_refpos_h(a)  vinfo((a)+4)
 
511
#  define dir_refpos_v(a)  vlink((a)+4)
 
512
#  define dir_cur_h(a)     vinfo((a)+5)
 
513
#  define dir_cur_v(a)     vlink((a)+5)
 
514
 
 
515
#  define write_node_size 3
 
516
#  define close_node_size 3
 
517
#  define write_tokens(a)  vlink(a+2)
 
518
#  define write_stream(a)  vinfo(a+2)
 
519
 
 
520
#  define open_node_size 4
 
521
#  define open_name(a)   vlink((a)+2)
 
522
#  define open_area(a)   vinfo((a)+3)
 
523
#  define open_ext(a)    vlink((a)+3)
 
524
 
 
525
#  define late_lua_node_size 4
 
526
#  define late_lua_data(a)        vlink((a)+2)
 
527
#  define late_lua_reg(a)         vinfo((a)+2)
 
528
#  define late_lua_name(a)        vlink((a)+3)
 
529
 
 
530
#  define local_par_size 6
 
531
 
 
532
#  define local_pen_inter(a)       vinfo((a)+2)
 
533
#  define local_pen_broken(a)      vlink((a)+2)
 
534
#  define local_box_left(a)        vlink((a)+3)
 
535
#  define local_box_left_width(a)  vinfo((a)+3)
 
536
#  define local_box_right(a)       vlink((a)+4)
 
537
#  define local_box_right_width(a) vinfo((a)+4)
 
538
#  define local_par_dir(a)         vinfo((a)+5)
 
539
 
 
540
 
 
541
/* type of literal data */
 
542
#  define lua_refid_literal      1      /* not a |normal| string */
 
543
 
 
544
/* literal ctm types */
 
545
 
 
546
typedef enum {
 
547
    set_origin = 0,
 
548
    direct_page,
 
549
    direct_always,
 
550
    scan_special,
 
551
} ctm_transform_modes;
 
552
 
 
553
 
 
554
#  define pdf_refobj_node_size 3
 
555
 
 
556
#  define pdf_obj_objnum(a)    vinfo((a) + 2)
 
557
 
 
558
#  define pdf_refxform_node_size  6
 
559
#  define pdf_refximage_node_size 6
 
560
#  define pdf_annot_node_size 8
 
561
#  define pdf_dest_node_size 8
 
562
#  define pdf_thread_node_size 8
 
563
 
 
564
/*
 
565
when a whatsit node representing annotation is created, words |1..3| are
 
566
width, height and depth of this annotation; after shipping out words |1..4|
 
567
are rectangle specification of annotation. For whatsit node representing
 
568
destination |pdf_ann_left| and |pdf_ann_top| are used for some types of destinations
 
569
*/
 
570
 
 
571
/* coordinates of destinations/threads/annotations (in whatsit node) */
 
572
#  define pdf_ann_left(a)      varmem[(a) + 2].cint
 
573
#  define pdf_ann_top(a)       varmem[(a) + 3].cint
 
574
#  define pdf_ann_right(a)     varmem[(a) + 4].cint
 
575
#  define pdf_ann_bottom(a)    varmem[(a) + 5].cint
 
576
 
 
577
#  define pdf_literal_data(a)  vlink((a)+2)
 
578
#  define pdf_literal_mode(a)  type((a)+2)
 
579
#  define pdf_literal_type(a)  subtype((a)+2)
 
580
 
 
581
#  define pdf_ximage_index(a)     vinfo((a) + 5)        /* /Im* number and image index in array */
 
582
#  define pdf_ximage_transform(a) vlink((a) + 5)
 
583
#  define pdf_xform_objnum(a)     vinfo((a) + 5)
 
584
#  define pdf_xform_transform(a)  vlink((a) + 5)
 
585
 
 
586
#  define pdf_annot_data(a)       vinfo((a) + 6)
 
587
#  define pdf_link_attr(a)        vinfo((a) + 6)
 
588
#  define pdf_link_action(a)      vlink((a) + 6)
 
589
#  define pdf_annot_objnum(a)     varmem[(a) + 7].cint
 
590
#  define pdf_link_objnum(a)      varmem[(a) + 7].cint
 
591
 
 
592
#  define pdf_dest_type(a)          type((a) + 6)
 
593
#  define pdf_dest_named_id(a)      subtype((a) + 6)
 
594
#  define pdf_dest_id(a)            vlink((a) + 6)
 
595
#  define pdf_dest_xyz_zoom(a)      vinfo((a) + 7)
 
596
#  define pdf_dest_objnum(a)        vlink((a) + 7)
 
597
 
 
598
#  define pdf_thread_named_id(a)    subtype((a) + 6)
 
599
#  define pdf_thread_id(a)          vlink((a) + 6)
 
600
#  define pdf_thread_attr(a)        vinfo((a) + 7)
 
601
 
 
602
#  define pdf_end_link_node_size 3
 
603
#  define pdf_end_thread_node_size 3
 
604
#  define pdf_save_pos_node_size 3
 
605
 
 
606
#  define pdf_colorstack_node_size 4
 
607
#  define pdf_setmatrix_node_size 3
 
608
 
 
609
#  define pdf_colorstack_stack(a)  vlink((a)+2)
 
610
#  define pdf_colorstack_cmd(a)    vinfo((a)+2)
 
611
#  define pdf_colorstack_data(a)   vlink((a)+3)
 
612
#  define pdf_setmatrix_data(a)    vlink((a)+2)
 
613
 
 
614
#  define pdf_save_node_size     3
 
615
#  define pdf_restore_node_size  3
 
616
 
 
617
typedef enum {
 
618
    colorstack_set = 0,
 
619
    colorstack_push,
 
620
    colorstack_pop,
 
621
    colorstack_current
 
622
} colorstack_commands;
 
623
 
 
624
#  define colorstack_data   colorstack_push     /* last value where data field is set */
 
625
 
 
626
#  define user_defined_node_size 4
 
627
#  define user_node_type(a)  vinfo((a)+2)
 
628
#  define user_node_id(a)    vlink((a)+2)
 
629
#  define user_node_value(a) vinfo((a)+3)
 
630
 
 
631
#  define cancel_boundary_size   3
 
632
 
 
633
#  define active_node_size 4    /*number of words in extended active nodes */
 
634
#  define fitness subtype       /*|very_loose_fit..tight_fit| on final line for this break */
 
635
#  define break_node(a) vlink((a)+1)    /*pointer to the corresponding passive node */
 
636
#  define line_number(a) vinfo((a)+1)   /*line that begins at this breakpoint */
 
637
#  define total_demerits(a) varmem[(a)+2].cint  /* the quantity that \TeX\ minimizes */
 
638
#  define active_short(a) vinfo(a+3)    /* |shortfall| of this line */
 
639
#  define active_glue(a)  vlink(a+3)    /*corresponding glue stretch or shrink */
 
640
 
 
641
#  define passive_node_size 7
 
642
#  define cur_break(a)                   vlink((a)+1)   /*in passive node, points to position of this breakpoint */
 
643
#  define prev_break(a)                  vinfo((a)+1)   /*points to passive node that should precede this one */
 
644
#  define passive_pen_inter(a)           vinfo((a)+2)
 
645
#  define passive_pen_broken(a)          vlink((a)+2)
 
646
#  define passive_left_box(a)            vlink((a)+3)
 
647
#  define passive_left_box_width(a)      vinfo((a)+3)
 
648
#  define passive_last_left_box(a)       vlink((a)+4)
 
649
#  define passive_last_left_box_width(a) vinfo((a)+4)
 
650
#  define passive_right_box(a)           vlink((a)+5)
 
651
#  define passive_right_box_width(a)     vinfo((a)+5)
 
652
#  define serial(a)                      vlink((a)+6)   /* serial number for symbolic identification */
 
653
 
 
654
#  define delta_node_size 10    /* 8 fields, stored in a+1..9 */
 
655
 
 
656
#  define couple_nodes(a,b) {assert(b!=null);vlink(a)=b;alink(b)=a;}
 
657
#  define try_couple_nodes(a,b) if (b==null) vlink(a)=b; else {couple_nodes(a,b);}
 
658
#  define uncouple_node(a) {assert(a!=null);vlink(a)=null;alink(a)=null;}
 
659
 
 
660
#  define cache_disabled max_halfword
 
661
 
 
662
extern void delete_attribute_ref(halfword b);
 
663
extern void build_attribute_list(halfword b);
 
664
 
 
665
extern int unset_attribute(halfword n, int c, int w);
 
666
extern void set_attribute(halfword n, int c, int w);
 
667
extern int has_attribute(halfword n, int c, int w);
 
668
 
 
669
extern halfword new_span_node(halfword n, int c, scaled w);
 
670
 
 
671
extern void print_short_node_contents(halfword n);
 
672
extern void show_node_list(int i);
 
673
extern pointer actual_box_width(pointer r, scaled base_width);
 
674
 
 
675
/* TH: these two defines still need checking. The node ordering in luatex is not 
 
676
   quite the same as in tex82 */
 
677
 
 
678
#  define precedes_break(a) (type((a))<math_node && (type(a)!=whatsit_node || subtype(a)!=dir_node))
 
679
#  define non_discardable(a) (type((a))<math_node)
 
680
 
 
681
/* from luanode.c */
 
682
 
 
683
typedef struct _node_info {
 
684
    int id;
 
685
    int size;
 
686
    char **fields;
 
687
    char *name;
 
688
} node_info;
 
689
 
 
690
extern node_info node_data[];
 
691
extern node_info whatsit_node_data[];
 
692
extern halfword new_node(int i, int j);
 
693
extern void flush_node_list(halfword);
 
694
extern void flush_node(halfword);
 
695
extern halfword copy_node_list(halfword);
 
696
extern halfword copy_node(halfword);
 
697
extern void check_node(halfword);
 
698
extern void check_node_mem(void);
 
699
extern void fix_node_list(halfword);
 
700
extern int fix_node_lists;
 
701
extern char *sprint_node_mem_usage(void);
 
702
extern halfword raw_glyph_node(void);
 
703
extern halfword new_glyph_node(void);
 
704
extern int valid_node(halfword);
 
705
 
 
706
typedef enum {
 
707
    normal_g = 0,
 
708
    sfi,
 
709
    fil,
 
710
    fill,
 
711
    filll
 
712
} glue_orders;
 
713
 
 
714
#  define zero_glue       0
 
715
#  define sfi_glue        zero_glue+glue_spec_size
 
716
#  define fil_glue        sfi_glue+glue_spec_size
 
717
#  define fill_glue       fil_glue+glue_spec_size
 
718
#  define ss_glue         fill_glue+glue_spec_size
 
719
#  define fil_neg_glue    ss_glue+glue_spec_size
 
720
#  define page_ins_head   fil_neg_glue+glue_spec_size
 
721
#  define contrib_head    page_ins_head+temp_node_size
 
722
#  define page_head       contrib_head+temp_node_size
 
723
#  define temp_head       page_head+temp_node_size
 
724
#  define hold_head       temp_head+temp_node_size
 
725
#  define adjust_head     hold_head+temp_node_size
 
726
#  define pre_adjust_head adjust_head+temp_node_size
 
727
#  define active          pre_adjust_head+temp_node_size
 
728
#  define align_head      active+active_node_size
 
729
#  define end_span        align_head+temp_node_size
 
730
#  define begin_point     end_span+span_node_size
 
731
#  define end_point       begin_point+glyph_node_size
 
732
#  define var_mem_stat_max (end_point+glyph_node_size-1)
 
733
 
 
734
#  define stretching 1
 
735
#  define shrinking 2
 
736
 
 
737
#  define is_running(A) ((A)==null_flag)        /* tests for a running dimension */
 
738
 
 
739
extern halfword tail_of_list(halfword p);
 
740
extern void delete_glue_ref(halfword p);
 
741
 
 
742
extern int var_used;
 
743
extern halfword temp_ptr;
 
744
 
 
745
#  define cache_disabled max_halfword
 
746
 
 
747
extern int max_used_attr;
 
748
extern halfword attr_list_cache;
 
749
 
 
750
extern halfword new_null_box(void);
 
751
extern halfword new_rule(void);
 
752
extern halfword new_glyph(int f, int c);
 
753
extern quarterword norm_min(int h);
 
754
extern halfword new_char(int f, int c);
 
755
extern scaled glyph_width(halfword p);
 
756
extern scaled glyph_height(halfword p);
 
757
extern scaled glyph_depth(halfword p);
 
758
extern halfword new_disc(void);
 
759
extern halfword new_math(scaled w, int s);
 
760
extern halfword new_spec(halfword p);
 
761
extern halfword new_param_glue(int n);
 
762
extern halfword new_glue(halfword q);
 
763
extern halfword new_skip_param(int n);
 
764
extern halfword new_kern(scaled w);
 
765
extern halfword new_penalty(int m);
 
766
 
 
767
#endif