~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: 2007-12-10 10:24:34 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071210102434-9w9ljypghznwb4dy
Tags: 0.20.1-1
* new upstreams, add the announcements with changes to the debian dir
* call build.sh.linux with bash, not with sh, otherwise building breaks
  (thanks to Pascal de Bruijn <pmjdebruijn@gmail.com> from Ubuntu for
  letting us know) [np]
* update libpoppler patch
* change the texdoclua patch to use the new os.tmpdir with a template of
  /tmp/luatex.XXXXXX
* bump standards version to 3.7.3, no changes necessary
* convert copyright file to utf-8

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#ifndef __NODES_H__
5
5
#define __NODES_H__
6
6
 
 
7
/* these don't really belong here */
 
8
 
 
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 */
 
11
 
 
12
 
7
13
/* these are in texlang.c */
8
14
 
9
15
#define set_vlink(a,b)  vlink(a)=b
16
22
extern halfword insert_complex_discretionary ( halfword t,   lang_variables *lan, 
17
23
                                               halfword pre,  halfword post,  halfword replace);
18
24
extern halfword insert_character ( halfword t,  int n);
 
25
extern void set_disc_field (halfword f, halfword t);
19
26
 
20
27
 
21
28
#define max_halfword  0x3FFFFFFF
22
29
#ifndef null
23
 
#define null         -0x3FFFFFFF
 
30
#define null         0
24
31
#endif
25
32
#define null_flag    -0x40000000
26
33
#define zero_glue 0
27
34
#define normal 0
28
35
 
29
36
#define vinfo(a)           varmem[(a)].hh.v.LH 
30
 
#define node_size(a)       varmem[(a)].hh.v.LH
31
37
#define vlink(a)           varmem[(a)].hh.v.RH 
32
38
#define type(a)            varmem[(a)].hh.u.B0
33
39
#define subtype(a)         varmem[(a)].hh.u.B1
34
40
#define node_attr(a)       vinfo((a)+1)
35
41
#define alink(a)           vlink((a)+1)
36
42
 
 
43
#define node_size(a)       varmem[(a)].hh.v.LH
 
44
 
37
45
#define rlink(a)           vlink((a)+1) /* aka alink() */
38
46
#define llink(a)           vinfo((a)+1) /* overlaps with node_attr() */
39
47
 
 
48
#define add_glue_ref(a) glue_ref_count(a)++ /* new reference to a glue spec */
40
49
 
41
50
/* really special head node pointers that only need links */
42
51
 
43
52
#define temp_node_size 2
44
53
 
45
54
/* attribute lists */
 
55
 
 
56
/* it is convenient to have attribute list nodes and attribute node
 
57
 * be the same size
 
58
 */
 
59
 
46
60
#define attribute_node_size 2
47
 
#define attribute_list_node_size 2
48
 
 
49
 
#define attr_list_ref(a)   vinfo((a)+1)
50
 
#define attribute_id(a)    vlink((a)+1)
51
 
#define attribute_value(a) vinfo((a)+1)
 
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;                                     \
 
72
  } while (0)
 
73
 
 
74
extern void update_attribute_cache (void) ;
 
75
extern halfword copy_attribute_list(halfword n) ;
 
76
extern halfword do_set_attribute(halfword p, int i, int val);
 
77
 
52
78
 
53
79
/* a glue spec */
54
80
#define glue_spec_size 4
77
103
#define pdf_action_tokens(a)      vinfo((a) + 3)
78
104
#define pdf_action_refcount(a)    vlink((a) + 3)
79
105
 
 
106
/*increase count of references to this action*/
 
107
#define add_action_ref(a) pdf_action_refcount((a))++ 
 
108
 
 
109
/* decrease count of references to this
 
110
   action; free it if there is no reference to this action*/
 
111
 
 
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
        }                                                                                                                       \
 
128
  }
 
129
 
 
130
 
 
131
 
