Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / third_party / harfbuzz / src / harfbuzz-impl.h
1 /*
2  * Copyright (C) 1998-2004  David Turner and Werner Lemberg
3  * Copyright (C) 2006  Behdad Esfahbod
4  *
5  * This is part of HarfBuzz, an OpenType Layout engine library.
6  *
7  * Permission is hereby granted, without written agreement and without
8  * license or royalty fees, to use, copy, modify, and distribute this
9  * software and its documentation for any purpose, provided that the
10  * above copyright notice and the following two paragraphs appear in
11  * all copies of this software.
12  *
13  * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
15  * 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  * DAMAGE.
18  *
19  * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
20  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
21  * 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  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24  */
25
26 #ifndef HARFBUZZ_IMPL_H
27 #define HARFBUZZ_IMPL_H
28
29 #include "harfbuzz-global.h"
30
31 #include <stdlib.h>
32
33 HB_BEGIN_HEADER
34
35 #ifndef HB_INTERNAL
36 # define HB_INTERNAL
37 #endif
38
39 #ifndef NULL
40 # define NULL ((void *)0)
41 #endif
42
43 #ifndef FALSE
44 # define FALSE 0
45 #endif
46
47 #ifndef TRUE
48 # define TRUE 1
49 #endif
50
51 #ifndef TTAG_GDEF
52 # define TTAG_GDEF  HB_MAKE_TAG( 'G', 'D', 'E', 'F' )
53 #endif
54 #ifndef TTAG_GPOS
55 # define TTAG_GPOS  HB_MAKE_TAG( 'G', 'P', 'O', 'S' )
56 #endif
57 #ifndef TTAG_GSUB
58 # define TTAG_GSUB  HB_MAKE_TAG( 'G', 'S', 'U', 'B' )
59 #endif
60
61 #ifndef HB_UNUSED
62 # define HB_UNUSED(arg) ((arg) = (arg))
63 #endif
64
65 #define HB_LIKELY(cond) (cond)
66 #define HB_UNLIKELY(cond) (cond)
67
68 #define ARRAY_LEN(Array) ((int)(sizeof (Array) / sizeof (Array)[0]))
69
70
71
72 #define HB_IsHighSurrogate(ucs) \
73     (((ucs) & 0xfc00) == 0xd800)
74
75 #define HB_IsLowSurrogate(ucs) \
76     (((ucs) & 0xfc00) == 0xdc00)
77
78 #define HB_SurrogateToUcs4(high, low) \
79     (((HB_UChar32)(high))<<10) + (low) - 0x35fdc00;
80
81
82
83
84
85 #define  ALLOC(_ptr,_size)   \
86            ( (_ptr) = _hb_alloc( _size, &error ), error != 0 )
87
88 #define  REALLOC(_ptr,_newsz)  \
89            ( (_ptr) = _hb_realloc( (_ptr), (_newsz), &error ), error != 0 )
90
91 #define  FREE(_ptr)                    \
92   do {                                 \
93     if ( (_ptr) )                      \
94     {                                  \
95       _hb_free( _ptr );     \
96       _ptr = NULL;                     \
97     }                                  \
98   } while (0)
99
100 #define  ALLOC_ARRAY(_ptr,_count,_type)   \
101            ALLOC(_ptr,(_count)*sizeof(_type))
102
103 #define  REALLOC_ARRAY(_ptr,_newcnt,_type) \
104            REALLOC(_ptr,(_newcnt)*sizeof(_type))
105
106 #define  MEM_Copy(dest,source,count)   memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
107
108 #define ERR(err)   _hb_err (err)
109
110
111 HB_INTERNAL HB_Pointer
112 _hb_alloc( size_t    size,
113            HB_Error *perror_ );
114
115 HB_INTERNAL HB_Pointer
116 _hb_realloc( HB_Pointer block,
117              size_t     new_size,
118              HB_Error  *perror_ );
119
120 HB_INTERNAL void
121 _hb_free( HB_Pointer block );
122
123
124 /* helper func to set a breakpoint on */
125 HB_INTERNAL HB_Error
126 _hb_err (HB_Error code);
127
128
129 HB_END_HEADER
130
131 #endif /* HARFBUZZ_IMPL_H */