| 1 | package PDFio::FFI; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | our $VERSION = '0.01'; | ||||||||||
| 8 | 1 | ▶ | use FFI::CheckLib qw( find_lib_or_die ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 1 | ▶ | use FFI::Platypus; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | |||||||||||
| 12 | my $ffi = FFI::Platypus->new( | ||||||||||
| 13 | api => 2, | ||||||||||
| 14 | lib => find_lib_or_die( lib => 'pdfio', alien => 'Alien::PDFio' ), | ||||||||||
| 15 | ); | ||||||||||
| 16 | |||||||||||
| 17 | $ffi->mangler(sub { | ||||||||||
| 18 | my($symbol) = @_; | ||||||||||
| 19 | return "pdfio" . ucfirst($symbol); | ||||||||||
| 20 | }); | ||||||||||
| 21 | |||||||||||
| 22 | $ffi->type( 'object(PDFio::FFI::File)' => 'pdfio_file_t' ); | ||||||||||
| 23 | $ffi->type( 'object(PDFio::FFI::Array)' => 'pdfio_array_t' ); | ||||||||||
| 24 | $ffi->type( 'object(PDFio::FFI::Dict)' => 'pdfio_dict_t' ); | ||||||||||
| 25 | $ffi->type( 'object(PDFio::FFI::Stream)' => 'pdfio_stream_t' ); | ||||||||||
| 26 | $ffi->type( 'object(PDFio::FFI::Object)' => 'pdfio_obj_t' ); | ||||||||||
| 27 | $ffi->type( 'object(PDFio::FFI::Rect)' => 'pdfio_rect_t' ); | ||||||||||
| 28 | $ffi->type( 'object(PDFio::FFI::Encryption)' => 'pdfio_encryption_t' ); | ||||||||||
| 29 | |||||||||||
| 30 | my %functions = ( | ||||||||||
| 31 | fileCreate => [ | ||||||||||
| 32 | ['string', 'string', 'pdfio_rect_t', 'pdfio_rect_t', 'opaque', 'opaque'] => 'pdfio_file_t' | ||||||||||
| 33 | ], | ||||||||||
| 34 | fileClose => [ | ||||||||||
| 35 | ['pdfio_file_t'] => 'bool' | ||||||||||
| 36 | ], | ||||||||||
| 37 | fileCreatePage => [ | ||||||||||
| 38 | ['pdfio_file_t', 'pdfio_dict_t'] => 'pdfio_stream_t' | ||||||||||
| 39 | ], | ||||||||||
| 40 | arrayAppendArray => [ | ||||||||||
| 41 | ['pdfio_array_t', 'pdfio_array_t'] => 'bool' | ||||||||||
| 42 | ], | ||||||||||
| 43 | arrayAppendBinary => [ | ||||||||||
| 44 | ['pdfio_array_t', 'opaque', 'size_t'] => 'bool' | ||||||||||
| 45 | ], | ||||||||||
| 46 | arrayAppendBoolean => [ | ||||||||||
| 47 | ['pdfio_array_t', 'bool'] => 'bool' | ||||||||||
| 48 | ], | ||||||||||
| 49 | arrayAppendDate => [ | ||||||||||
| 50 | ['pdfio_array_t', 'time_t'] => 'bool' | ||||||||||
| 51 | ], | ||||||||||
| 52 | arrayAppendDict => [ | ||||||||||
| 53 | ['pdfio_array_t', 'pdfio_dict_t'] => 'bool' | ||||||||||
| 54 | ], | ||||||||||
| 55 | arrayAppendName => [ | ||||||||||
| 56 | ['pdfio_array_t', 'string'] => 'bool' | ||||||||||
| 57 | ], | ||||||||||
| 58 | arrayAppendNumber => [ | ||||||||||
| 59 | ['pdfio_array_t', 'double'] => 'bool' | ||||||||||
| 60 | ], | ||||||||||
| 61 | arrayAppendObj => [ | ||||||||||
| 62 | ['pdfio_array_t', 'pdfio_obj_t'] => 'bool' | ||||||||||
| 63 | ], | ||||||||||
| 64 | arrayAppendString => [ | ||||||||||
| 65 | ['pdfio_array_t', 'string'] => 'bool' | ||||||||||
| 66 | ], | ||||||||||
| 67 | arrayCopy => [ | ||||||||||
| 68 | ['pdfio_file_t', 'pdfio_array_t'] => 'pdfio_array_t' | ||||||||||
| 69 | ], | ||||||||||
| 70 | arrayCreate => [ | ||||||||||
| 71 | ['pdfio_file_t'] => 'pdfio_array_t' | ||||||||||
| 72 | ], | ||||||||||
| 73 | arrayGetArray => [ | ||||||||||
| 74 | ['pdfio_array_t', 'size_t'] => 'pdfio_array_t' | ||||||||||
| 75 | ], | ||||||||||
| 76 | arrayGetBinary => [ | ||||||||||
| 77 | ['pdfio_array_t', 'size_t', 'opaque'] => 'opaque' | ||||||||||
| 78 | ], | ||||||||||
| 79 | arrayGetBoolean => [ | ||||||||||
| 80 | ['pdfio_array_t', 'size_t'] => 'bool' | ||||||||||
| 81 | ], | ||||||||||
| 82 | arrayGetDate => [ | ||||||||||
| 83 | ['pdfio_array_t', 'size_t'] => 'time_t' | ||||||||||
| 84 | ], | ||||||||||
| 85 | arrayGetDict => [ | ||||||||||
| 86 | ['pdfio_array_t', 'size_t'] => 'pdfio_dict_t' | ||||||||||
| 87 | ], | ||||||||||
| 88 | arrayGetName => [ | ||||||||||
| 89 | ['pdfio_array_t', 'size_t'] => 'string' | ||||||||||
| 90 | ], | ||||||||||
| 91 | arrayGetNumber => [ | ||||||||||
| 92 | ['pdfio_array_t', 'size_t'] => 'double' | ||||||||||
| 93 | ], | ||||||||||
| 94 | arrayGetObj => [ | ||||||||||
| 95 | ['pdfio_array_t', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 96 | ], | ||||||||||
| 97 | arrayGetSize => [ | ||||||||||
| 98 | ['pdfio_array_t'] => 'size_t' | ||||||||||
| 99 | ], | ||||||||||
| 100 | arrayGetString => [ | ||||||||||
| 101 | ['pdfio_array_t', 'size_t'] => 'string' | ||||||||||
| 102 | ], | ||||||||||
| 103 | arrayGetType => [ | ||||||||||
| 104 | ['pdfio_array_t', 'size_t'] => 'int' | ||||||||||
| 105 | ], | ||||||||||
| 106 | arrayRemove => [ | ||||||||||
| 107 | ['pdfio_array_t', 'size_t'] => 'bool' | ||||||||||
| 108 | ], | ||||||||||
| 109 | dictClear => [ | ||||||||||
| 110 | ['pdfio_dict_t', 'string'] => 'bool' | ||||||||||
| 111 | ], | ||||||||||
| 112 | dictCopy => [ | ||||||||||
| 113 | ['pdfio_file_t', 'pdfio_dict_t'] => 'pdfio_dict_t' | ||||||||||
| 114 | ], | ||||||||||
| 115 | dictCreate => [ | ||||||||||
| 116 | ['pdfio_file_t'] => 'pdfio_dict_t' | ||||||||||
| 117 | ], | ||||||||||
| 118 | dictGetArray => [ | ||||||||||
| 119 | ['pdfio_dict_t', 'string'] => 'pdfio_array_t' | ||||||||||
| 120 | ], | ||||||||||
| 121 | dictGetBinary => [ | ||||||||||
| 122 | ['pdfio_dict_t', 'string', 'opaque'] => 'opaque' | ||||||||||
| 123 | ], | ||||||||||
| 124 | dictGetBoolean => [ | ||||||||||
| 125 | ['pdfio_dict_t', 'string'] => 'bool' | ||||||||||
| 126 | ], | ||||||||||
| 127 | dictGetDate => [ | ||||||||||
| 128 | ['pdfio_dict_t', 'string'] => 'time_t' | ||||||||||
| 129 | ], | ||||||||||
| 130 | dictGetDict => [ | ||||||||||
| 131 | ['pdfio_dict_t', 'string'] => 'pdfio_dict_t' | ||||||||||
| 132 | ], | ||||||||||
| 133 | dictGetKey => [ | ||||||||||
| 134 | ['pdfio_dict_t', 'size_t'] => 'string' | ||||||||||
| 135 | ], | ||||||||||
| 136 | dictGetName => [ | ||||||||||
| 137 | ['pdfio_dict_t', 'string'] => 'string' | ||||||||||
| 138 | ], | ||||||||||
| 139 | dictGetNumPairs => [ | ||||||||||
| 140 | ['pdfio_dict_t'] => 'size_t' | ||||||||||
| 141 | ], | ||||||||||
| 142 | dictGetNumber => [ | ||||||||||
| 143 | ['pdfio_dict_t', 'string'] => 'double' | ||||||||||
| 144 | ], | ||||||||||
| 145 | dictGetObj => [ | ||||||||||
| 146 | ['pdfio_dict_t', 'string'] => 'pdfio_obj_t' | ||||||||||
| 147 | ], | ||||||||||
| 148 | dictGetRect => [ | ||||||||||
| 149 | ['pdfio_dict_t', 'string', 'pdfio_rect_t'] => 'pdfio_rect_t' | ||||||||||
| 150 | ], | ||||||||||
| 151 | dictGetString => [ | ||||||||||
| 152 | ['pdfio_dict_t', 'string'] => 'string' | ||||||||||
| 153 | ], | ||||||||||
| 154 | dictGetType => [ | ||||||||||
| 155 | ['pdfio_dict_t', 'string'] => 'int' | ||||||||||
| 156 | ], | ||||||||||
| 157 | # dictIterateKeys | ||||||||||
| 158 | dictSetArray => [ | ||||||||||
| 159 | ['pdfio_dict_t', 'string', 'pdfio_array_t'] => 'bool' | ||||||||||
| 160 | ], | ||||||||||
| 161 | dictSetBinary => [ | ||||||||||
| 162 | ['pdfio_dict_t', 'string', 'opaque', 'size_t'] => 'bool' | ||||||||||
| 163 | ], | ||||||||||
| 164 | dictSetBoolean => [ | ||||||||||
| 165 | ['pdfio_dict_t', 'string', 'bool'] => 'bool' | ||||||||||
| 166 | ], | ||||||||||
| 167 | dictSetDate => [ | ||||||||||
| 168 | ['pdfio_dict_t', 'string', 'time_t'] => 'bool' | ||||||||||
| 169 | ], | ||||||||||
| 170 | dictSetDict => [ | ||||||||||
| 171 | ['pdfio_dict_t', 'string', 'pdfio_dict_t'] => 'bool' | ||||||||||
| 172 | ], | ||||||||||
| 173 | dictSetName => [ | ||||||||||
| 174 | ['pdfio_dict_t', 'string', 'string'] => 'bool' | ||||||||||
| 175 | ], | ||||||||||
| 176 | dictSetNull => [ | ||||||||||
| 177 | ['pdfio_dict_t', 'string'] => 'bool' | ||||||||||
| 178 | ], | ||||||||||
| 179 | dictSetNumber => [ | ||||||||||
| 180 | ['pdfio_dict_t', 'string', 'double'] => 'bool' | ||||||||||
| 181 | ], | ||||||||||
| 182 | dictSetObj => [ | ||||||||||
| 183 | ['pdfio_dict_t', 'string', 'pdfio_obj_t'] => 'bool' | ||||||||||
| 184 | ], | ||||||||||
| 185 | dictSetRect => [ | ||||||||||
| 186 | ['pdfio_dict_t', 'string', 'pdfio_rect_t'] => 'bool' | ||||||||||
| 187 | ], | ||||||||||
| 188 | dictSetString => [ | ||||||||||
| 189 | ['pdfio_dict_t', 'string', 'string'] => 'bool' | ||||||||||
| 190 | ], | ||||||||||
| 191 | # dictSetStringf | ||||||||||
| 192 | fileCreateArrayObj => [ | ||||||||||
| 193 | ['pdfio_file_t', 'pdfio_array_t'] => 'pdfio_obj_t' | ||||||||||
| 194 | ], | ||||||||||
| 195 | fileCreateNameObj => [ | ||||||||||
| 196 | ['pdfio_file_t', 'string'] => 'pdfio_obj_t' | ||||||||||
| 197 | ], | ||||||||||
| 198 | fileCreateNumberObj => [ | ||||||||||
| 199 | ['pdfio_file_t', 'double'] => 'pdfio_obj_t' | ||||||||||
| 200 | ], | ||||||||||
| 201 | fileCreateObj => [ | ||||||||||
| 202 | ['pdfio_file_t', 'pdfio_dict_t'] => 'pdfio_obj_t' | ||||||||||
| 203 | ], | ||||||||||
| 204 | fileCreateOutput => [ | ||||||||||
| 205 | ['opaque', 'opaque', 'string', 'pdfio_rect_t', 'pdfio_rect_t', 'opaque', 'opaque'] => 'pdfio_file_t' | ||||||||||
| 206 | ], | ||||||||||
| 207 | fileCreatePage => [ | ||||||||||
| 208 | ['pdfio_file_t', 'pdfio_dict_t'] => 'pdfio_stream_t' | ||||||||||
| 209 | ], | ||||||||||
| 210 | fileCreateStringObj => [ | ||||||||||
| 211 | ['pdfio_file_t', 'string'] => 'pdfio_obj_t' | ||||||||||
| 212 | ], | ||||||||||
| 213 | fileCreateTemporary => [ | ||||||||||
| 214 | ['opaque', 'size_t', 'string', 'pdfio_rect_t', 'pdfio_rect_t', 'opaque', 'opaque'] => 'pdfio_file_t' | ||||||||||
| 215 | ], | ||||||||||
| 216 | fileFindObj => [ | ||||||||||
| 217 | ['pdfio_file_t', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 218 | ], | ||||||||||
| 219 | fileGetAuthor => [ | ||||||||||
| 220 | ['pdfio_file_t'] => 'string' | ||||||||||
| 221 | ], | ||||||||||
| 222 | fileGetCatalog => [ | ||||||||||
| 223 | ['pdfio_file_t'] => 'pdfio_dict_t' | ||||||||||
| 224 | ], | ||||||||||
| 225 | fileGetCreationDate => [ | ||||||||||
| 226 | ['pdfio_file_t'] => 'time_t' | ||||||||||
| 227 | ], | ||||||||||
| 228 | fileGetCreator => [ | ||||||||||
| 229 | ['pdfio_file_t'] => 'string' | ||||||||||
| 230 | ], | ||||||||||
| 231 | fileGetID => [ | ||||||||||
| 232 | ['pdfio_file_t'] => 'pdfio_array_t' | ||||||||||
| 233 | ], | ||||||||||
| 234 | fileGetKeywords => [ | ||||||||||
| 235 | ['pdfio_file_t'] => 'string' | ||||||||||
| 236 | ], | ||||||||||
| 237 | fileGetModificationDate => [ | ||||||||||
| 238 | ['pdfio_file_t'] => 'time_t' | ||||||||||
| 239 | ], | ||||||||||
| 240 | fileGetName => [ | ||||||||||
| 241 | ['pdfio_file_t'] => 'string' | ||||||||||
| 242 | ], | ||||||||||
| 243 | fileGetNumObjs => [ | ||||||||||
| 244 | ['pdfio_file_t'] => 'size_t' | ||||||||||
| 245 | ], | ||||||||||
| 246 | fileGetNumPages => [ | ||||||||||
| 247 | ['pdfio_file_t'] => 'size_t' | ||||||||||
| 248 | ], | ||||||||||
| 249 | fileGetObj => [ | ||||||||||
| 250 | ['pdfio_file_t', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 251 | ], | ||||||||||
| 252 | fileGetPage => [ | ||||||||||
| 253 | ['pdfio_file_t', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 254 | ], | ||||||||||
| 255 | fileGetPermissions => [ | ||||||||||
| 256 | ['pdfio_file_t', 'pdfio_encryption_t'] => 'int' | ||||||||||
| 257 | ], | ||||||||||
| 258 | fileGetProducer => [ | ||||||||||
| 259 | ['pdfio_file_t'] => 'string' | ||||||||||
| 260 | ], | ||||||||||
| 261 | fileGetSubject => [ | ||||||||||
| 262 | ['pdfio_file_t'] => 'string' | ||||||||||
| 263 | ], | ||||||||||
| 264 | fileGetTitle => [ | ||||||||||
| 265 | ['pdfio_file_t'] => 'string' | ||||||||||
| 266 | ], | ||||||||||
| 267 | fileGetVersion => [ | ||||||||||
| 268 | ['pdfio_file_t'] => 'string' | ||||||||||
| 269 | ], | ||||||||||
| 270 | fileOpen => [ | ||||||||||
| 271 | ['string', 'opaque', 'opaque', 'opaque', 'opaque'] => 'pdfio_file_t' | ||||||||||
| 272 | ], | ||||||||||
| 273 | fileSetAuthor => [ | ||||||||||
| 274 | ['pdfio_file_t', 'string'] => 'void' | ||||||||||
| 275 | ], | ||||||||||
| 276 | fileSetCreationDate => [ | ||||||||||
| 277 | ['pdfio_file_t', 'time_t'] => 'void' | ||||||||||
| 278 | ], | ||||||||||
| 279 | fileSetCreator => [ | ||||||||||
| 280 | ['pdfio_file_t', 'string'] => 'void' | ||||||||||
| 281 | ], | ||||||||||
| 282 | fileSetKeywords => [ | ||||||||||
| 283 | ['pdfio_file_t', 'string'] => 'void' | ||||||||||
| 284 | ], | ||||||||||
| 285 | fileSetModificationDate => [ | ||||||||||
| 286 | ['pdfio_file_t', 'time_t'] => 'void' | ||||||||||
| 287 | ], | ||||||||||
| 288 | fileSetPermissions => [ | ||||||||||
| 289 | ['pdfio_file_t', 'int', 'pdfio_encryption_t', 'string', 'string'] => 'bool' | ||||||||||
| 290 | ], | ||||||||||
| 291 | fileSetSubject => [ | ||||||||||
| 292 | ['pdfio_file_t', 'string'] => 'void' | ||||||||||
| 293 | ], | ||||||||||
| 294 | fileSetTitle => [ | ||||||||||
| 295 | ['pdfio_file_t', 'string'] => 'void' | ||||||||||
| 296 | ], | ||||||||||
| 297 | fileCreateFontObjFromBase => [ | ||||||||||
| 298 | ['pdfio_file_t', 'string'] => 'pdfio_obj_t' | ||||||||||
| 299 | ], | ||||||||||
| 300 | fileCreateFontObjFromFile => [ | ||||||||||
| 301 | ['pdfio_file_t', 'string', 'bool'] => 'pdfio_obj_t' | ||||||||||
| 302 | ], | ||||||||||
| 303 | fileCreateICCObjFromData => [ | ||||||||||
| 304 | ['pdfio_file_t', 'opaque', 'size_t', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 305 | ], | ||||||||||
| 306 | fileCreateICCObjFromFile => [ | ||||||||||
| 307 | ['pdfio_file_t', 'string', 'size_t'] => 'pdfio_obj_t' | ||||||||||
| 308 | ], | ||||||||||
| 309 | fileCreateImageObjFromData => [ | ||||||||||
| 310 | ['pdfio_file_t', 'opaque', 'size_t', 'size_t', 'size_t', 'pdfio_array_t', 'bool', 'bool'] => 'pdfio_obj_t' | ||||||||||
| 311 | ], | ||||||||||
| 312 | fileCreateImageObjFromFile => [ | ||||||||||
| 313 | ['pdfio_file_t', 'string', 'bool'] => 'pdfio_obj_t' | ||||||||||
| 314 | ], | ||||||||||
| 315 | imageGetBytesPerLine => [ | ||||||||||
| 316 | ['pdfio_obj_t'] => 'size_t' | ||||||||||
| 317 | ], | ||||||||||
| 318 | imageGetHeight => [ | ||||||||||
| 319 | ['pdfio_obj_t'] => 'double' | ||||||||||
| 320 | ], | ||||||||||
| 321 | imageGetWidth => [ | ||||||||||
| 322 | ['pdfio_obj_t'] => 'double' | ||||||||||
| 323 | ], | ||||||||||
| 324 | pageDictAddColorSpace => [ | ||||||||||
| 325 | ['pdfio_dict_t', 'string', 'pdfio_array_t'] => 'bool' | ||||||||||
| 326 | ], | ||||||||||
| 327 | pageDictAddFont => [ | ||||||||||
| 328 | ['pdfio_dict_t', 'string', 'pdfio_obj_t'] => 'bool' | ||||||||||
| 329 | ], | ||||||||||
| 330 | pageDictAddImage => [ | ||||||||||
| 331 | ['pdfio_dict_t', 'string', 'pdfio_obj_t'] => 'bool' | ||||||||||
| 332 | ], | ||||||||||
| 333 | arrayCreateColorFromICCObj => [ | ||||||||||
| 334 | ['pdfio_file_t', 'pdfio_obj_t'] => 'pdfio_array_t' | ||||||||||
| 335 | ], | ||||||||||
| 336 | arrayCreateColorFromMatrix => [ | ||||||||||
| 337 | ['pdfio_file_t', 'size_t', 'double', 'opaque', 'opaque'] => 'pdfio_array_t' | ||||||||||
| 338 | ], | ||||||||||
| 339 | arrayCreateColorFromPalette => [ | ||||||||||
| 340 | ['pdfio_file_t', 'size_t', 'opaque'] => 'pdfio_array_t' | ||||||||||
| 341 | ], | ||||||||||
| 342 | arrayCreateColorFromPrimaries => [ | ||||||||||
| 343 | ['pdfio_file_t', 'size_t', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double', 'double'] => 'pdfio_array_t' | ||||||||||
| 344 | ], | ||||||||||
| 345 | arrayCreateColorFromStandard => [ | ||||||||||
| 346 | ['pdfio_file_t', 'size_t', 'int'] => 'pdfio_array_t' | ||||||||||
| 347 | ], | ||||||||||
| 348 | contentClip => [ | ||||||||||
| 349 | ['pdfio_stream_t', 'bool'] => 'bool' | ||||||||||
| 350 | ], | ||||||||||
| 351 | contentDrawImage => [ | ||||||||||
| 352 | ['pdfio_stream_t', 'string', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 353 | ], | ||||||||||
| 354 | contentFill => [ | ||||||||||
| 355 | ['pdfio_stream_t', 'bool'] => 'bool' | ||||||||||
| 356 | ], | ||||||||||
| 357 | contentFillAndStroke => [ | ||||||||||
| 358 | ['pdfio_stream_t', 'bool'] => 'bool' | ||||||||||
| 359 | ], | ||||||||||
| 360 | contentMatrixConcat => [ | ||||||||||
| 361 | ['pdfio_stream_t', 'opaque'] => 'bool' | ||||||||||
| 362 | ], | ||||||||||
| 363 | contentMatrixRotate => [ | ||||||||||
| 364 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 365 | ], | ||||||||||
| 366 | contentMatrixScale => [ | ||||||||||
| 367 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 368 | ], | ||||||||||
| 369 | contentMatrixTranslate => [ | ||||||||||
| 370 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 371 | ], | ||||||||||
| 372 | contentPathClose => [ | ||||||||||
| 373 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 374 | ], | ||||||||||
| 375 | contentPathCurve => [ | ||||||||||
| 376 | ['pdfio_stream_t', 'double', 'double', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 377 | ], | ||||||||||
| 378 | contentPathCurve13 => [ | ||||||||||
| 379 | ['pdfio_stream_t', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 380 | ], | ||||||||||
| 381 | contentPathCurve23 => [ | ||||||||||
| 382 | ['pdfio_stream_t', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 383 | ], | ||||||||||
| 384 | contentPathEnd => [ | ||||||||||
| 385 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 386 | ], | ||||||||||
| 387 | contentPathLineTo => [ | ||||||||||
| 388 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 389 | ], | ||||||||||
| 390 | contentPathMoveTo => [ | ||||||||||
| 391 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 392 | ], | ||||||||||
| 393 | contentPathRect => [ | ||||||||||
| 394 | ['pdfio_stream_t', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 395 | ], | ||||||||||
| 396 | contentRestore => [ | ||||||||||
| 397 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 398 | ], | ||||||||||
| 399 | contentSave => [ | ||||||||||
| 400 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 401 | ], | ||||||||||
| 402 | contentSetDashPattern => [ | ||||||||||
| 403 | ['pdfio_stream_t', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 404 | ], | ||||||||||
| 405 | contentSetFillColorDeviceCMYK => [ | ||||||||||
| 406 | ['pdfio_stream_t', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 407 | ], | ||||||||||
| 408 | contentSetFillColorDeviceGray => [ | ||||||||||
| 409 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 410 | ], | ||||||||||
| 411 | contentSetFillColorDeviceRGB => [ | ||||||||||
| 412 | ['pdfio_stream_t', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 413 | ], | ||||||||||
| 414 | contentSetFillColorGray => [ | ||||||||||
| 415 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 416 | ], | ||||||||||
| 417 | contentSetFillColorRGB => [ | ||||||||||
| 418 | ['pdfio_stream_t', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 419 | ], | ||||||||||
| 420 | contentSetFillColorSpace => [ | ||||||||||
| 421 | ['pdfio_stream_t', 'string'] => 'bool' | ||||||||||
| 422 | ], | ||||||||||
| 423 | contentSetFlatness => [ | ||||||||||
| 424 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 425 | ], | ||||||||||
| 426 | contentSetLineCap => [ | ||||||||||
| 427 | ['pdfio_stream_t', 'int'] => 'bool' | ||||||||||
| 428 | ], | ||||||||||
| 429 | contentSetLineJoin => [ | ||||||||||
| 430 | ['pdfio_stream_t', 'int'] => 'bool' | ||||||||||
| 431 | ], | ||||||||||
| 432 | contentSetLineWidth => [ | ||||||||||
| 433 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 434 | ], | ||||||||||
| 435 | contentSetMiterLimit => [ | ||||||||||
| 436 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 437 | ], | ||||||||||
| 438 | contentSetStrokeColorDeviceCMYK => [ | ||||||||||
| 439 | ['pdfio_stream_t', 'double', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 440 | ], | ||||||||||
| 441 | contentSetStrokeColorDeviceGray => [ | ||||||||||
| 442 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 443 | ], | ||||||||||
| 444 | contentSetStrokeColorDeviceRGB => [ | ||||||||||
| 445 | ['pdfio_stream_t', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 446 | ], | ||||||||||
| 447 | contentSetStrokeColorGray => [ | ||||||||||
| 448 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 449 | ], | ||||||||||
| 450 | contentSetStrokeColorRGB => [ | ||||||||||
| 451 | ['pdfio_stream_t', 'double', 'double', 'double'] => 'bool' | ||||||||||
| 452 | ], | ||||||||||
| 453 | contentSetStrokeColorSpace => [ | ||||||||||
| 454 | ['pdfio_stream_t', 'string'] => 'bool' | ||||||||||
| 455 | ], | ||||||||||
| 456 | contentSetTextCharacterSpacing => [ | ||||||||||
| 457 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 458 | ], | ||||||||||
| 459 | contentSetTextFont => [ | ||||||||||
| 460 | ['pdfio_stream_t', 'string', 'double'] => 'bool' | ||||||||||
| 461 | ], | ||||||||||
| 462 | contentSetTextLeading => [ | ||||||||||
| 463 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 464 | ], | ||||||||||
| 465 | contentSetTextMatrix => [ | ||||||||||
| 466 | ['pdfio_stream_t', 'opaque'] => 'bool' | ||||||||||
| 467 | ], | ||||||||||
| 468 | contentSetTextRenderingMode => [ | ||||||||||
| 469 | ['pdfio_stream_t', 'int'] => 'bool' | ||||||||||
| 470 | ], | ||||||||||
| 471 | contentSetTextRise => [ | ||||||||||
| 472 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 473 | ], | ||||||||||
| 474 | contentSetTextWordSpacing => [ | ||||||||||
| 475 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 476 | ], | ||||||||||
| 477 | contentSetTextXScaling => [ | ||||||||||
| 478 | ['pdfio_stream_t', 'double'] => 'bool' | ||||||||||
| 479 | ], | ||||||||||
| 480 | contentStroke => [ | ||||||||||
| 481 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 482 | ], | ||||||||||
| 483 | contentTextBegin => [ | ||||||||||
| 484 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 485 | ], | ||||||||||
| 486 | contentTextEnd => [ | ||||||||||
| 487 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 488 | ], | ||||||||||
| 489 | contentTextMeasure => [ | ||||||||||
| 490 | ['pdfio_obj_t', 'string', 'double'] => 'double' | ||||||||||
| 491 | ], | ||||||||||
| 492 | contentTextMoveLine => [ | ||||||||||
| 493 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 494 | ], | ||||||||||
| 495 | contentTextMoveTo => [ | ||||||||||
| 496 | ['pdfio_stream_t', 'double', 'double'] => 'bool' | ||||||||||
| 497 | ], | ||||||||||
| 498 | contentTextNewLine => [ | ||||||||||
| 499 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 500 | ], | ||||||||||
| 501 | contentTextNewLineShow => [ | ||||||||||
| 502 | ['pdfio_stream_t', 'double', 'double', 'bool', 'string'] => 'bool' | ||||||||||
| 503 | ], | ||||||||||
| 504 | contentTextNextLine => [ | ||||||||||
| 505 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 506 | ], | ||||||||||
| 507 | contentTextShow => [ | ||||||||||
| 508 | ['pdfio_stream_t', 'bool', 'string'] => 'bool' | ||||||||||
| 509 | ], | ||||||||||
| 510 | contentTextShowJustified => [ | ||||||||||
| 511 | ['pdfio_stream_t', 'bool', 'size_t', 'opaque', 'opaque'] => 'bool' | ||||||||||
| 512 | ], | ||||||||||
| 513 | objClose => [ | ||||||||||
| 514 | ['pdfio_obj_t'] => 'bool' | ||||||||||
| 515 | ], | ||||||||||
| 516 | objCopy => [ | ||||||||||
| 517 | ['pdfio_file_t', 'pdfio_obj_t'] => 'pdfio_obj_t' | ||||||||||
| 518 | ], | ||||||||||
| 519 | objCreateStream => [ | ||||||||||
| 520 | ['pdfio_obj_t', 'int'] => 'pdfio_stream_t' | ||||||||||
| 521 | ], | ||||||||||
| 522 | objGetArray => [ | ||||||||||
| 523 | ['pdfio_obj_t'] => 'pdfio_array_t' | ||||||||||
| 524 | ], | ||||||||||
| 525 | objGetDict => [ | ||||||||||
| 526 | ['pdfio_obj_t'] => 'pdfio_dict_t' | ||||||||||
| 527 | ], | ||||||||||
| 528 | objGetGeneration => [ | ||||||||||
| 529 | ['pdfio_obj_t'] => 'ushort' | ||||||||||
| 530 | ], | ||||||||||
| 531 | objGetLength => [ | ||||||||||
| 532 | ['pdfio_obj_t'] => 'size_t' | ||||||||||
| 533 | ], | ||||||||||
| 534 | objGetName => [ | ||||||||||
| 535 | ['pdfio_obj_t'] => 'string' | ||||||||||
| 536 | ], | ||||||||||
| 537 | objGetNumber => [ | ||||||||||
| 538 | ['pdfio_obj_t'] => 'size_t' | ||||||||||
| 539 | ], | ||||||||||
| 540 | objGetSubtype => [ | ||||||||||
| 541 | ['pdfio_obj_t'] => 'string' | ||||||||||
| 542 | ], | ||||||||||
| 543 | objGetType => [ | ||||||||||
| 544 | ['pdfio_obj_t'] => 'string' | ||||||||||
| 545 | ], | ||||||||||
| 546 | objOpenStream => [ | ||||||||||
| 547 | ['pdfio_obj_t', 'bool'] => 'pdfio_stream_t' | ||||||||||
| 548 | ], | ||||||||||
| 549 | pageCopy => [ | ||||||||||
| 550 | ['pdfio_file_t', 'pdfio_obj_t'] => 'bool' | ||||||||||
| 551 | ], | ||||||||||
| 552 | pageGetNumStreams => [ | ||||||||||
| 553 | ['pdfio_obj_t'] => 'size_t' | ||||||||||
| 554 | ], | ||||||||||
| 555 | pageOpenStream => [ | ||||||||||
| 556 | ['pdfio_obj_t', 'size_t', 'bool'] => 'pdfio_stream_t' | ||||||||||
| 557 | ], | ||||||||||
| 558 | streamClose => [ | ||||||||||
| 559 | ['pdfio_stream_t'] => 'bool' | ||||||||||
| 560 | ], | ||||||||||
| 561 | streamConsume => [ | ||||||||||
| 562 | ['pdfio_stream_t', 'size_t'] => 'bool' | ||||||||||
| 563 | ], | ||||||||||
| 564 | streamGetToken => [ | ||||||||||
| 565 | ['pdfio_stream_t', 'opaque', 'size_t'] => 'bool' | ||||||||||
| 566 | ], | ||||||||||
| 567 | streamPeek => [ | ||||||||||
| 568 | ['pdfio_stream_t', 'opaque', 'size_t'] => 'ssize_t' | ||||||||||
| 569 | ], | ||||||||||
| 570 | streamPutChar => [ | ||||||||||
| 571 | ['pdfio_stream_t', 'int'] => 'bool' | ||||||||||
| 572 | ], | ||||||||||
| 573 | streamPuts => [ | ||||||||||
| 574 | ['pdfio_stream_t', 'string'] => 'bool' | ||||||||||
| 575 | ], | ||||||||||
| 576 | streamRead => [ | ||||||||||
| 577 | ['pdfio_stream_t', 'opaque', 'size_t'] => 'ssize_t' | ||||||||||
| 578 | ], | ||||||||||
| 579 | streamWrite => [ | ||||||||||
| 580 | ['pdfio_stream_t', 'opaque', 'size_t'] => 'bool' | ||||||||||
| 581 | ], | ||||||||||
| 582 | stringCreate => [ | ||||||||||
| 583 | ['pdfio_file_t', 'string'] => 'string' | ||||||||||
| 584 | ], | ||||||||||
| 585 | ); | ||||||||||
| 586 | |||||||||||
| 587 | |||||||||||
| 588 | for my $name (keys %functions) { | ||||||||||
| 589 | my $args = $functions{$name}; | ||||||||||
| 590 | $ffi->attach( $name => @$args ); | ||||||||||
| 591 | } | ||||||||||
| 592 | |||||||||||
| 593 | # export all the functions lexically | ||||||||||
| 594 | 0 | ▶ | sub import { | ||||||||
|
Subroutine
import: not called CC=3 SCAR=18.7
| |||||||||||
| 595 | 0 | my $class = shift; | |||||||||
| 596 | 0 | my $caller = caller(); | |||||||||
| 597 | 0 | ▶ | my @export = scalar @_ ? @_ : keys %functions; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 598 | 0 | for my $key (@export) { | |||||||||
| 599 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 600 | 0 | *{"${caller}::$key"} = $class->can($key); | |||||||||
| 601 | } | ||||||||||
| 602 | } | ||||||||||
| 603 | |||||||||||
| 604 | 1; | ||||||||||
| 605 | |||||||||||
| 606 | package PDFio::FFI::Rect; | ||||||||||
| 607 | |||||||||||
| 608 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 609 | |||||||||||
| 610 | 1; | ||||||||||
| 611 | |||||||||||
| 612 | package PDFio::FFI::Array; | ||||||||||
| 613 | |||||||||||
| 614 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 615 | |||||||||||
| 616 | 1; | ||||||||||
| 617 | |||||||||||
| 618 | package PDFio::FFI::Dict; | ||||||||||
| 619 | |||||||||||
| 620 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 621 | |||||||||||
| 622 | 1; | ||||||||||
| 623 | |||||||||||
| 624 | package PDFio::FFI::Stream; | ||||||||||
| 625 | |||||||||||
| 626 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 627 | |||||||||||
| 628 | 1; | ||||||||||
| 629 | |||||||||||
| 630 | package PDFio::FFI::Object; | ||||||||||
| 631 | |||||||||||
| 632 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 633 | |||||||||||
| 634 | 1; | ||||||||||
| 635 | |||||||||||
| 636 | package PDFio::FFI::Encryption; | ||||||||||
| 637 | |||||||||||
| 638 | 0 | ▶ | sub new { bless $_[1], $_[0] } | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
| |||||||||||
| 639 | |||||||||||
| 640 | 1; | ||||||||||
| 641 | |||||||||||
| 642 | 1; | ||||||||||
| 643 | |||||||||||
| 644 | __END__ | ||||||||||