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