1 /* pdfobj.h
2 
3    Copyright 2009-2011 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 PDFOBJ_H
22 #  define PDFOBJ_H
23 
24 /* data structure for \.{\\pdfobj} and \.{\\pdfrefobj} */
25 
26 #  define set_pdf_obj_objnum(A, B) pdf_obj_objnum(A) = (B)
27 
28 #  define pdfmem_obj_size                  5    /* size of memory in |mem| which |obj_data_ptr| holds */
29 
30 #  define obj_obj_data(pdf, A)             pdf->mem[obj_data_ptr((pdf), (A)) + 0]       /* object data */
31 #  define obj_obj_stream_attr(pdf, A)      pdf->mem[obj_data_ptr((pdf), (A)) + 1]       /* additional attributes into stream dict */
32 #  define obj_obj_flags(pdf, A)            pdf->mem[obj_data_ptr((pdf), (A)) + 2]       /* stream/file flags */
33 #  define obj_obj_pdfcompresslevel(pdf, A) pdf->mem[obj_data_ptr((pdf), (A)) + 3]       /* overrides \pdfcompresslevel */
34 #  define obj_obj_objstm_threshold(pdf, A) pdf->mem[obj_data_ptr((pdf), (A)) + 4]       /* for object stream compression */
35 
36 /*  define set_obj_obj_data(pdf, A, B)             obj_obj_data((pdf), (A)) = (B) */
37 /*  define set_obj_obj_flags(pdf, A, B)            obj_obj_flags((pdf), (A)) = (B) */
38 /*  define set_obj_obj_stream_attr(pdf, A, B)      obj_obj_stream_attr((pdf), (A)) = (B) */
39 /*  define set_obj_obj_pdfcompresslevel(pdf, A, B) obj_obj_pdfcompresslevel((pdf), (A)) = (B) */
40 /*  define set_obj_obj_objstm_threshold(pdf, A, B) obj_obj_objstm_threshold((pdf), (A)) = (B) */
41 
42 /**********************************************************************/
43 
44 #  define OBJ_FLAG_ISSTREAM              (1 << 0)
45 #  define OBJ_FLAG_ISFILE                (1 << 1)
46 
47 #  define obj_obj_is_stream(pdf,A)       ((obj_obj_flags((pdf), (A)) & OBJ_FLAG_ISSTREAM) != 0)
48 #  define set_obj_obj_is_stream(pdf,A)   ((obj_obj_flags((pdf), (A)) |= OBJ_FLAG_ISSTREAM))
49 #  define unset_obj_obj_is_stream(pdf,A) ((obj_obj_flags((pdf), (A)) &= ~OBJ_FLAG_ISSTREAM))
50 
51 #  define obj_obj_is_file(pdf,A)         ((obj_obj_flags((pdf), (A)) & OBJ_FLAG_ISFILE) != 0)
52 #  define set_obj_obj_is_file(pdf,A)     ((obj_obj_flags((pdf), (A)) |= OBJ_FLAG_ISFILE))
53 #  define unset_obj_obj_is_file(pdf,A)   ((obj_obj_flags((pdf), (A)) &= ~OBJ_FLAG_ISFILE))
54 
55 /**********************************************************************/
56 
57 extern int pdf_last_obj;
58 
59 extern void init_obj_obj(PDF pdf, int k);
60 extern void pdf_write_obj(PDF pdf, int n);
61 extern void scan_obj(PDF pdf);
62 extern void scan_refobj(PDF pdf);
63 extern void scan_refobj_lua(PDF pdf, int k);
64 extern void pdf_ref_obj(PDF pdf, halfword p);
65 extern void pdf_ref_obj_lua(PDF pdf, int k);
66 
67 #endif
68