2 * Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 #ifndef _TVG_COMMON_H_
23 #define _TVG_COMMON_H_
26 #ifdef THORVG_LOG_ENABLED
37 #define strncasecmp _strnicmp
38 #define strcasecmp _stricmp
40 #define TVG_UNUSED __attribute__ ((__unused__))
43 // Portable 'fallthrough' attribute
44 #if __has_cpp_attribute(fallthrough)
46 #define TVG_FALLTHROUGH [[fallthrough]];
48 #define TVG_FALLTHROUGH __attribute__ ((fallthrough));
51 #define TVG_FALLTHROUGH
54 #define TVG_LOG_TAG "ThorVG"
56 #if defined(_MSC_VER) && defined(__clang__)
57 #define strncpy strncpy_s
58 #define strdup _strdup
61 //TVG class identifier values
62 #define TVG_CLASS_ID_UNDEFINED 0
63 #define TVG_CLASS_ID_SHAPE 1
64 #define TVG_CLASS_ID_SCENE 2
65 #define TVG_CLASS_ID_PICTURE 3
66 #define TVG_CLASS_ID_LINEAR 4
67 #define TVG_CLASS_ID_RADIAL 5
69 enum class FileType { Tvg = 0, Svg, Raw, Png, Jpg, Unknown };
71 #ifdef THORVG_LOG_ENABLED
72 //#define TVGLOG(tag, fmt, ...) fprintf(stdout, tag ": " fmt "\n", ##__VA_ARGS__) //Log Message for notifying user some useful info
73 //#define TVGERR(tag, fmt, ...) fprintf(stderr, tag ": " fmt "\n", ##__VA_ARGS__) //Error Message for us to fix it
75 //Use dlog system in Tizen
76 #define TVGLOG(tag, fmt, ...)
77 #define TVGERR(tag, fmt, ...) dlog_print(DLOG_ERROR, TVG_LOG_TAG, tag ": " fmt "\n", ##__VA_ARGS__)
83 uint16_t THORVG_VERSION_NUMBER();
85 #endif //_TVG_COMMON_H_