1 /* pdfthread.h
2 
3    Copyright 2009 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 #ifndef PDFTHREAD_H
22 #  define PDFTHREAD_H
23 
24 /* data structure of threads; words 1..4 represent the coordinates of the  corners */
25 
26 #  define obj_thread_first           obj_aux    /* pointer to the first bead */
27 
28 /* data structure of beads */
29 #  define pdfmem_bead_size          5   /* size of memory in |pdf->mem| which  |obj_bead_ptr| points to */
30 
31 #  define set_pdf_thread_attr(A,B) pdf_thread_attr(A)=B
32 #  define set_pdf_thread_id(A,B) pdf_thread_id(A)=B
33 #  define set_pdf_thread_named_id(A,B) pdf_thread_named_id(A)=B
34 
35 #  define obj_bead_ptr              obj_aux     /* pointer to |pdf->mem| */
36 #  define obj_bead_rect(pdf,A)          pdf->mem[obj_bead_ptr(pdf,A)]
37 #  define obj_bead_page(pdf,A)          pdf->mem[obj_bead_ptr(pdf,A) + 1]
38 #  define obj_bead_next(pdf,A)          pdf->mem[obj_bead_ptr(pdf,A) + 2]
39 #  define obj_bead_prev(pdf,A)          pdf->mem[obj_bead_ptr(pdf,A) + 3]
40 #  define obj_bead_attr(pdf,A)          pdf->mem[obj_bead_ptr(pdf,A) + 4]
41 
42 #  define set_obj_bead_rect(pdf,A,B) obj_bead_rect(pdf,A)=B
43 #  define set_obj_bead_page(pdf,A,B) obj_bead_page(pdf,A)=B
44 #  define set_obj_bead_next(pdf,A,B) obj_bead_next(pdf,A)=B
45 #  define set_obj_bead_prev(pdf,A,B) obj_bead_prev(pdf,A)=B
46 #  define set_obj_bead_attr(pdf,A,B) obj_bead_attr(pdf,A)=B
47 
48 
49 /* pointer to the corresponding whatsit node; |obj_bead_rect| is needed only when the bead
50    rectangle has been written out and after that |obj_bead_data| is not needed any more
51    so we can use this field for both */
52 #  define obj_bead_data             obj_bead_rect
53 #  define set_obj_bead_data         set_obj_bead_rect
54 
55 extern void append_bead(PDF pdf, halfword p);
56 extern void do_thread(PDF pdf, halfword parent_box, halfword p, scaledpos cur);
57 extern void append_thread(PDF pdf, halfword parent_box, scaledpos cur);
58 extern void end_thread(PDF pdf, halfword p);
59 extern void scan_thread_id(void);
60 
61 extern void thread_title(PDF pdf, int t);
62 extern void pdf_fix_thread(PDF pdf, int t);
63 extern void out_thread(PDF pdf, int t);
64 
65 extern void check_running_thread(PDF pdf, halfword this_box, scaledpos cur);
66 extern void print_bead_rectangles(PDF pdf);
67 extern void flush_beads_list(void);
68 
69 #endif
70