Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/hb-string-array.hh @ 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 © 2017 Google, Inc. | |
| 3 * | |
| 4 * This is part of HarfBuzz, a text shaping library. | |
| 5 * | |
| 6 * Permission is hereby granted, without written agreement and without | |
| 7 * license or royalty fees, to use, copy, modify, and distribute this | |
| 8 * software and its documentation for any purpose, provided that the | |
| 9 * above copyright notice and the following two paragraphs appear in | |
| 10 * all copies of this software. | |
| 11 * | |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | |
| 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | |
| 16 * DAMAGE. | |
| 17 * | |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | |
| 23 * | |
| 24 * Google Author(s): Behdad Esfahbod | |
| 25 */ | |
| 26 | |
| 27 #ifndef HB_STRING_ARRAY_HH | |
| 28 #if 0 /* Make checks happy. */ | |
| 29 #define HB_STRING_ARRAY_HH | |
| 30 #endif | |
| 31 | |
| 32 #include "hb.hh" | |
| 33 | |
| 34 /* Based on Bruno Haible's code in Appendix B of Ulrich Drepper's dsohowto.pdf: | |
| 35 * https://software.intel.com/sites/default/files/m/a/1/e/dsohowto.pdf */ | |
| 36 | |
| 37 #define HB_STRING_ARRAY_TYPE_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr_t) | |
| 38 #define HB_STRING_ARRAY_POOL_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgstr) | |
| 39 #define HB_STRING_ARRAY_OFFS_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _msgidx) | |
| 40 #define HB_STRING_ARRAY_LENG_NAME HB_PASTE(HB_STRING_ARRAY_NAME, _length) | |
| 41 | |
| 42 static const union HB_STRING_ARRAY_TYPE_NAME { | |
| 43 struct { | |
| 44 /* I like to avoid storing the nul-termination byte since we don't need it, | |
| 45 * but C++ does not allow that. | |
| 46 * https://stackoverflow.com/q/28433862 | |
| 47 */ | |
| 48 #define _S(s) char HB_PASTE (str, __LINE__)[sizeof (s)]; | |
| 49 #include HB_STRING_ARRAY_LIST | |
| 50 #undef _S | |
| 51 } st; | |
| 52 char str[HB_VAR_ARRAY]; | |
| 53 } | |
| 54 HB_STRING_ARRAY_POOL_NAME = | |
| 55 { | |
| 56 { | |
| 57 #define _S(s) s, | |
| 58 #include HB_STRING_ARRAY_LIST | |
| 59 #undef _S | |
| 60 } | |
| 61 }; | |
| 62 static const unsigned int HB_STRING_ARRAY_OFFS_NAME[] = | |
| 63 { | |
| 64 #define _S(s) offsetof (union HB_STRING_ARRAY_TYPE_NAME, st.HB_PASTE(str, __LINE__)), | |
| 65 #include HB_STRING_ARRAY_LIST | |
| 66 #undef _S | |
| 67 sizeof (HB_STRING_ARRAY_TYPE_NAME) | |
| 68 }; | |
| 69 | |
| 70 static const unsigned int HB_STRING_ARRAY_LENG_NAME = ARRAY_LENGTH_CONST (HB_STRING_ARRAY_OFFS_NAME) - 1; | |
| 71 | |
| 72 static inline hb_bytes_t | |
| 73 HB_STRING_ARRAY_NAME (unsigned int i) | |
| 74 { | |
| 75 assert (i < ARRAY_LENGTH (HB_STRING_ARRAY_OFFS_NAME) - 1); | |
| 76 return hb_bytes_t (HB_STRING_ARRAY_POOL_NAME.str + HB_STRING_ARRAY_OFFS_NAME[i], | |
| 77 HB_STRING_ARRAY_OFFS_NAME[i + 1] - HB_STRING_ARRAY_OFFS_NAME[i] - 1); | |
| 78 } | |
| 79 | |
| 80 #undef HB_STRING_ARRAY_TYPE_NAME | |
| 81 #undef HB_STRING_ARRAY_POOL_NAME | |
| 82 #undef HB_STRING_ARRAY_OFFS_NAME | |
| 83 #undef HB_STRING_ARRAY_LENG_NAME | |
| 84 | |
| 85 #endif /* HB_STRING_ARRAY_HH */ |