80
132
/* normal nodes */
81
133
 
82
134
#define inf_bad  10000  /* infinitely bad value */
90
142
#define glue_ptr(a)      vinfo((a)+2)
91
143
#define leader_ptr(a)    vlink((a)+2)
92
144
 
 
145
/* disc nodes could eventually be smaller, because the indirect 
 
146
   pointers are not really needed (8 instead of 10).
 
147
 */
 
148
 
93
149
#define disc_node_size 10
94
150
 
95
151
typedef enum {
107
163
#define no_break(a)      vlink((a)+3)
108
164
#define tlink llink
109
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))
110
173
 
111
174
#define kern_node_size 3
112
175
#define explicit 1  /*|subtype| of kern nodes from \.{\\kern} and \.{\\/}*/
156
219
#define make_lang_data(a,b,c,d) (a>0 ? (1<<31): 0)+                     \
157
220
  (b<<16)+ (((c>0 && c<256) ? c : 1)<<8)+(((d>0 && d<256) ? d : 1))
158
221
 
 
222
#define init_lang_data(a)      lang_data(a)=256+1
 
223
 
159
224
#define set_char_lang(a,b)    lang_data(a)=make_lang_data(char_uchyph(a),b,char_lhmin(a),char_rhmin(a))
160
225
#define set_char_lhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),b,char_rhmin(a))
161
226
#define set_char_rhmin(a,b)   lang_data(a)=make_lang_data(char_uchyph(a),char_lang(a),char_lhmin(a),b)
180
245
#define ins_ptr(a)       vinfo((a)+5)
181
246
#define split_top_ptr(a) vlink((a)+5)
182
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*/
 
255
/* height = 4 */
 
256
 
183
257
typedef enum {
184
258
  hlist_node = 0, 
185
259
  vlist_node = 1, 
195
269
  kern_node,      
196
270
  penalty_node,   
197
271
  unset_node,   /* 13 */
198
 
  right_noad = 31,
199
 
  action_node = 39,
200
 
  margin_kern_node = 40,
201
 
  glyph_node = 41,
 
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,
202
300
  attribute_node = 42,
203
301
  glue_spec_node = 43,
204
302
  attribute_list_node = 44,
205
 
  last_known_node = 45, /* used by \lastnodetype */
 
303
  action_node = 45,
 
304
  temp_node = 46,
 
305
  align_stack_node = 47,
 
306
  movement_node = 48,
 
307
  if_node = 49,
206
308
  unhyphenated_node = 50, 
207
309
  hyphenated_node = 51,
208
310
  delta_node = 52,
209
 
  passive_node = 53 } node_types ;
 
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)
 
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*/
 
351
 
 
352
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 */
 
357
} math_types;
 
358
 
210
359
 
211
360
typedef enum {
212
361
  open_node = 0,
233
382
  pdf_start_thread_node,
234
383
  pdf_end_thread_node,
235
384
  pdf_save_pos_node,
236
 
  pdf_info_code,
237
 
  pdf_catalog_code,
 
385
  pdf_thread_data_node,
 
386
  pdf_link_data_node,
238
387
  pdf_names_code,
239
388
  pdf_font_attr_code,
240
389
  pdf_include_chars_code,
255
404
  cancel_boundary_node,
256
405
  user_defined_node /* 44 */ } whatsit_types ;
257
406
 
 
407
#define pdf_info_code pdf_thread_data_node
 
408
#define pdf_catalog_code  pdf_link_data_node
 
409
 
258
410
 
259
411
#define GLYPH_CHARACTER     (1 << 0)
260
412
#define GLYPH_LIGATURE      (1 << 1)
289
441
#define set_is_rightghost(p)    { set_to_ghost(p);    subtype(p) |= GLYPH_RIGHT; }
290
442
 
291
443
 
292
 
#define open_node_size 4
293
 
#define write_node_size 3
294
 
