| 1 |
|
| MODULE = PDF::Make PACKAGE = PDF::Make::Structure |
| 2 |
|
| PROTOTYPES: ENABLE |
| 3 |
|
| |
| 4 |
|
| SV * |
| 5 |
|
| create_tree(class, doc) |
| 6 |
|
| char *class |
| 7 |
|
| pdfmake_doc_t *doc |
| 8 |
|
| PREINIT: |
| 9 |
|
| pdfmake_struct_tree_t *tree; |
| 10 |
|
| SV *sv; |
| 11 |
|
| CODE: |
| 12 |
|
| PERL_UNUSED_VAR(class); |
| 13 |
4 |
| tree = pdfmake_doc_create_struct_tree(doc); |
| 14 |
4 |
▶ | if (!tree) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!tree) |
0 |
4 |
4 |
|
| 15 |
0 |
| croak("PDF::Make::Structure: failed to create structure tree"); |
| 16 |
4 |
| sv = newSV(0); |
| 17 |
4 |
| sv_setref_pv(sv, "PDF::Make::Structure", (void *)tree); |
| 18 |
4 |
| RETVAL = sv; |
| 19 |
|
| OUTPUT: |
| 20 |
|
| RETVAL |
| 21 |
|
| |
| 22 |
|
| SV * |
| 23 |
|
| root(self) |
| 24 |
|
| SV *self |
| 25 |
|
| PREINIT: |
| 26 |
|
| pdfmake_struct_tree_t *tree; |
| 27 |
|
| SV *sv; |
| 28 |
|
| CODE: |
| 29 |
3 |
| tree = INT2PTR(pdfmake_struct_tree_t *, SvIV(SvRV(self))); |
| 30 |
3 |
▶ | if (!tree->root) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!tree->root) |
0 |
3 |
3 |
|
| 31 |
0 |
| croak("PDF::Make::Structure: no root element"); |
| 32 |
3 |
| sv = newSV(0); |
| 33 |
3 |
| sv_setref_pv(sv, "PDF::Make::StructElem", (void *)tree->root); |
| 34 |
3 |
| RETVAL = sv; |
| 35 |
|
| OUTPUT: |
| 36 |
|
| RETVAL |
| 37 |
|
| |
| 38 |
|
| void |
| 39 |
|
| map_role(self, custom, standard) |
| 40 |
|
| SV *self |
| 41 |
|
| const char *custom |
| 42 |
|
| const char *standard |
| 43 |
|
| PREINIT: |
| 44 |
|
| pdfmake_struct_tree_t *tree; |
| 45 |
|
| CODE: |
| 46 |
0 |
| tree = INT2PTR(pdfmake_struct_tree_t *, SvIV(SvRV(self))); |
| 47 |
0 |
| int type = pdfmake_struct_type_lookup(standard); |
| 48 |
0 |
▶ | if (type < 0) |
Branch: 1 branch
| Branch | True | False | Total |
| if (type < 0) |
0 |
0 |
0 |
|
| 49 |
0 |
| croak("PDF::Make::Structure: unknown standard type '%s'", standard); |
| 50 |
0 |
| pdfmake_struct_tree_map_role(tree, custom, (pdfmake_struct_type_t)type); |
| 51 |
|
| |
| 52 |
|
| void |
| 53 |
|
| DESTROY(self) |
| 54 |
|
| SV *self |
| 55 |
|
| CODE: |
| 56 |
4 |
| SvIV_set(SvRV(self), 0); |
| 57 |
|
| |
| 58 |
|
| |
| 59 |
|
| MODULE = PDF::Make PACKAGE = PDF::Make::StructElem |
| 60 |
|
| PROTOTYPES: ENABLE |
| 61 |
|
| |
| 62 |
|
| SV * |
| 63 |
|
| add_child(self, type_name, ...) |
| 64 |
|
| SV *self |
| 65 |
|
| const char *type_name |
| 66 |
|
| PREINIT: |
| 67 |
|
| pdfmake_struct_elem_t *elem, *child; |
| 68 |
|
| SV *sv; |
| 69 |
|
| int type; |
| 70 |
|
| CODE: |
| 71 |
5 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 72 |
5 |
| type = pdfmake_struct_type_lookup(type_name); |
| 73 |
5 |
▶ | if (type >= 0) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (type >= 0) { |
5 |
0 |
5 |
|
| 74 |
5 |
| child = pdfmake_struct_elem_create(NULL, (pdfmake_struct_type_t)type, elem); |
| 75 |
|
| } else { |
| 76 |
0 |
| child = pdfmake_struct_elem_create_custom(NULL, type_name, elem); |
| 77 |
|
| } |
| 78 |
5 |
▶ | if (!child) |
Branch: 1 branch
| Branch | True | False | Total |
| if (!child) |
0 |
5 |
5 |
|
| 79 |
0 |
| croak("PDF::Make::StructElem: failed to create child"); |
| 80 |
5 |
| sv = newSV(0); |
| 81 |
5 |
| sv_setref_pv(sv, "PDF::Make::StructElem", (void *)child); |
| 82 |
5 |
| RETVAL = sv; |
| 83 |
|
| OUTPUT: |
| 84 |
|
| RETVAL |
| 85 |
|
| |
| 86 |
|
| const char * |
| 87 |
|
| type(self) |
| 88 |
|
| SV *self |
| 89 |
|
| PREINIT: |
| 90 |
|
| pdfmake_struct_elem_t *elem; |
| 91 |
|
| CODE: |
| 92 |
4 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 93 |
4 |
| RETVAL = elem->custom_type[0] ? elem->custom_type |
| 94 |
4 |
▶ | : pdfmake_struct_type_name(elem->type); |
Branch: 1 branch
| Branch | True | False | Total |
| : pdfmake_struct_type_name(elem->type); |
0 |
4 |
4 |
|
| 95 |
|
| OUTPUT: |
| 96 |
|
| RETVAL |
| 97 |
|
| |
| 98 |
|
| void |
| 99 |
|
| alt_text(self, text) |
| 100 |
|
| SV *self |
| 101 |
|
| const char *text |
| 102 |
|
| PREINIT: |
| 103 |
|
| pdfmake_struct_elem_t *elem; |
| 104 |
|
| CODE: |
| 105 |
1 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 106 |
1 |
| pdfmake_struct_elem_set_alt_text(elem, text); |
| 107 |
|
| |
| 108 |
|
| void |
| 109 |
|
| actual_text(self, text) |
| 110 |
|
| SV *self |
| 111 |
|
| const char *text |
| 112 |
|
| PREINIT: |
| 113 |
|
| pdfmake_struct_elem_t *elem; |
| 114 |
|
| CODE: |
| 115 |
0 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 116 |
0 |
| pdfmake_struct_elem_set_actual_text(elem, text); |
| 117 |
|
| |
| 118 |
|
| void |
| 119 |
|
| lang(self, lang_str) |
| 120 |
|
| SV *self |
| 121 |
|
| const char *lang_str |
| 122 |
|
| PREINIT: |
| 123 |
|
| pdfmake_struct_elem_t *elem; |
| 124 |
|
| CODE: |
| 125 |
1 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 126 |
1 |
| pdfmake_struct_elem_set_lang(elem, lang_str); |
| 127 |
|
| |
| 128 |
|
| void |
| 129 |
|
| add_content(self, page, mcid) |
| 130 |
|
| SV *self |
| 131 |
|
| pdfmake_page_t *page |
| 132 |
|
| int mcid |
| 133 |
|
| PREINIT: |
| 134 |
|
| pdfmake_struct_elem_t *elem; |
| 135 |
|
| CODE: |
| 136 |
0 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 137 |
0 |
| pdfmake_struct_elem_add_mcr(elem, page->page_num, mcid); |
| 138 |
|
| |
| 139 |
|
| UV |
| 140 |
|
| child_count(self) |
| 141 |
|
| SV *self |
| 142 |
|
| PREINIT: |
| 143 |
|
| pdfmake_struct_elem_t *elem; |
| 144 |
|
| CODE: |
| 145 |
1 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 146 |
1 |
▶ | RETVAL = elem->child_count; |
Branch: 1 branch
| Branch | True | False | Total |
| RETVAL = elem->child_count; |
0 |
1 |
1 |
|
| 147 |
|
| OUTPUT: |
| 148 |
|
| RETVAL |
| 149 |
|
| |
| 150 |
|
| SV * |
| 151 |
|
| child_at(self, idx) |
| 152 |
|
| SV *self |
| 153 |
|
| UV idx |
| 154 |
|
| PREINIT: |
| 155 |
|
| pdfmake_struct_elem_t *elem; |
| 156 |
|
| SV *sv; |
| 157 |
|
| CODE: |
| 158 |
1 |
| elem = INT2PTR(pdfmake_struct_elem_t *, SvIV(SvRV(self))); |
| 159 |
1 |
▶ | if (idx >= elem->child_count) |
Branch: 1 branch
| Branch | True | False | Total |
| if (idx >= elem->child_count) |
0 |
1 |
1 |
|
| 160 |
0 |
| XSRETURN_UNDEF; |
| 161 |
1 |
| sv = newSV(0); |
| 162 |
1 |
| sv_setref_pv(sv, "PDF::Make::StructElem", (void *)elem->children[idx]); |
| 163 |
1 |
| RETVAL = sv; |
| 164 |
|
| OUTPUT: |
| 165 |
|
| RETVAL |
| 166 |
|
| |
| 167 |
|
| void |
| 168 |
|
| DESTROY(self) |
| 169 |
|
| SV *self |
| 170 |
|
| CODE: |
| 171 |
9 |
| SvIV_set(SvRV(self), 0); |