hb-common.h revision ffbe0a853d5e7defa85d0eef53814c22d1ecb412
164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod/*
26c78683c042250a7b5a6fc6ebae4717b03fadf9eBehdad Esfahbod * Copyright (C) 2007,2008,2009  Red Hat, Inc.
364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *  This is part of HarfBuzz, an OpenType Layout engine library.
564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * Permission is hereby granted, without written agreement and without
764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * license or royalty fees, to use, copy, modify, and distribute this
864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * software and its documentation for any purpose, provided that the
964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * above copyright notice and the following two paragraphs appear in
1064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * all copies of this software.
1164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
1264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
1364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
1464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
1564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
1664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * DAMAGE.
1764aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
1864aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
1964aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
2064aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
2164aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
2264aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
2364aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod *
2464aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod * Red Hat Author(s): Behdad Esfahbod
2564aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod */
2664aef3a54999496fd1de4f5aa5b019e4c03b3836Behdad Esfahbod
278dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod#ifndef HB_COMMON_H
288dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod#define HB_COMMON_H
298dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod
30cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#ifdef _MSC_VER
31ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbod#define __STR2__(x) #x
32ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbod#define __STR1__(x) __STR2__(x)
33ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbod#define __LOC__ __FILE__ "("__STR1__(__LINE__)") : Warning Msg: "
34ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbod#pragma message(__LOC__"Not using stdint.h; integer types may have wrong size")
35cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef signed char int8_t;
36cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef unsigned char uint8_t;
37cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef signed short int16_t;
38cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef unsigned short uint16_t;
39cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef signed int int32_t;
40cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbodtypedef unsigned int uint32_t;
41ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbodtypedef signed long long int64_t;
42ffbe0a853d5e7defa85d0eef53814c22d1ecb412Behdad Esfahbodtypedef unsigned long long uint64_t;
43cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#ifndef __cplusplus
44cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#define inline __inline
45cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#endif
46cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#else
478dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod#include <stdint.h>
48cc4c096a7e08ae96b3030fe27f871ce5b797f370Behdad Esfahbod#endif
498dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod
508dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod# ifdef __cplusplus
51f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad Esfahbod#  define HB_BEGIN_DECLS	extern "C" {
52f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad Esfahbod#  define HB_END_DECLS		}
538dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod# else /* !__cplusplus */
54f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad Esfahbod#  define HB_BEGIN_DECLS
55f96ffd43bce0ac6d9c897933c9be0e51d543e570Behdad Esfahbod#  define HB_END_DECLS
568dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod# endif /* !__cplusplus */
578dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod
58590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodtypedef int hb_bool_t;
59590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod
60590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbodtypedef uint32_t hb_tag_t;
61590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod#define HB_TAG(a,b,c,d) ((hb_tag_t)(((uint8_t)a<<24)|((uint8_t)b<<16)|((uint8_t)c<<8)|(uint8_t)d))
62590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod#define HB_TAG_STR(s)   (HB_TAG(((const char *) s)[0], \
63590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod				((const char *) s)[1], \
64590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod				((const char *) s)[2], \
65590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod				((const char *) s)[3]))
660ead481a5a8623103565fd7d924666e7342278ddBehdad Esfahbod#define HB_TAG_NONE HB_TAG(0,0,0,0)
67590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod
682d15e72c75931398db5e027e660f1320bb979117Behdad Esfahbodtypedef uint32_t hb_codepoint_t;
69c7d457aa3ae7138630f52ca7263f663a3ea284c0Behdad Esfahbodtypedef int32_t hb_position_t;
70c7d457aa3ae7138630f52ca7263f663a3ea284c0Behdad Esfahbodtypedef int32_t hb_16dot16_t;
71468769b8f5332940278244e744ec2bd5a5dc5ee9Behdad Esfahbodtypedef uint32_t hb_mask_t;
72590d55cbb9e21ef74dfd88eee51fd0a763958cd2Behdad Esfahbod
730090dc0f67b553d2f6eaaedc289c0956ade09ef6Behdad Esfahbodtypedef void (*hb_destroy_func_t) (void *user_data);
740090dc0f67b553d2f6eaaedc289c0956ade09ef6Behdad Esfahbod
758dd1c8b8d6797d899d0f5b0a8015886bf6520ca2Behdad Esfahbod#endif /* HB_COMMON_H */
76