#define close_node_size 3
295
444
#define special_node_size 3
296
 
#define language_node_size 4
297
 
#define dir_node_size 5
298
445
 
 
446
#define dir_node_size 4
299
447
#define dir_dir(a)       vinfo((a)+2)
300
448
#define dir_level(a)     vlink((a)+2)
301
449
#define dir_dvi_ptr(a)   vinfo((a)+3)
302
450
#define dir_dvi_h(a)     vlink((a)+3)
303
 
#define what_lang(a)   vlink((a)+2)
304
 
#define what_lhm(a)    type((a)+2)
305
 
#define what_rhm(a)    subtype((a)+2)
 
451
 
 
452
#define write_node_size 3
 
453
#define close_node_size 3
306
454
#define write_tokens(a)  vlink(a+2)
307
455
#define write_stream(a)  vinfo(a+2)
 
456
 
 
457
#define open_node_size 4
308
458
#define open_name(a)   vlink((a)+2)
309
459
#define open_area(a)   vinfo((a)+3)
310
460
#define open_ext(a)    vlink((a)+3)
380
530
  colorstack_pop,
381
531
  colorstack_current } colorstack_commands;
382
532
 
 
533
#define colorstack_data   colorstack_push /* last value where data field is set */
 
534
 
383
535
#define user_defined_node_size 4
384
536
#define user_node_type(a)  vinfo((a)+2)
385
537
#define user_node_id(a)    vlink((a)+2)
395
547
  subst_ex_font  /* substitute fonts */
396
548
} hpack_subtypes;
397
549
 
398
 
#define active_node_size 5 /*number of words in extended active nodes*/
 
550
#define active_node_size 4 /*number of words in extended active nodes*/
399
551
#define fitness subtype /*|very_loose_fit..tight_fit| on final line for this break*/
400
552
#define break_node(a) vlink((a)+1) /*pointer to the corresponding passive node */
401
553
#define line_number(a) vinfo((a)+1) /*line that begins at this breakpoint*/
402
554
#define total_demerits(a) varmem[(a)+2].cint /* the quantity that \TeX\ minimizes*/
403
 
#define active_short(a) varmem[(a)+3].cint /* |shortfall| of this line */
404
 
#define active_glue(a) varmem[(a)+4].cint /*corresponding glue stretch or shrink*/
405
 
 
406
 
#define passive_node_size 8
407
 
#define cur_break                      rlink /*in passive node, points to position of this breakpoint*/
408
 
#define prev_break                     llink /*points to passive node that should precede this one */
409
 
#define passive_pen_inter(a)           varmem[((a)+2)].cint
410
 
#define passive_pen_broken(a)          varmem[((a)+3)].cint
411
 
#define passive_left_box(a)            vlink((a)+4)
412
 
#define passive_left_box_width(a)      vinfo((a)+4)
413
 
#define passive_last_left_box(a)       vlink((a)+5)
414
 
#define passive_last_left_box_width(a) vinfo((a)+5)
415
 
#define passive_right_box(a)           vlink((a)+6)
416
 
#define passive_right_box_width(a)     vinfo((a)+6)
417
 
#define serial(a)                      vlink((a)+7) /* serial number for symbolic identification*/
418
 
 
419
 
#define delta_node_size 11
 
555
#define active_short(a) vinfo(a+3) /* |shortfall| of this line */
 
556
#define active_glue(a)  vlink(a+3) /*corresponding glue stretch or shrink*/
 
557
 
 
558
#define passive_node_size 7
 
559
#define cur_break(a)                   vlink((a)+1) /*in passive node, points to position of this breakpoint*/
 
560
#define prev_break(a)                  vinfo((a)+1) /*points to passive node that should precede this one */
 
561
#define passive_pen_inter(a)           vinfo((a)+2)
 
562
#define passive_pen_broken(a)          vlink((a)+2)
 
563
#define passive_left_box(a)            vlink((a)+3)
 
