Graphiteng
Types.h
Go to the documentation of this file.
1 /* GRAPHITE2 LICENSING
2 
3  Copyright 2010, SIL International
4  All rights reserved.
5 
6  This library is free software; you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation; either version 2.1 of License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should also have received a copy of the GNU Lesser General Public
17  License along with this library in the file named "LICENSE".
18  If not, write to the Free Software Foundation, 51 Franklin Street,
19  Suite 500, Boston, MA 02110-1335, USA or visit their web page on the
20  internet at http://www.fsf.org/licenses/lgpl.html.
21 
22  Alternatively, the contents of this file may be used under the terms
23  of the Mozilla Public License (http://mozilla.org/MPL) or the GNU
24  General Public License, as published by the Free Software Foundation,
25  either version 2 of the License or (at your option) any later version.
26 */
27 #pragma once
28 
29 #include <stddef.h>
30 
31 typedef unsigned char gr_uint8;
32 typedef gr_uint8 gr_byte;
33 typedef signed char gr_int8;
34 typedef unsigned short gr_uint16;
35 typedef short gr_int16;
36 typedef unsigned int gr_uint32;
37 typedef int gr_int32;
38 
39 enum gr_encform {
40  gr_utf8 = 1/*sizeof(uint8)*/, gr_utf16 = 2/*sizeof(uint16)*/, gr_utf32 = 4/*sizeof(uint32)*/
41 };
42 
43 
44 // Define API function declspec/attributes and how each supported compiler or OS
45 // allows us to specify them.
46 #if defined __GNUC__
47  #define _gr2_and ,
48  #define _gr2_tag_fn(a) __attribute__((a))
49  #define _gr2_deprecated_flag deprecated
50  #define _gr2_export_flag visibility("default")
51  #define _gr2_import_flag visibility("default")
52  #define _gr2_static_flag visibility("hidden")
53 #endif
54 
55 #if defined _WIN32 || defined __CYGWIN__
56  #if defined __GNUC__ // These three will be redefined for Windows
57  #undef _gr2_export_flag
58  #undef _gr2_import_flag
59  #undef _gr2_static_flag
60  #else // How MSVC sepcifies function level attributes adn deprecation
61  #define _gr2_and
62  #define _gr2_tag_fn(a) __declspec(a)
63  #define _gr2_deprecated_flag deprecated
64  #endif
65  #define _gr2_export_flag dllexport
66  #define _gr2_import_flag dllimport
67  #define _gr2_static_flag
68 #endif
69 
70 #if defined GRAPHITE2_STATIC
71  #define GR2_API _gr2_tag_fn(_gr2_static_flag)
72  #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_static_flag)
73 #elif defined GRAPHITE2_EXPORTING
74  #define GR2_API _gr2_tag_fn(_gr2_export_flag)
75  #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_export_flag)
76 #else
77  #define GR2_API _gr2_tag_fn(_gr2_import_flag)
78  #define GR2_DEPRECATED_API _gr2_tag_fn(_gr2_deprecated_flag _gr2_and _gr2_import_flag)
79 #endif
gr_uint8
unsigned char gr_uint8
Definition: Types.h:31
gr_utf32
@ gr_utf32
Definition: Types.h:40
gr_uint32
unsigned int gr_uint32
Definition: Types.h:36
gr_byte
gr_uint8 gr_byte
Definition: Types.h:32
gr_int16
short gr_int16
Definition: Types.h:35
gr_int32
int gr_int32
Definition: Types.h:37
gr_encform
gr_encform
Definition: Types.h:39
gr_utf8
@ gr_utf8
Definition: Types.h:40
gr_utf16
@ gr_utf16
Definition: Types.h:40
gr_uint16
unsigned short gr_uint16
Definition: Types.h:34
gr_int8
signed char gr_int8
Definition: Types.h:33