Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/leptonica/src/array_internal.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /*====================================================================* | |
| 2 - Copyright (C) 2001 Leptonica. All rights reserved. | |
| 3 - | |
| 4 - Redistribution and use in source and binary forms, with or without | |
| 5 - modification, are permitted provided that the following conditions | |
| 6 - are met: | |
| 7 - 1. Redistributions of source code must retain the above copyright | |
| 8 - notice, this list of conditions and the following disclaimer. | |
| 9 - 2. Redistributions in binary form must reproduce the above | |
| 10 - copyright notice, this list of conditions and the following | |
| 11 - disclaimer in the documentation and/or other materials | |
| 12 - provided with the distribution. | |
| 13 - | |
| 14 - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 15 - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 16 - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 17 - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY | |
| 18 - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 19 - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 20 - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 21 - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 22 - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 23 - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 24 - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 25 *====================================================================*/ | |
| 26 | |
| 27 #ifndef LEPTONICA_ARRAY_INTERNAL_H | |
| 28 #define LEPTONICA_ARRAY_INTERNAL_H | |
| 29 | |
| 30 /*! | |
| 31 * \file array_internal.h | |
| 32 * | |
| 33 * <pre> | |
| 34 * Contains the following structs: | |
| 35 * struct Numa array of floats | |
| 36 * struct Numaa | |
| 37 * struct L_Dna array of doubles | |
| 38 * struct L_Dnaa | |
| 39 * struct L_Dnahash | |
| 40 * struct Sarray array of C-strings | |
| 41 * struct L_Bytea array of bytes | |
| 42 * | |
| 43 * This file can be #included after allheaders.h in source files that | |
| 44 * require direct access to the internal data fields in these structs. | |
| 45 * | |
| 46 * Here are the non-image-related arrays in leptonica: | |
| 47 * * Numa, L_Dna, L_Ptra, Sarray: | |
| 48 * These have most of the typical operations of vectors, such as add, | |
| 49 * insert, remove and replace. | |
| 50 * * Numaa, L_Dnaa, L_Ptraa: | |
| 51 * These are arrays of float, double and generic pointer arrays. | |
| 52 * * L_Bytea: | |
| 53 * This is an array of bytes, analogous to a C++ string. | |
| 54 * * L_Dnahash: | |
| 55 * This is a simple hashing for integers, used in the jbig2 classifier. | |
| 56 * </pre> | |
| 57 */ | |
| 58 | |
| 59 | |
| 60 /*------------------------------------------------------------------------* | |
| 61 * Array Structs * | |
| 62 *------------------------------------------------------------------------*/ | |
| 63 /*! Numa version for serialization */ | |
| 64 #define NUMA_VERSION_NUMBER 1 | |
| 65 | |
| 66 /*! Number array: an array of floats */ | |
| 67 struct Numa | |
| 68 { | |
| 69 l_int32 nalloc; /*!< size of allocated number array */ | |
| 70 l_int32 n; /*!< number of numbers saved */ | |
| 71 l_atomic refcount; /*!< reference count (1 if no clones) */ | |
| 72 l_float32 startx; /*!< x value assigned to array[0] */ | |
| 73 l_float32 delx; /*!< change in x value as i --> i + 1 */ | |
| 74 l_float32 *array; /*!< number array */ | |
| 75 }; | |
| 76 | |
| 77 /*! Array of number arrays */ | |
| 78 struct Numaa | |
| 79 { | |
| 80 l_int32 nalloc; /*!< size of allocated ptr array */ | |
| 81 l_int32 n; /*!< number of Numa saved */ | |
| 82 struct Numa **numa; /*!< array of Numa */ | |
| 83 }; | |
| 84 | |
| 85 /*! Dna version for serialization */ | |
| 86 #define DNA_VERSION_NUMBER 1 | |
| 87 | |
| 88 /*! Double number array: an array of doubles */ | |
| 89 struct L_Dna | |
| 90 { | |
| 91 l_int32 nalloc; /*!< size of allocated number array */ | |
| 92 l_int32 n; /*!< number of numbers saved */ | |
| 93 l_atomic refcount; /*!< reference count (1 if no clones) */ | |
| 94 l_float64 startx; /*!< x value assigned to array[0] */ | |
| 95 l_float64 delx; /*!< change in x value as i --> i + 1 */ | |
| 96 l_float64 *array; /*!< number array */ | |
| 97 }; | |
| 98 | |
| 99 /*! Array of double number arrays */ | |
| 100 struct L_Dnaa | |
| 101 { | |
| 102 l_int32 nalloc; /*!< size of allocated ptr array */ | |
| 103 l_int32 n; /*!< number of L_Dna saved */ | |
| 104 struct L_Dna **dna; /*!< array of L_Dna */ | |
| 105 }; | |
| 106 | |
| 107 struct L_DnaHash | |
| 108 { | |
| 109 l_int32 nbuckets; | |
| 110 l_int32 initsize; /*!< initial size of each dna that is made */ | |
| 111 struct L_Dna **dna; /*!< array of L_Dna */ | |
| 112 }; | |
| 113 | |
| 114 /*! Sarray version for serialization */ | |
| 115 #define SARRAY_VERSION_NUMBER 1 | |
| 116 | |
| 117 /*! String array: an array of C strings */ | |
| 118 struct Sarray | |
| 119 { | |
| 120 l_int32 nalloc; /*!< size of allocated ptr array */ | |
| 121 l_int32 n; /*!< number of strings allocated */ | |
| 122 l_atomic refcount; /*!< reference count (1 if no clones) */ | |
| 123 char **array; /*!< string array */ | |
| 124 }; | |
| 125 | |
| 126 /*! Byte array (analogous to C++ "string") */ | |
| 127 struct L_Bytea | |
| 128 { | |
| 129 size_t nalloc; /*!< number of bytes allocated in data array */ | |
| 130 size_t size; /*!< number of bytes presently used */ | |
| 131 l_atomic refcount; /*!< reference count (1 if no clones) */ | |
| 132 l_uint8 *data; /*!< data array */ | |
| 133 }; | |
| 134 | |
| 135 #endif /* LEPTONICA_ARRAY_INTERNAL_H */ |