564
#define passive_left_box_width(a)      vinfo((a)+3)
 
565
#define passive_last_left_box(a)       vlink((a)+4)
 
566
#define passive_last_left_box_width(a) vinfo((a)+4)
 
567
#define passive_right_box(a)           vlink((a)+5)
 
568
#define passive_right_box_width(a)     vinfo((a)+5)
 
569
#define serial(a)                      vlink((a)+6) /* serial number for symbolic identification*/
 
570
 
 
571
#define delta_node_size 10 /* 8 fields, stored in a+1..9 */
420
572
 
421
573
#define couple_nodes(a,b) {assert(b!=null);vlink(a)=b;alink(b)=a;}
422
574
#define try_couple_nodes(a,b) if (b==null) vlink(a)=b; else {couple_nodes(a,b);}
423
575
#define uncouple_node(a) {assert(a!=null);vlink(a)=null;alink(a)=null;}
424
576
 
 
577
#define cache_disabled max_halfword
 
578
 
 
579
extern void delete_attribute_ref(halfword b) ;
 
580
extern void build_attribute_list(halfword b) ;
 
581
 
 
582
extern int unset_attribute(halfword n, int c, int w);
 
583
extern void set_attribute(halfword n, int c, int w);
 
584
extern int has_attribute(halfword n, int c, int w);
 
585
 
 
586
extern halfword new_span_node (halfword n, int c, scaled w);
 
587
extern halfword string_to_pseudo(integer l,integer pool_ptr, integer nl);
 
588
 
425
589
/* TH: these two defines still need checking. The node ordering in luatex is not 
426
590
   quite the same as in tex82 */
427
591
 
428
 
#define precedes_break(a) (type((a))<math_node)
 
592
#define precedes_break(a) (type((a))<math_node && (type(a)!=whatsit_node || subtype(a)!=dir_node))
429
593
#define non_discardable(a) (type((a))<math_node)
430
594
 
431
 
#define NODE_METATABLE "luatex.node"
432
 
 
433
 
#define check_isnode(L,b) (halfword *)luaL_checkudata(L,b,NODE_METATABLE)
434
 
 
435
595
/* from luanode.c */
436
596
 
437
 
extern char * node_names[];
438
 
extern char * whatsit_node_names[];
439
 
extern halfword lua_node_new(int i, int j);
 
597
typedef struct _node_info {
 
598
  int id;
 
599
  int size;
 
600
  char **fields;
 
601
  char *name; 
 
602
}  node_info;
 
603
 
 
604
extern node_info node_data[];
 
605
extern node_info whatsit_node_data[];
 
606
extern halfword new_node(int i, int j);
 
607
extern void flush_node_list(halfword);
 
608
extern void flush_node(halfword);
 
609
extern halfword copy_node_list(halfword);
 
610
extern halfword copy_node(halfword);
 
611
extern void check_node(halfword);
 
612
extern void check_node_mem (void);
 
613
extern void fix_node_list (halfword);
 
614
extern int fix_node_lists;
 
615
extern char *sprint_node_mem_usage (void) ;
 
616
extern halfword raw_glyph_node(void) ;
 
617
extern halfword new_glyph_node(void);
 
618
extern int valid_node(halfword);
 
619
 
 
620
#define unity 0x10000
 
621
typedef enum {
 
622
  normal_g=0,
 
623
  sfi,
 
624
  fil,
 
625
  fill,
 
626
  filll } glue_orders;
440
627
 
441
628
#define zero_glue       0
442
629
#define sfi_glue        zero_glue+glue_spec_size
454
641
#define active          pre_adjust_head+temp_node_size
455
642
#define align_head      active+active_node_size
456
643
#define end_span        align_head+temp_node_size
457
 
 
 
644
#define begin_point     end_span+glyph_node_size
 
645
#define end_point       begin_point+glyph_node_size
458
646
 
459
647
#endif