| 1 |
/* Copyright (C) 2018-2023 Artifex Software, Inc. |
| 2 |
All Rights Reserved. |
| 3 |
|
| 4 |
This software is provided AS-IS with no warranty, either express or |
| 5 |
implied. |
| 6 |
|
| 7 |
This software is distributed under license and may not be copied, |
| 8 |
modified or distributed except as expressly authorized under the terms |
| 9 |
of the license contained in the file LICENSE in this distribution. |
| 10 |
|
| 11 |
Refer to licensing information at http://www.artifex.com or contact |
| 12 |
Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, |
| 13 |
CA 94129, USA, for further information. |
| 14 |
*/ |
| 15 |
|
| 16 |
/* array handling for the PDF interpreter */ |
| 17 |
|
| 18 |
#ifndef PDF_ARRAY_FUNCTIONS |
| 19 |
#define PDF_ARRAY_FUNCTIONS |
| 20 |
|
| 21 |
static inline uint64_t pdfi_array_size(pdf_array *a) { return a->size; } |
| 22 |
|
| 23 |
int pdfi_array_fetch(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o, bool setref, bool cache); |
| 24 |
/* The object returned by pdfi_array_get has its reference count incremented by 1 to |
| 25 |
* indicate the reference now held by the caller, in **o. |
| 26 |
*/ |
| 27 |
static int inline pdfi_array_get(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o) |
| 28 |
{ |
| 29 |
return pdfi_array_fetch(ctx, a, index, o, true, true); |
| 30 |
} |
| 31 |
|
| 32 |
static int inline pdfi_array_get_nocache(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o) |
| 33 |
{ |
| 34 |
return pdfi_array_fetch(ctx, a, index, o, true, false); |
| 35 |
} |
| 36 |
|
| 37 |
void pdfi_free_array(pdf_obj *o); |
| 38 |
int pdfi_array_alloc(pdf_context *ctx, uint64_t size, pdf_array **a); |
| 39 |
int pdfi_array_from_stack(pdf_context *ctx, uint32_t indirect_num, uint32_t indirect_gen); |
| 40 |
int pdfi_array_get_no_deref(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o); |
| 41 |
int pdfi_array_get_no_store_R(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o); |
| 42 |
int pdfi_array_get_type(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj_type t, pdf_obj **o); |
| 43 |
int pdfi_array_get_int(pdf_context *ctx, pdf_array *a, uint64_t index, int64_t *i); |
| 44 |
int pdfi_array_get_number(pdf_context *ctx, pdf_array *a, uint64_t index, double *f); |
| 45 |
int pdfi_array_put(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj *o); |
| 46 |
int pdfi_array_put_int(pdf_context *ctx, pdf_array *a, uint64_t index, int64_t val); |
| 47 |
int pdfi_array_put_real(pdf_context *ctx, pdf_array *a, uint64_t index, double val); |
| 48 |
|
| 49 |
bool pdfi_array_known(pdf_context *ctx, pdf_array *a, pdf_obj *, int *index); |
| 50 |
|
| 51 |
void pdfi_normalize_rect(pdf_context *ctx, gs_rect *rect); |
| 52 |
int pdfi_array_to_gs_rect(pdf_context *ctx, pdf_array *array, gs_rect *rect); |
| 53 |
int pdfi_gs_rect_to_array(pdf_context *ctx, gs_rect *rect, pdf_array **new_array); |
| 54 |
int pdfi_array_to_gs_matrix(pdf_context *ctx, pdf_array *array, gs_matrix *matrix); |
| 55 |
int pdfi_array_to_num_array(pdf_context *ctx, pdf_array *array, double *out, int start, int size); |
| 56 |
void pdfi_bbox_transform(pdf_context *ctx, gs_rect *bbox, gs_matrix *matrix); |
| 57 |
|
| 58 |
int pdfi_array_fetch_recursing(pdf_context *ctx, pdf_array *a, uint64_t index, pdf_obj **o, bool setref, bool cache); |
| 59 |
|
| 60 |
#endif |