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