OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2007 Chris Wilson |
3 * Copyright © 2011 Google, Inc. | 3 * Copyright © 2009,2010 Red Hat, Inc. |
| 4 * Copyright © 2011,2012 Google, Inc. |
4 * | 5 * |
5 * This is part of HarfBuzz, a text shaping library. | 6 * This is part of HarfBuzz, a text shaping library. |
6 * | 7 * |
7 * Permission is hereby granted, without written agreement and without | 8 * Permission is hereby granted, without written agreement and without |
8 * license or royalty fees, to use, copy, modify, and distribute this | 9 * license or royalty fees, to use, copy, modify, and distribute this |
9 * software and its documentation for any purpose, provided that the | 10 * software and its documentation for any purpose, provided that the |
10 * above copyright notice and the following two paragraphs appear in | 11 * above copyright notice and the following two paragraphs appear in |
11 * all copies of this software. | 12 * all copies of this software. |
12 * | 13 * |
13 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
14 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | 15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
15 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | 16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
16 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | 17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
17 * DAMAGE. | 18 * DAMAGE. |
18 * | 19 * |
19 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
20 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
21 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | 22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
22 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
23 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
24 * | 25 * |
| 26 * Contributor(s): |
| 27 * Chris Wilson <chris@chris-wilson.co.uk> |
25 * Red Hat Author(s): Behdad Esfahbod | 28 * Red Hat Author(s): Behdad Esfahbod |
26 * Google Author(s): Behdad Esfahbod | 29 * Google Author(s): Behdad Esfahbod |
27 */ | 30 */ |
28 | 31 |
29 #ifndef HB_GLIB_H | 32 #ifndef HB_ATOMIC_PRIVATE_HH |
30 #define HB_GLIB_H | 33 #define HB_ATOMIC_PRIVATE_HH |
31 | 34 |
32 #include "hb.h" | 35 #include "hb-private.hh" |
33 #include <glib.h> | |
34 | |
35 HB_BEGIN_DECLS | |
36 | 36 |
37 | 37 |
38 hb_script_t | 38 /* atomic_int */ |
39 hb_glib_script_to_script (GUnicodeScript script); | |
40 | 39 |
41 GUnicodeScript | 40 /* We need external help for these */ |
42 hb_glib_script_from_script (hb_script_t script); | 41 |
| 42 #if 0 |
43 | 43 |
44 | 44 |
45 hb_unicode_funcs_t * | 45 #elif !defined(HB_NO_MT) && defined(_MSC_VER) && _MSC_VER >= 1600 |
46 hb_glib_get_unicode_funcs (void); | 46 |
| 47 #include <intrin.h> |
| 48 typedef long hb_atomic_int_t; |
| 49 #define hb_atomic_int_add(AI, V)» _InterlockedExchangeAdd (&(AI), (V)) |
47 | 50 |
48 | 51 |
49 HB_END_DECLS | 52 #elif !defined(HB_NO_MT) && defined(__APPLE__) |
50 | 53 |
51 #endif /* HB_GLIB_H */ | 54 #include <libkern/OSAtomic.h> |
| 55 typedef int32_t hb_atomic_int_t; |
| 56 #define hb_atomic_int_add(AI, V)» (OSAtomicAdd32Barrier ((V), &(AI)) - (V)
) |
| 57 |
| 58 |
| 59 #elif !defined(HB_NO_MT) && defined(HAVE_GLIB) |
| 60 |
| 61 #include <glib.h> |
| 62 typedef volatile int hb_atomic_int_t; |
| 63 #if GLIB_CHECK_VERSION(2,29,5) |
| 64 #define hb_atomic_int_add(AI, V)» g_atomic_int_add (&(AI), (V)) |
| 65 #else |
| 66 #define hb_atomic_int_add(AI, V)» g_atomic_int_exchange_and_add (&(AI), (V
)) |
| 67 #endif |
| 68 |
| 69 |
| 70 #else |
| 71 |
| 72 #define HB_ATOMIC_INT_NIL 1 |
| 73 typedef volatile int hb_atomic_int_t; |
| 74 #define hb_atomic_int_add(AI, V)» (((AI) += (V)) - (V)) |
| 75 |
| 76 #endif |
| 77 |
| 78 |
| 79 #endif /* HB_ATOMIC_PRIVATE_HH */ |
OLD | NEW |